diff --git a/contrib/samples/deprecated/proplist/proplist.cpp b/contrib/samples/deprecated/proplist/proplist.cpp index 82f3ab52e1..f2f710453e 100644 --- a/contrib/samples/deprecated/proplist/proplist.cpp +++ b/contrib/samples/deprecated/proplist/proplist.cpp @@ -182,7 +182,7 @@ void MyApp::PropertyListTest(bool useDialog) if (useDialog) { propDialog = new PropListDialog(view, NULL, _T("Property Sheet Test"), - wxDefaultPosition, wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS); + wxDefaultPosition, wxSize(400, 500)); m_childWindow = propDialog; } else @@ -230,7 +230,7 @@ void MyApp::PropertyFormTest(bool useDialog) if (useDialog) { propDialog = new PropFormDialog(view, NULL, _T("Property Form Test"), - wxDefaultPosition, wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); + wxDefaultPosition, wxSize(380, 250)); m_childWindow = propDialog; } else diff --git a/contrib/samples/fl/fl_demo2.cpp b/contrib/samples/fl/fl_demo2.cpp index e84a6a97c7..23d3ed29ab 100644 --- a/contrib/samples/fl/fl_demo2.cpp +++ b/contrib/samples/fl/fl_demo2.cpp @@ -27,7 +27,7 @@ // wxWidgets headers. #include "wx/treectrl.h" #include "wx/imaglist.h" -#include "wx/notebook.h" +#include "wx/notebook.h" // fl headers. #include "wx/fl/controlbar.h" @@ -56,7 +56,7 @@ bool MyApp::OnInit(void) { // Create the main frame window MyFrame *frame = new MyFrame(NULL, _("wxWidgets 2.0 wxFrameLayout demo"), 50, 50, 650, 540); - + // Give it an icon #ifdef __WINDOWS__ frame->SetIcon(wxIcon(wxT("mondrian"))); @@ -64,66 +64,66 @@ bool MyApp::OnInit(void) #ifdef __X__ frame->SetIcon(wxIcon(wxT("aiai.xbm"))); #endif - + // Make a menubar wxMenu *file_menu = new wxMenu; wxMenu *active_menu = new wxMenu; - + file_menu->Append( ID_LOAD, _("&Load layouts") ); file_menu->Append( ID_STORE, _("&Store layouts") ); file_menu->AppendSeparator(); - - file_menu->Append( ID_AUTOSAVE, _("&Auto Save Layouts"), _("save layouts on exit"), TRUE ); + + file_menu->Append( ID_AUTOSAVE, _("&Auto Save Layouts"), _("save layouts on exit"), wxITEM_CHECK ); file_menu->AppendSeparator(); - + file_menu->Append(MINIMAL_ABOUT, _("A&bout !")); file_menu->Append(MINIMAL_QUIT, _("E&xit\tTab")); - + //active_menu->Append( ID_SETTINGS, _("&Settings...\tCtrl") ); //active_menu->AppendSeparator(); - + active_menu->Append( ID_REMOVE, _("&Remove Active") ); active_menu->Append( ID_REMOVEALL, _("Remove &All") ); active_menu->Append( ID_RECREATE, _("Re&create") ); active_menu->AppendSeparator(); - - active_menu->Append( ID_FIRST, _("Activate f&irst layout \tF1"), _("activate it"), TRUE ); - active_menu->Append( ID_SECOND, _("Activate &second layout\tF2"), _("activate it"), TRUE ); - active_menu->Append( ID_THIRD, _("Activate &third layout\tF3"), _("activate it"), TRUE ); - + + active_menu->Append( ID_FIRST, _("Activate f&irst layout \tF1"), _("activate it"), wxITEM_CHECK ); + active_menu->Append( ID_SECOND, _("Activate &second layout\tF2"), _("activate it"), wxITEM_CHECK ); + active_menu->Append( ID_THIRD, _("Activate &third layout\tF3"), _("activate it"), wxITEM_CHECK ); + wxMenuBar *menu_bar = new wxMenuBar; - + menu_bar->Append(file_menu, _("&File")); menu_bar->Append(active_menu, _("Active &Layout")); - + frame->CreateStatusBar(3); - + frame->SetMenuBar(menu_bar); - + frame->SyncMenuBarItems(); - + // Show the frame - frame->Show(TRUE); - + frame->Show(true); + SetTopWindow(frame); - - return TRUE; + + return true; } MyFrame::~MyFrame() { // frame-layouts is not a windows (objects), thus should // be cleaned up manually - + for( int i = 0; i != MAX_LAYOUTS; ++i ) { - if ( mLayouts[i] ) + if ( mLayouts[i] ) delete mLayouts[i]; } - - if ( mpNestedLayout ) + + if ( mpNestedLayout ) delete mpNestedLayout; - if ( mpAboutBoxLayout ) + if ( mpAboutBoxLayout ) delete mpAboutBoxLayout; } @@ -155,55 +155,55 @@ END_EVENT_TABLE() // My frame constructor MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h) - : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)), + : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)), mpNestedLayout( NULL ), mpAboutBoxLayout( NULL ), mActiveLayoutNo( FIRST_LAYOUT ), - mAutoSave( TRUE ), - mSavedAlready( FALSE ), + mAutoSave( true ), + mSavedAlready( false ), mpClntWindow( NULL ), - mImageList( 16,16, FALSE, 2 ) + mImageList( 16,16, false, 2 ) { int i; mpInternalFrm = (wxPanel*)this; - - mAboutBox.Create( this, -1, _T("About box in wxWidgets style..."), + + mAboutBox.Create( this, wxID_ANY, _T("About box in wxWidgets style..."), wxDefaultPosition, wxSize( 385,220), - wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL ); - - for( i = 0; i != MAX_LAYOUTS; ++i ) + wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL ); + + for( i = 0; i != MAX_LAYOUTS; ++i ) mLayouts[i] = NULL; - + // image-list is one of the few objects which - // currently cannot be serialized, create it first + // currently cannot be serialized, create it first // and use it as initial reference (IR) - + wxBitmap bmp1,bmp2; - + if ( wxFileExists( wxString(wxT(BMP_DIR)) + wxT("folder_icon.bmp") ) ) bmp1.LoadFile( wxString(wxT(BMP_DIR)) + wxT("folder_icon.bmp"), wxBITMAP_TYPE_BMP ); - + if ( wxFileExists( wxString(wxT(BMP_DIR)) + wxT("class_icon1.bmp") ) ) bmp2.LoadFile( wxString(wxT(BMP_DIR)) + wxT("class_icon1.bmp"), wxBITMAP_TYPE_BMP ); - + mImageList.Add( bmp1 ); mImageList.Add( bmp2 ); - + InitAboutBox(); - + // create multiple layouts - + mpNestedLayout = 0; - + mpClntWindow = CreateTxtCtrl(wxT("client window")); - + // Create all layouts for( i = 0; i != MAX_LAYOUTS; ++i ) - { + { CreateLayout( i ); } // hide others @@ -211,8 +211,8 @@ MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h { mLayouts[i]->HideBarWindows(); } - - // activate first one + + // activate first one mLayouts[FIRST_LAYOUT]->Activate(); mActiveLayoutNo = FIRST_LAYOUT; } @@ -221,24 +221,24 @@ MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h bool MyFrame::OnClose(void) { - // USEFUL TRICK:: avoids flickering of application's frame + // USEFUL TRICK:: avoids flickering of application's frame // when closing NN windows on exit: - - this->Show(FALSE); - + + Show(false); + if ( (mAutoSave && mSavedAlready) || !mAutoSave ) { } else { wxCommandEvent evt; - this->OnStore(evt); + OnStore(evt); } - + mAboutBox.Destroy(); - this->Destroy(); - - return TRUE; + Destroy(); + + return true; } void MyFrame::OnLoad( wxCommandEvent& WXUNUSED(event) ) @@ -254,24 +254,24 @@ void MyFrame::OnStore( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnAutoSave( wxCommandEvent& WXUNUSED(event) ) { mAutoSave = !mAutoSave; - + wxCommandEvent evt; - this->OnStore(evt); - + OnStore(evt); + SyncMenuBarItems(); } void MyFrame::OnRemove( wxCommandEvent& WXUNUSED(event) ) { RemoveLayout( mActiveLayoutNo ); - + Refresh(); } void MyFrame::OnRemoveAll( wxCommandEvent& WXUNUSED(event) ) { for( int i = 0; i != MAX_LAYOUTS; ++i ) - { + { RemoveLayout( i ); } @@ -282,9 +282,9 @@ void MyFrame::OnRemoveAll( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnRecreate( wxCommandEvent& event ) { OnRemove( event ); // first destroy active layout - + CreateLayout( mActiveLayoutNo ); - + mLayouts[mActiveLayoutNo]->Activate(); } @@ -305,20 +305,20 @@ void MyFrame::OnThird( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) { - // USEFUL TRICK:: avoids flickering of application's frame + // USEFUL TRICK:: avoids flickering of application's frame // when closing NN windows on exit: - - this->Show(FALSE); - + + Show(false); + if ( (mAutoSave && mSavedAlready) || !mAutoSave ) { } else { wxCommandEvent evt; - this->OnStore(evt); + OnStore(evt); } - + Destroy(); } @@ -330,42 +330,42 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) #else font.SetFamily( wxSWISS ); #endif - + font.SetStyle( wxSLANT ); font.SetWeight( wxNORMAL ); font.SetPointSize( 8 ); - + #ifdef __WXMSW__ font.RealizeResource(); #endif - + mAboutBox.Center( wxBOTH ); - mAboutBox.Show(TRUE); - + mAboutBox.Show(true); + } void MyFrame::OnChar( wxKeyEvent& event ) { wxCommandEvent evt; - + if ( event.m_keyCode == WXK_F1 ) { - this->OnFirst( evt ); + OnFirst( evt ); } else { if ( event.m_keyCode == WXK_F2 ) { - this->OnSecond( evt ); + OnSecond( evt ); } else { if ( event.m_keyCode == WXK_F3 ) - { - this->OnThird( evt ); + { + OnThird( evt ); } if ( event.m_keyCode == WXK_F4 && !event.AltDown() ) - { + { // "AI" :-) wxMessageBox(_("There are only 3 layouts in this demo :-(")); } @@ -373,20 +373,20 @@ void MyFrame::OnChar( wxKeyEvent& event ) { if ( event.m_keyCode == WXK_TAB ) { - // USEFUL TRICK:: avoids flickering of application's frame + // USEFUL TRICK:: avoids flickering of application's frame // when closing NN windows on exit: - - this->Show(FALSE); - + + Show(false); + if ( (mAutoSave && mSavedAlready) || !mAutoSave ) { } else { wxCommandEvent evt; - this->OnStore(evt); + OnStore(evt); } - + Destroy(); } else @@ -405,17 +405,17 @@ void MyFrame::OnSayItsOk( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnBtnYes( wxCommandEvent& WXUNUSED(event) ) { - mAboutBox.Show(FALSE); + mAboutBox.Show(false); } void MyFrame::OnBtnNo( wxCommandEvent& WXUNUSED(event) ) { - mAboutBox.Show(FALSE); + mAboutBox.Show(false); } void MyFrame::OnBtnEsc( wxCommandEvent& WXUNUSED(event) ) { - mAboutBox.Show(FALSE); + mAboutBox.Show(false); } /*** helper methods ***/ @@ -423,74 +423,74 @@ void MyFrame::OnBtnEsc( wxCommandEvent& WXUNUSED(event) ) void MyFrame::InitAboutBox() { wxPanel* pArea = new wxPanel(); - - pArea->Create( &mAboutBox, -1 ); - - new wxStaticText(pArea, -1, _("This is wxFrameLayout contribution demo."), + + pArea->Create( &mAboutBox, wxID_ANY ); + + new wxStaticText(pArea, wxID_ANY, _("This is wxFrameLayout contribution demo."), wxPoint(10, 10) ); - - new wxStaticText(pArea, -1, _("Aleksandras Gluchovas (c) 1998"), + + new wxStaticText(pArea, wxID_ANY, _("Aleksandras Gluchovas (c) 1998"), wxPoint(10, 30) ); - - new wxStaticText(pArea, -1, _(""), + + new wxStaticText(pArea, wxID_ANY, _(""), wxPoint(10, 50) ); - - mpAboutBoxLayout = new wxFrameLayout( &mAboutBox, pArea, TRUE ); - + + mpAboutBoxLayout = new wxFrameLayout( &mAboutBox, pArea, true ); + wxFrameLayout& layout = *mpAboutBoxLayout; - + cbDimInfo sizes( 90,40, // when docked horizontally 45,55, // when docked vertically 90,40, // when floated - TRUE, 4, 4 // true - bar is fixed-size - ); - - + true, 4, 4 // true - bar is fixed-size + ); + + wxButton* pYes = CreateButton(_("&Yes"), &mAboutBox, ID_SAY_ITSOK ); wxButton* pNo = CreateButton(_("&No"), &mAboutBox, ID_BTN_NO ); wxButton* pEsc = CreateButton(_("Cancel"), &mAboutBox, ID_BTN_ESC ); - + layout.AddBar( pEsc, sizes, FL_ALIGN_BOTTOM, 0, 20, _("cancel button")); layout.AddBar( pNo, sizes, FL_ALIGN_BOTTOM, 0, 20, _("no button")); layout.AddBar( pYes, sizes, FL_ALIGN_BOTTOM, 0, 20, _("yes button")); - + layout.mBorderPen.SetColour( 192, 192, 192 ); layout.SetMargins( 15, 15, 15, 15, wxALL_PANES ); - + cbCommonPaneProperties props; - + layout.GetPaneProperties( props, FL_ALIGN_TOP ); - - props.mShow3DPaneBorderOn = FALSE; - + + props.mShow3DPaneBorderOn = false; + layout.SetPaneProperties( props, wxALL_PANES ); - + layout.Activate(); - + pYes->SetDefault(); pYes->SetFocus(); } -wxTextCtrl* MyFrame::CreateTxtCtrl( const wxString& txt, wxWindow* parent ) +wxTextCtrl* MyFrame::CreateTxtCtrl( const wxString& txt, wxWindow* parent ) { return new wxTextCtrl( (parent != NULL ) ? parent : mpInternalFrm, - -1, txt, wxDefaultPosition, wxDefaultSize, + wxID_ANY, txt, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); } wxButton* MyFrame::CreateButton( const wxString& label, wxWindow* pParent, long id ) { - return new wxButton( (pParent)?pParent : mpInternalFrm, id, + return new wxButton( (pParent)?pParent : mpInternalFrm, id, label, wxPoint( 0,0 ), wxSize( 0,0 ) ); } wxTreeCtrl* MyFrame::CreateTreeCtrl( const wxString& label ) { - wxTreeCtrl* pTree = new wxTreeCtrl( mpInternalFrm, -1 ); - + wxTreeCtrl* pTree = new wxTreeCtrl( mpInternalFrm, wxID_ANY ); + const wxTreeItemId rootid = pTree->AppendItem( (long)0, label, 0); - + if ( label[0] != 'X' ) { pTree->AppendItem(rootid, _("Leaf1"), 0); @@ -501,25 +501,25 @@ wxTreeCtrl* MyFrame::CreateTreeCtrl( const wxString& label ) pTree->AppendItem(rootid, _("Scully"), 0); pTree->AppendItem(rootid, _("Mulder"), 0); } - + return pTree; } wxChoice* MyFrame::CreateChoice( const wxString& txt ) { wxString choice_strings[5]; - + choice_strings[0] = txt; choice_strings[1] = _("Julian"); choice_strings[2] = _("Hattie"); choice_strings[3] = _("Ken"); choice_strings[4] = _("Dick"); - - wxChoice *choice = new wxChoice( mpInternalFrm, 301, wxDefaultPosition, + + wxChoice *choice = new wxChoice( mpInternalFrm, 301, wxDefaultPosition, wxDefaultSize, 5, choice_strings); - + choice->SetSelection(0); - + return choice; } @@ -527,46 +527,46 @@ wxChoice* MyFrame::CreateChoice( const wxString& txt ) void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* WXUNUSED(pParent) ) { - cbDimInfo sizes2( 275,38, // when docked horizontally - 45,275, // when docked vertically - 80,30, // when floated - TRUE, // the bar is fixed-size + cbDimInfo sizes2( 275,38, // when docked horizontally + 45,275, // when docked vertically + 80,30, // when floated + true, // the bar is fixed-size 4, // vertical gap (bar border) 4, // horizontal gap (bar border) new cbDynToolBarDimHandler() - ); - - cbDimInfo sizes3( 275,55, // when docked horizontally - 275,60, // when docked vertically - 45,130, // when floated - TRUE, // the bar is fixed-size + ); + + cbDimInfo sizes3( 275,55, // when docked horizontally + 275,60, // when docked vertically + 45,130, // when floated + true, // the bar is fixed-size 4, // vertical gap (bar border) 4, // horizontal gap (bar border) new cbDynToolBarDimHandler() - ); - - cbDimInfo sizes4( 430,35, // when docked horizontally - 44,375, // when docked vertically - 80,100, // when floated - TRUE, // the bar is fixed-size + ); + + cbDimInfo sizes4( 430,35, // when docked horizontally + 44,375, // when docked vertically + 80,100, // when floated + true, // the bar is fixed-size 4, // vertical gap (bar border) 4, // horizontal gap (bar border) new cbDynToolBarDimHandler() - ); - - wxDynamicToolBar* pTBar2 = new wxDynamicToolBar( mpInternalFrm, -1 ); - - wxChoice* pChoice = new wxChoice( pTBar2, -1, wxDefaultPosition, wxSize( 140,25 ) ); - + ); + + wxDynamicToolBar* pTBar2 = new wxDynamicToolBar( mpInternalFrm, wxID_ANY ); + + wxChoice* pChoice = new wxChoice( pTBar2, wxID_ANY, wxDefaultPosition, wxSize( 140,25 ) ); + pTBar2->AddTool( 1, pChoice ); pTBar2->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("search.bmp") ); //pTBar2->AddSeparator(); pTBar2->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("bookmarks.bmp") ); pTBar2->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("nextmark.bmp") ); pTBar2->AddTool( 5, wxString(wxT(BMP_DIR)) + wxT("prevmark.bmp") ); - - wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 ); - + + wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, wxID_ANY ); + pTBar3->AddTool( 1, wxString(wxT(BMP_DIR)) + wxT("open.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Open ")) ); pTBar3->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("save.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Save ")) ); pTBar3->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("saveall.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Save All ")) ); @@ -574,201 +574,201 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* WXUNUSED(pPare pTBar3->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("cut.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Open ")) ); pTBar3->AddTool( 5, wxString(wxT(BMP_DIR)) + wxT("copy.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Copy ")) ); pTBar3->AddTool( 6, wxString(wxT(BMP_DIR)) + wxT("paste.bmp"), wxBITMAP_TYPE_BMP, wxString(_(" Paste ")) ); - + #ifdef __WXMSW__ - pTBar3->EnableTool( 2, FALSE ); + pTBar3->EnableTool( 2, false ); #endif - - wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, -1 ); - - pTBar4->AddTool( 1, wxString(wxT(BMP_DIR)) + wxT("bookmarks.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Bookmarks ")), TRUE ); - pTBar4->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("nextmark.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Next bookmark ")), TRUE ); - pTBar4->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("prevmark.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Prev bookmark ")), TRUE ); + + wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, wxID_ANY ); + + pTBar4->AddTool( 1, wxString(wxT(BMP_DIR)) + wxT("bookmarks.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Bookmarks ")), true ); + pTBar4->AddTool( 2, wxString(wxT(BMP_DIR)) + wxT("nextmark.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Next bookmark ")), true ); + pTBar4->AddTool( 3, wxString(wxT(BMP_DIR)) + wxT("prevmark.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Prev bookmark ")), true ); //pTBar4->AddSeparator(); - pTBar4->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("search.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Search ")), TRUE ); - + pTBar4->AddTool( 4, wxString(wxT(BMP_DIR)) + wxT("search.bmp"), wxBITMAP_TYPE_BMP, wxString(_("Search ")), true ); + #ifdef __WXMSW__ - pTBar4->EnableTool( 4, FALSE ); + pTBar4->EnableTool( 4, false ); #endif - - layout.AddBar( pTBar2, - sizes2, FL_ALIGN_TOP, - 0, - 0, - wxT("Search"), - TRUE + + layout.AddBar( pTBar2, + sizes2, FL_ALIGN_TOP, + 0, + 0, + wxT("Search"), + true ); - - layout.AddBar( pTBar3, - sizes3, FL_ALIGN_BOTTOM, - 0, - 0, - wxT("Titled"), - TRUE + + layout.AddBar( pTBar3, + sizes3, FL_ALIGN_BOTTOM, + 0, + 0, + wxT("Titled"), + true ); - - layout.AddBar( pTBar4, - sizes4, FL_ALIGN_BOTTOM, - 1, - 0, - wxT("Bookmarks"), - TRUE + + layout.AddBar( pTBar4, + sizes4, FL_ALIGN_BOTTOM, + 1, + 0, + wxT("Bookmarks"), + true ); } wxWindow* MyFrame::CreateDevLayout( wxFrameLayout& layout, wxWindow* pParent ) { bool isNested = (pParent != mpInternalFrm); - + // check if we're craeting nested layout if ( isNested ) { layout.mBorderPen.SetColour( 128,255,128 ); - + // if so, than make border smaller for( int i = 0; i != MAX_PANES; ++i ) { cbDockPane& pane = *layout.GetPane( i ); - + pane.mTopMargin = 5; pane.mBottomMargin = 5; pane.mLeftMargin = 5; pane.mRightMargin = 5; } } - + int cbWidth = 200; int cbHeight = ( isNested ) ? 50 : 150; - + cbDimInfo sizes4( cbWidth,cbHeight, cbWidth,cbHeight, - cbWidth,cbHeight, FALSE ); - + cbWidth,cbHeight, false ); + cbWidth = 75; cbHeight = 31; - + cbDimInfo sizes5( cbWidth,cbHeight, 42,65, - cbWidth,cbHeight, TRUE, + cbWidth,cbHeight, true, 3, // vertical gap (bar border) 3 // horizontal gap (bar border) - ); - + ); + // create "workplace" window in the third layout // SEB: originally here was a wxpp (wxWorkshop) class demotrated // wxTabbedWindow* pMiniTabArea = new wxTabbedWindow(); - // pMiniTabArea->Create( pParent, -1 ); - - - wxTreeCtrl* pClassView = new wxTreeCtrl( pParent, -1, + // pMiniTabArea->Create( pParent, wxID_ANY ); + + + wxTreeCtrl* pClassView = new wxTreeCtrl( pParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS ); - + pClassView->SetImageList( &mImageList ); - + wxTreeItemId rootId = pClassView->AddRoot( wxT("wxWidgets 2.0 classes"), 0 ); - + pClassView->AppendItem( rootId, _("wxWin Dynamic classes (grabbed at run-time)"), 0 ); pClassView->AppendItem( rootId, _("serializer-classes (grabbed at run-time)"), 0 ); - + // now create "output" window - wxNotebook* pTabbedArea = new wxNotebook(pParent, -1); + wxNotebook* pTabbedArea = new wxNotebook(pParent, wxID_ANY); // SEB: originally here was a wxpp (wxWorkshop) class used // wxPaggedWindow* pTabbedArea = new wxPaggedWindow(); - // pTabbedArea->Create( pParent, -1 ); - + // pTabbedArea->Create( pParent, wxID_ANY ); + wxPanel* pSheet3 = new wxPanel(); - pSheet3->Create( pTabbedArea, -1 ); - pSheet3->Show(FALSE); - + pSheet3->Create( pTabbedArea, wxID_ANY ); + pSheet3->Show(false); + pTabbedArea->AddPage( CreateTxtCtrl(wxT("build"), pTabbedArea), wxT("Build")); pTabbedArea->AddPage( CreateTxtCtrl(wxT("debug"), pTabbedArea), wxT("Debug")); pTabbedArea->AddPage( pSheet3, wxT("is THIS recursive - or what !?")); pTabbedArea->AddPage( CreateTxtCtrl(wxT("profile"), pTabbedArea), wxT("Profile")); - + layout.AddBar( new StartButton95(pParent), sizes5, FL_ALIGN_TOP, 0, 0, wxT("Start...") ); layout.AddBar( pClassView, sizes4, FL_ALIGN_LEFT, 0, 0, wxT("Project Workplace") ); layout.AddBar( pTabbedArea, sizes4, FL_ALIGN_BOTTOM, 0, 50, wxT("Output") ); - + return pSheet3; } void MyFrame::DropInSomeBars( int layoutNo ) { /* create once... and forget! */ - + // setup dimension infos for various bar shapes - + int cbWidth = 90; int cbHeight = 30; - - if ( layoutNo == SECOND_LAYOUT ) + + if ( layoutNo == SECOND_LAYOUT ) cbHeight = 60; - + wxFrameLayout& layout = *mLayouts[layoutNo]; - + cbDimInfo sizes( cbWidth,cbHeight, // when docked horizontally cbWidth,cbHeight, // when docked vertically cbWidth,cbHeight, // when floated - TRUE // true - bar is fixed-size - ); - + true // true - bar is fixed-size + ); + cbWidth = 120; - + cbDimInfo sizes1( cbWidth,cbHeight, cbWidth,cbHeight, - cbWidth,cbHeight, FALSE ); // false - bar is "flexible" + cbWidth,cbHeight, false ); // false - bar is "flexible" cbWidth = 120; cbHeight = 40; - + cbDimInfo sizes3( cbWidth,cbHeight, cbWidth,cbHeight, - cbWidth,cbHeight, TRUE ); // -/- - + cbWidth,cbHeight, true ); // -/- + cbWidth = 200; cbHeight = 150; - + cbDimInfo sizes4( cbWidth,cbHeight, cbWidth,cbHeight, - cbWidth,cbHeight, FALSE ); // -/- - + cbWidth,cbHeight, false ); // -/- + cbWidth = 63; cbHeight = 31; - + cbDimInfo sizes5( cbWidth,cbHeight, cbHeight,cbWidth, - cbWidth,cbHeight, TRUE, + cbWidth,cbHeight, true, 3, // vertical gap (bar border) 3 // horizontal gap (bar border) ); // -/- - - + + if ( layoutNo == FIRST_LAYOUT ) { // add 4 fixed-size bars (`sizes' dim-info) and one "flexible" (with `sizes1' dim-info) - + wxWindow* pGreenOne = new MyTestPanel(mpInternalFrm); - + pGreenOne->SetBackgroundColour( wxColour(128,255,128) ); - - layout.AddBar( pGreenOne, sizes, FL_ALIGN_TOP, 0, 50, wxT("Bar1"), TRUE ); - layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_TOP, 2, 50, wxT("Bar2"), TRUE ); - layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_BOTTOM, 2, 50, wxT("Bar3"), TRUE ); - layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_LEFT, 2, 50, wxT("Bar4"), TRUE ); - layout.AddBar( new MyTestPanel(mpInternalFrm), sizes1, wxCBAR_HIDDEN, 2, 50, wxT("Super-Bar"), TRUE ); + + layout.AddBar( pGreenOne, sizes, FL_ALIGN_TOP, 0, 50, wxT("Bar1"), true ); + layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_TOP, 2, 50, wxT("Bar2"), true ); + layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_BOTTOM, 2, 50, wxT("Bar3"), true ); + layout.AddBar( new MyTestPanel(mpInternalFrm), sizes, FL_ALIGN_LEFT, 2, 50, wxT("Bar4"), true ); + layout.AddBar( new MyTestPanel(mpInternalFrm), sizes1, wxCBAR_HIDDEN, 2, 50, wxT("Super-Bar"), true ); } else { if ( layoutNo == SECOND_LAYOUT ) { // show off various wx-controls in the second layout - + layout.AddBar( CreateTxtCtrl(), sizes, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area&0") ); layout.AddBar( CreateButton(wxT("OK")), sizes, FL_ALIGN_TOP, 0, 100, wxT("First Button") ); layout.AddBar( CreateTxtCtrl(), sizes1, FL_ALIGN_BOTTOM, 0, 50, wxT("First Tree") ); layout.AddBar( CreateTreeCtrl(wxT("Root")), sizes1, FL_ALIGN_LEFT, 0, 0, wxT("TreeCtrl Window") ); - layout.AddBar( CreateChoice(wxT("Choice 1")), sizes3, FL_ALIGN_TOP, 0, 0, wxT("Choice 1 (buggy)"), FALSE, wxCBAR_HIDDEN ); - layout.AddBar( CreateChoice(wxT("Choice 2")), sizes3, FL_ALIGN_TOP, 0, 0, wxT("Choice 2 (buggy)"), FALSE, wxCBAR_HIDDEN ); + layout.AddBar( CreateChoice(wxT("Choice 1")), sizes3, FL_ALIGN_TOP, 0, 0, wxT("Choice 1 (buggy)"), false, wxCBAR_HIDDEN ); + layout.AddBar( CreateChoice(wxT("Choice 2")), sizes3, FL_ALIGN_TOP, 0, 0, wxT("Choice 2 (buggy)"), false, wxCBAR_HIDDEN ); layout.AddBar( CreateTreeCtrl(wxT("X-Files")), sizes1, FL_ALIGN_RIGHT, 0, 100, wxT("X-Files") ); layout.AddBar( CreateTxtCtrl(wxT("smaller1")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("smaller Area1") ); layout.AddBar( CreateTxtCtrl(wxT("smaller2")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("sm&ller Area2") ); @@ -780,10 +780,10 @@ void MyFrame::DropInSomeBars( int layoutNo ) #if defined(__WXGTK__) || defined(__WXX11__) cbCommonPaneProperties props; layout.GetPaneProperties( props ); - props.mRealTimeUpdatesOn = FALSE; // real-time OFF for gtk!!! + props.mRealTimeUpdatesOn = false; // real-time OFF for gtk!!! layout.SetPaneProperties( props, wxALL_PANES ); #endif - + layout.AddBar( CreateTxtCtrl(wxT("Tool1")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area1") ); layout.AddBar( CreateTxtCtrl(wxT("Tool2")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area2") ); layout.AddBar( CreateTxtCtrl(wxT("Tool3")), sizes3, FL_ALIGN_TOP, 0, 50, wxT("Fixed text Area3") ); @@ -791,102 +791,102 @@ void MyFrame::DropInSomeBars( int layoutNo ) layout.AddBar( CreateTxtCtrl(wxT("Tool5")), sizes3, FL_ALIGN_TOP, 1, 50, wxT("Fixed text Area5") ); layout.AddBar( CreateTxtCtrl(wxT("Tool6")), sizes3, FL_ALIGN_TOP, 1, 50, wxT("Fixed text Area6") ); layout.AddBar( CreateTxtCtrl(wxT("Tool7")), sizes3, FL_ALIGN_TOP, 2,250, wxT("Fixed text Area7") ); - - cbDimInfo sizes10( 175,35, // when docked horizontally - 175,38, // when docked vertically - 170,35, // when floated - TRUE, // the bar is not fixed-size + + cbDimInfo sizes10( 175,35, // when docked horizontally + 175,38, // when docked vertically + 170,35, // when floated + true, // the bar is not fixed-size 4, // vertical gap (bar border) 4, // horizontal gap (bar border) new cbDynToolBarDimHandler() - ); - + ); + wxDynamicToolBar* pToolBar = new wxDynamicToolBar(); - - pToolBar->Create( mpInternalFrm, -1 ); - + + pToolBar->Create( mpInternalFrm, wxID_ANY ); + // 1001-1006 ids of command events fired by added tool-buttons - + pToolBar->AddTool( 1001, wxString(wxT(BMP_DIR)) + wxT("new.bmp") ); pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") ); pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") ); - + pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") ); pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") ); pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") ); - + layout.AddBar( pToolBar, // bar window (can be NULL) sizes10, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) 0, // insert into 0th row (vert. position) 0, // offset from the start of row (in pixels) wxT("Real-Toolbar"), // name to refere in customization pop-ups - FALSE + false ); - + // create first "developement" layout AddSearchToolbars( layout, mpInternalFrm); - + wxWindow* pSheet3 = CreateDevLayout( layout, mpInternalFrm); - + // create another ***secreat developement*** layout inside // the third sheet of the outter one's output bar - - mpNestedLayout = new wxFrameLayout( pSheet3, - CreateTxtCtrl(wxT("\"Mobils in Mobile\" --C.Nemo"),pSheet3), FALSE ); - + + mpNestedLayout = new wxFrameLayout( pSheet3, + CreateTxtCtrl(wxT("\"Mobils in Mobile\" --C.Nemo"),pSheet3), false ); + CreateDevLayout( *mpNestedLayout, pSheet3 ); - + mpNestedLayout->Activate(); } } } -} +} void MyFrame::CreateLayout( int layoutNo ) { - wxFrameLayout* pLayout = new wxFrameLayout( mpInternalFrm, mpClntWindow, FALSE ); - + wxFrameLayout* pLayout = new wxFrameLayout( mpInternalFrm, mpClntWindow, false ); + if ( layoutNo == THIRD_LAYOUT ) { pLayout->PushDefaultPlugins(); pLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // facny "X"es and beveal for bars -#if defined(__WXGTK__) || defined(__WXX11__) +#if defined(__WXGTK__) || defined(__WXX11__) pLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); #endif - pLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) ); + pLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) ); } - + mLayouts[layoutNo] = pLayout; - + DropInSomeBars( layoutNo ); } void MyFrame::RemoveLayout( int layoutNo ) { wxFrameLayout* pLayout = mLayouts[layoutNo]; - - if ( !pLayout ) + + if ( !pLayout ) return; - + pLayout->HideBarWindows(); - + // destroy nested layout first - + if ( layoutNo == THIRD_LAYOUT ) { - if ( mpNestedLayout ) + if ( mpNestedLayout ) delete mpNestedLayout; mpNestedLayout = NULL; } - - // NOTE:: bar windows are NOT destroyed automatically by frame-layout - + + // NOTE:: bar windows are NOT destroyed automatically by frame-layout + pLayout->DestroyBarWindows(); - + delete pLayout; - + mLayouts[layoutNo] = NULL; - + Refresh(); } @@ -896,25 +896,25 @@ void MyFrame::SyncMenuBarItems() { GetMenuBar()->Check( ID_FIRST+i, mActiveLayoutNo == FIRST_LAYOUT+i ); } - + GetMenuBar()->Check( ID_AUTOSAVE, mAutoSave ); } void MyFrame::ActivateLayout( int layoutNo ) { - if ( layoutNo == mActiveLayoutNo ) + if ( layoutNo == mActiveLayoutNo ) return; - + if ( mLayouts[mActiveLayoutNo] ) mLayouts[mActiveLayoutNo]->Deactivate(); - + mActiveLayoutNo = layoutNo; - - if ( mLayouts[mActiveLayoutNo] ) + + if ( mLayouts[mActiveLayoutNo] ) mLayouts[mActiveLayoutNo]->Activate(); else Refresh(); - + SyncMenuBarItems(); } @@ -930,7 +930,7 @@ END_EVENT_TABLE() void StartButton95::OnMouseDown( wxMouseEvent& WXUNUSED(event) ) { - m_bPressed = TRUE; + m_bPressed = true; Refresh(); CaptureMouse(); } @@ -938,14 +938,14 @@ void StartButton95::OnMouseDown( wxMouseEvent& WXUNUSED(event) ) void StartButton95::OnMouseUp( wxMouseEvent& WXUNUSED(event) ) { // "this is not a bug" - + SetCursor( wxCURSOR_WAIT ); GetParent()->SetCursor( wxCURSOR_WAIT ); - ::wxSetCursor( wxCURSOR_WAIT ); + ::wxSetCursor( wxCURSOR_WAIT ); wxSleep(1); - - for( int i = 1; i != 6; ++i ) - { + + for( int i = 1; i != 6; ++i ) + { m_bPressed = (i % 2) != 0; Refresh(); wxSleep(1); @@ -957,30 +957,30 @@ void StartButton95::OnMouseUp( wxMouseEvent& WXUNUSED(event) ) void StartButton95::OnPaint( wxPaintEvent& WXUNUSED(event) ) { wxBitmap* pBmp; - + if ( m_bPressed ) { if ( !m_PBmp.Ok() && wxFileExists( wxString(wxT(BMP_DIR)) + wxT("start95_pr.bmp") ) ) - + m_PBmp.LoadFile( wxString(wxT(BMP_DIR)) + wxT("start95_pr.bmp"), wxBITMAP_TYPE_BMP ); - + pBmp = &m_PBmp; } else { if ( !m_DBmp.Ok() && wxFileExists( wxString(wxT(BMP_DIR)) + wxT("start95_dp.bmp") ) ) - + m_DBmp.LoadFile( wxString(wxT(BMP_DIR)) + wxT("start95_dp.bmp"), wxBITMAP_TYPE_BMP ); - + pBmp = &m_DBmp; } - + if (!pBmp) return; wxMemoryDC mdc; wxPaintDC dc(this); mdc.SelectObject( *pBmp ); - + dc.Blit( 0,0, pBmp->GetWidth(), pBmp->GetHeight(), &mdc, 0,0, wxCOPY ); - + mdc.SelectObject( wxNullBitmap ); } diff --git a/contrib/src/deprecated/proplist.cpp b/contrib/src/deprecated/proplist.cpp index 5e366c05ef..98f4853ebd 100644 --- a/contrib/src/deprecated/proplist.cpp +++ b/contrib/src/deprecated/proplist.cpp @@ -1643,7 +1643,7 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList wxBeginBusyCursor(); wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent, - title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); + title, wxPoint(10, 10), wxSize(400, 400)); dialog->m_stringList = stringList; diff --git a/demos/forty/playerdg.cpp b/demos/forty/playerdg.cpp index 62ca583370..e37200e70c 100644 --- a/demos/forty/playerdg.cpp +++ b/demos/forty/playerdg.cpp @@ -6,9 +6,7 @@ // Created: 21/07/97 // RCS-ID: $Id$ // Copyright: (c) 1993-1998 Chris Breeze -// Licence: wxWindows licence -//--------------------------------------------------------------------------- -// Last modified: 22nd July 1998 - ported to wxWidgets 2.0 +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -33,57 +31,55 @@ const int ID_LISTBOX = 101; BEGIN_EVENT_TABLE(PlayerSelectionDialog, wxDialog) - EVT_SIZE(PlayerSelectionDialog::OnSize) - EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback) - EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback) - EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback) + EVT_SIZE(PlayerSelectionDialog::OnSize) + EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback) + EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback) + EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback) EVT_CLOSE(PlayerSelectionDialog::OnCloseWindow) END_EVENT_TABLE() PlayerSelectionDialog::PlayerSelectionDialog( - wxWindow* parent, - ScoreFile* file - ) : - wxDialog(parent, wxID_ANY, _T("Player Selection"), - wxDefaultPosition, wxDefaultSize, - wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE), - m_scoreFile(file) + wxWindow* parent, + ScoreFile* file + ) : + wxDialog(parent, wxID_ANY, _T("Player Selection"), wxDefaultPosition), + m_scoreFile(file) { - wxStaticText* msg = new wxStaticText(this, wxID_ANY, _T("Please select a name or type a new one:")); + wxStaticText* msg = new wxStaticText(this, wxID_ANY, _T("Please select a name or type a new one:")); - wxListBox* list = new wxListBox( - this, ID_LISTBOX, - wxDefaultPosition, wxDefaultSize, - 0, 0, - wxLB_SINGLE - ); - - wxArrayString players; - m_scoreFile->GetPlayerList(players); - for (unsigned int i = 0; i < players.Count(); i++) - { - list->Append(players[i]); - } + wxListBox* list = new wxListBox( + this, ID_LISTBOX, + wxDefaultPosition, wxDefaultSize, + 0, 0, + wxLB_SINGLE + ); - m_textField = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, 0); + wxArrayString players; + m_scoreFile->GetPlayerList(players); + for (unsigned int i = 0; i < players.Count(); i++) + { + list->Append(players[i]); + } - m_OK = new wxButton(this, wxID_OK, _T("OK")); - m_cancel = new wxButton(this, wxID_CANCEL, _T("Cancel")); + m_textField = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize); - wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); - button_sizer->Add( m_OK, 0, wxALL, 10 ); - button_sizer->Add( m_cancel, 0, wxALL, 10 ); + m_OK = new wxButton(this, wxID_OK, _T("OK")); + m_cancel = new wxButton(this, wxID_CANCEL, _T("Cancel")); - wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - topsizer->Add( msg, 0, wxALL , 10 ); - topsizer->Add( list, 1, wxEXPAND | wxLEFT | wxRIGHT, 10 ); - topsizer->Add( m_textField, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10 ); - topsizer->Add( button_sizer, 0, wxALIGN_LEFT ); + wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); + button_sizer->Add( m_OK, 0, wxALL, 10 ); + button_sizer->Add( m_cancel, 0, wxALL, 10 ); - SetSizer( topsizer ); + wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); + topsizer->Add( msg, 0, wxALL , 10 ); + topsizer->Add( list, 1, wxEXPAND | wxLEFT | wxRIGHT, 10 ); + topsizer->Add( m_textField, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10 ); + topsizer->Add( button_sizer, 0, wxALIGN_LEFT ); + + SetSizer( topsizer ); + + topsizer->SetSizeHints( this ); - topsizer->SetSizeHints( this ); - CentreOnParent(); } @@ -93,58 +89,58 @@ PlayerSelectionDialog::~PlayerSelectionDialog() void PlayerSelectionDialog::OnSize(wxSizeEvent& WXUNUSED(event)) { - Layout(); + Layout(); } const wxString& PlayerSelectionDialog::GetPlayersName() { /* - m_player = ""; - Show(true); + m_player = wxEmptyString; + Show(true); */ - return m_player; + return m_player; } void PlayerSelectionDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { - m_player = _T(""); + m_player = wxEmptyString; EndModal(wxID_CANCEL); } void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event) { - if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED) - { -// if (event.IsSelection()) - m_textField->SetValue(event.GetString()); - } + if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED) + { +// if (event.IsSelection()) + m_textField->SetValue(event.GetString()); + } } void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event) { - if (event.GetId() == wxID_OK) - { - wxString name = m_textField->GetValue(); - if (!name.IsNull() && name.Length() > 0) - { - if (name.Contains(_T('@'))) - { - wxMessageBox(_T("Names should not contain the '@' character"), _T("Forty Thieves")); - } - else - { - m_player = name; - EndModal(wxID_OK); - } - } - else - { - wxMessageBox(_T("Please enter your name"), _T("Forty Thieves")); - } - } - else - { - m_player = _T(""); - EndModal(wxID_CANCEL); - } + if (event.GetId() == wxID_OK) + { + wxString name = m_textField->GetValue(); + if (!name.IsNull() && name.Length() > 0) + { + if (name.Contains(_T('@'))) + { + wxMessageBox(_T("Names should not contain the '@' character"), _T("Forty Thieves")); + } + else + { + m_player = name; + EndModal(wxID_OK); + } + } + else + { + wxMessageBox(_T("Please enter your name"), _T("Forty Thieves")); + } + } + else + { + m_player = wxEmptyString; + EndModal(wxID_CANCEL); + } } diff --git a/demos/forty/scoredg.cpp b/demos/forty/scoredg.cpp index c241cff5a7..8c02afc433 100644 --- a/demos/forty/scoredg.cpp +++ b/demos/forty/scoredg.cpp @@ -6,9 +6,7 @@ // Created: 21/07/97 // RCS-ID: $Id$ // Copyright: (c) 1993-1998 Chris Breeze -// Licence: wxWindows licence -//--------------------------------------------------------------------------- -// Last modified: 22nd July 1998 - ported to wxWidgets 2.0 +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(__APPLE__) @@ -38,49 +36,49 @@ class ScoreCanvas : public wxScrolledWindow { public: - ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size); - virtual ~ScoreCanvas(); + ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size); + virtual ~ScoreCanvas(); - void OnDraw(wxDC& dc); + void OnDraw(wxDC& dc); private: - wxFont* m_font; - wxString m_text; + wxFont *m_font; + wxString m_text; }; ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size) : - wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER) + wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER) { SetBackgroundColour(*wxWHITE); #ifdef __WXGTK__ - m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL); + m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL); #else - m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL); + m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL); #endif wxArrayString players; - scoreFile->GetPlayerList( players); + scoreFile->GetPlayerList( players); - wxString os; + wxString os; - os << wxT("Player\tWins\tGames\tScore\n"); - for (unsigned int i = 0; i < players.Count(); i++) - { - int wins, games, score; - scoreFile->ReadPlayersScore(players[i], wins, games, score); - int average = 0; - if (games > 0) - { - average = (2 * score + games) / (2 * games); - } + os << wxT("Player\tWins\tGames\tScore\n"); + for (unsigned int i = 0; i < players.Count(); i++) + { + int wins, games, score; + scoreFile->ReadPlayersScore(players[i], wins, games, score); + int average = 0; + if (games > 0) + { + average = (2 * score + games) / (2 * games); + } - os << players[i] << wxT('\t') - << wins << wxT('\t') - << games << wxT('\t') - << average << wxT('\n'); - } - os << wxT('\0'); - m_text = os; + os << players[i] << wxT('\t') + << wins << wxT('\t') + << games << wxT('\t') + << average << wxT('\n'); + } + os << wxT('\0'); + m_text = os; } ScoreCanvas::~ScoreCanvas() @@ -89,45 +87,45 @@ ScoreCanvas::~ScoreCanvas() void ScoreCanvas::OnDraw(wxDC& dc) { - dc.SetFont(* m_font); + dc.SetFont(* m_font); - const wxChar* str = m_text; - unsigned int tab = 0; - unsigned int tabstops[] = { 5, 100, 150, 200 }; + const wxChar* str = m_text; + unsigned int tab = 0; + unsigned int tabstops[] = { 5, 100, 150, 200 }; - // get the line spacing for the current font - int lineSpacing; - { - long w, h; - dc.GetTextExtent(wxT("Testing"), &w, &h); - lineSpacing = (int)h; - } + // get the line spacing for the current font + int lineSpacing; + { + long w, h; + dc.GetTextExtent(wxT("Testing"), &w, &h); + lineSpacing = (int)h; + } - int y = 0; - while (*str) - { - wxChar text[256]; - wxChar* dest = text; - - while (*str && *str >= ' ') *dest++ = *str++; - *dest = '\0'; + int y = 0; + while (*str) + { + wxChar text[256]; + wxChar* dest = text; - dc.DrawText(text, tabstops[tab], y); + while (*str && *str >= ' ') *dest++ = *str++; + *dest = '\0'; - if (*str == '\t') - { - if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1) - { - tab++; - } - } - else if (*str == '\n') - { - tab = 0; - y += lineSpacing; - } - if (*str) str++; - } + dc.DrawText(text, tabstops[tab], y); + + if (*str == '\t') + { + if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1) + { + tab++; + } + } + else if (*str == '\n') + { + tab = 0; + y += lineSpacing; + } + if (*str) str++; + } } #endif @@ -136,31 +134,30 @@ BEGIN_EVENT_TABLE(ScoreDialog, wxDialog) END_EVENT_TABLE() ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) : - wxDialog(parent, wxID_ANY, _("Scores"), - wxDefaultPosition, wxSize(400, 300), - wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE), - m_scoreFile(file) + wxDialog(parent, wxID_ANY, _("Scores"), + wxDefaultPosition, wxSize(400, 300)), + m_scoreFile(file) { // create grid with players wxArrayString players; - file->GetPlayerList(players); - + file->GetPlayerList(players); + wxSize sz = wxSize(400, 300); #if USE_GRID_FOR_SCORE - wxGrid* list = new wxGrid(this, wxID_ANY, wxDefaultPosition, sz, 0); + wxGrid* list = new wxGrid(this, wxID_ANY, wxDefaultPosition, sz, 0); list->CreateGrid(players.Count(), 4); - for (unsigned int i = 0; i < players.Count(); i++) - { - int wins, games, score; + for (unsigned int i = 0; i < players.Count(); i++) + { + int wins, games, score; wxString string_value; - file->ReadPlayersScore(players[i], wins, games, score); - int average = 0; - if (games > 0) - { - average = (2 * score + games) / (2 * games); - } + file->ReadPlayersScore(players[i], wins, games, score); + int average = 0; + if (games > 0) + { + average = (2 * score + games) / (2 * games); + } list->SetCellValue(i,0,players[i]); string_value.Printf( _T("%u"), wins ); list->SetCellValue(i,1,string_value); @@ -181,7 +178,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) : list->EnableDragColSize(false); list->EnableDragGridSize(false); #else - ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile, wxDefaultPosition, sz); + ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile, wxDefaultPosition, sz); #endif // locate and resize with sizers @@ -193,7 +190,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) : GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); - + CentreOnParent(); } @@ -203,7 +200,7 @@ ScoreDialog::~ScoreDialog() void ScoreDialog::Display() { - Show(true); + Show(true); } void ScoreDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) diff --git a/demos/forty/scorefil.cpp b/demos/forty/scorefil.cpp index 534b11e996..be8c709546 100644 --- a/demos/forty/scorefil.cpp +++ b/demos/forty/scorefil.cpp @@ -6,9 +6,7 @@ // Created: 21/07/97 // RCS-ID: $Id$ // Copyright: (c) 1993-1998 Chris Breeze -// Licence: wxWindows licence -//--------------------------------------------------------------------------- -// Last modified: 14th May 1998 - ported to wxWidgets 2.0 +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -41,65 +39,65 @@ ScoreFile::ScoreFile(const wxString& appName) { #if 0 - wxString filename; - m_configFilename << "/usr/local/share/" << appName << ".scores"; - if (access(m_configFilename, F_OK) == 0) - { - if (access(m_configFilename, R_OK | W_OK) != 0) - { - // file is not r/w - use local file instead - m_configFilename = wxFileConfig::GetLocalFileName(appName); - } - } - else - { - int fd = creat(m_configFilename, 0666); + wxString filename; + m_configFilename << "/usr/local/share/" << appName << ".scores"; + if (access(m_configFilename, F_OK) == 0) + { + if (access(m_configFilename, R_OK | W_OK) != 0) + { + // file is not r/w - use local file instead + m_configFilename = wxFileConfig::GetLocalFileName(appName); + } + } + else + { + int fd = creat(m_configFilename, 0666); - if (fd < 0) - { - // failed to create file - use local file instead - m_configFilename = wxFileConfig::GetLocalFileName(appName); - } - else - { - // ensure created file has rw-rw-rw permissions - close(fd); - } - } + if (fd < 0) + { + // failed to create file - use local file instead + m_configFilename = wxFileConfig::GetLocalFileName(appName); + } + else + { + // ensure created file has rw-rw-rw permissions + close(fd); + } + } #endif - m_config = new wxConfig(appName, _T("wxWidgets"), appName, _T(""), + m_config = new wxConfig(appName, _T("wxWidgets"), appName, wxEmptyString, wxCONFIG_USE_LOCAL_FILE); // only local } ScoreFile::~ScoreFile() { - delete m_config; + delete m_config; #ifdef __WXGTK__ - // ensure score file has rw-rw-rw permissions - // (wxFileConfig sets them to rw-------) - chmod(m_configFilename, 0666); + // ensure score file has rw-rw-rw permissions + // (wxFileConfig sets them to rw-------) + chmod(m_configFilename, 0666); #endif } void ScoreFile::GetPlayerList( wxArrayString &list ) { - m_config->SetPath(_T("/Players")); - int length = m_config->GetNumberOfGroups(); + m_config->SetPath(_T("/Players")); + int length = m_config->GetNumberOfGroups(); - if (length <= 0) return; + if (length <= 0) return; - wxString player; - long index; - if (m_config->GetFirstGroup(player, index)) - { - list.Add( player ); - while (m_config->GetNextGroup(player, index)) - { - list.Add( player ); - } - } + wxString player; + long index; + if (m_config->GetFirstGroup(player, index)) + { + list.Add( player ); + while (m_config->GetNextGroup(player, index)) + { + list.Add( player ); + } + } } @@ -111,73 +109,73 @@ long ScoreFile::CalcCheck(const wxString& name, int p1, int p2, int p3) size_t i, max = name.length(); for(i = 0; i < max; ++i ) - { - check = (check << 1) ^ (long)name[i]; - check = ((check >> 23) ^ check) & 0xFFFFFF; - } - check = (check << 1) ^ (long)p1; - check = ((check >> 23) ^ check) & 0xFFFFFF; - check = (check << 1) ^ (long)p2; - check = ((check >> 23) ^ check) & 0xFFFFFF; - check = (check << 1) ^ (long)p3; - check = ((check >> 23) ^ check) & 0xFFFFFF; + { + check = (check << 1) ^ (long)name[i]; + check = ((check >> 23) ^ check) & 0xFFFFFF; + } + check = (check << 1) ^ (long)p1; + check = ((check >> 23) ^ check) & 0xFFFFFF; + check = (check << 1) ^ (long)p2; + check = ((check >> 23) ^ check) & 0xFFFFFF; + check = (check << 1) ^ (long)p3; + check = ((check >> 23) ^ check) & 0xFFFFFF; return check; } wxString ScoreFile::GetPreviousPlayer() const { - wxString result; - m_config->SetPath(_T("/General")); - m_config->Read(_T("LastPlayer"), &result); - return result; + wxString result; + m_config->SetPath(_T("/General")); + m_config->Read(_T("LastPlayer"), &result); + return result; } void ScoreFile::ReadPlayersScore( - const wxString& player, - int& wins, - int& games, - int& score) + const wxString& player, + int& wins, + int& games, + int& score) { - long check = 0; - long myWins = 0, myGames = 0, myScore = 0; + long check = 0; + long myWins = 0, myGames = 0, myScore = 0; - games = wins = score = 0; + games = wins = score = 0; - m_config->SetPath(_T("/Players")); - m_config->SetPath(player); - if (m_config->Read(_T("Score"), &myScore, 0L) && - m_config->Read(_T("Games"), &myGames, 0L) && - m_config->Read(_T("Wins"), &myWins, 0L) && - m_config->Read(_T("Check"), &check, 0L)) - { - if (check != CalcCheck(player, myGames, myWins, myScore)) - { - wxMessageBox(_T("Score file corrupted"), _T("Warning"), + m_config->SetPath(_T("/Players")); + m_config->SetPath(player); + if (m_config->Read(_T("Score"), &myScore, 0L) && + m_config->Read(_T("Games"), &myGames, 0L) && + m_config->Read(_T("Wins"), &myWins, 0L) && + m_config->Read(_T("Check"), &check, 0L)) + { + if (check != CalcCheck(player, myGames, myWins, myScore)) + { + wxMessageBox(_T("Score file corrupted"), _T("Warning"), wxOK | wxICON_EXCLAMATION); - } - else - { - games = myGames; - wins = myWins; - score = myScore; - } - } - WritePlayersScore(player, wins, games, score); + } + else + { + games = myGames; + wins = myWins; + score = myScore; + } + } + WritePlayersScore(player, wins, games, score); } void ScoreFile::WritePlayersScore(const wxString& player, int wins, int games, int score) { if (player) - { - m_config->SetPath(_T("/General")); - m_config->Write(_T("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++ + { + m_config->SetPath(_T("/General")); + m_config->Write(_T("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++ - m_config->SetPath(_T("/Players")); - m_config->SetPath(player); - m_config->Write(_T("Score"), (long)score); - m_config->Write(_T("Games"), (long)games); - m_config->Write(_T("Wins"), (long)wins); - m_config->Write(_T("Check"), CalcCheck(player, games, wins, score)); - } + m_config->SetPath(_T("/Players")); + m_config->SetPath(player); + m_config->Write(_T("Score"), (long)score); + m_config->Write(_T("Games"), (long)games); + m_config->Write(_T("Wins"), (long)wins); + m_config->Write(_T("Check"), CalcCheck(player, games, wins, score)); + } } diff --git a/demos/life/dialogs.cpp b/demos/life/dialogs.cpp index fa02787fcb..942acc2093 100644 --- a/demos/life/dialogs.cpp +++ b/demos/life/dialogs.cpp @@ -78,14 +78,11 @@ END_EVENT_TABLE() // -------------------------------------------------------------------------- LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent) - : wxDialog(parent, -1, - _("Sample games"), - wxDefaultPosition, - wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL) + : wxDialog(parent, wxID_ANY, _("Sample games"), + wxDefaultPosition, wxDefaultSize) { m_value = 0; - + // create and populate the list of available samples m_list = new wxListBox( this, ID_LISTBOX, wxDefaultPosition, @@ -97,11 +94,11 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent) m_list->Append(g_patterns[i].m_name); // descriptions - wxStaticBox *statbox = new wxStaticBox( this, -1, _("Description")); + wxStaticBox *statbox = new wxStaticBox( this, wxID_ANY, _("Description")); m_life = new Life(); m_life->SetPattern(g_patterns[0]); - m_canvas = new LifeCanvas( this, m_life, FALSE ); - m_text = new wxTextCtrl( this, -1, + m_canvas = new LifeCanvas( this, m_life, false ); + m_text = new wxTextCtrl( this, wxID_ANY, g_patterns[0].m_description, wxDefaultPosition, wxSize(300, 60), @@ -118,14 +115,13 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent) wxBoxSizer *sizer3 = new wxBoxSizer( wxVERTICAL ); sizer3->Add( CreateTextSizer(_("Select one configuration")), 0, wxALL, 10 ); - sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 ); + sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 ); sizer3->Add( sizer2, 1, wxGROW | wxALL, 5 ); - sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 ); + sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 ); sizer3->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, 10 ); // activate SetSizer(sizer3); - SetAutoLayout(TRUE); sizer3->SetSizeHints(this); sizer3->Fit(this); Centre(wxBOTH | wxCENTRE_ON_SCREEN); @@ -164,35 +160,31 @@ void LifeSamplesDialog::OnListBox(wxCommandEvent& event) // -------------------------------------------------------------------------- LifeAboutDialog::LifeAboutDialog(wxWindow *parent) - : wxDialog(parent, -1, - _("About Life!"), - wxDefaultPosition, - wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL) + : wxDialog(parent, wxID_ANY, _("About Life!"), + wxDefaultPosition, wxDefaultSize) { // logo wxBitmap bmp = wxBITMAP(life); #if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__) bmp.SetMask(new wxMask(bmp, *wxBLUE)); #endif - wxStaticBitmap *sbmp = new wxStaticBitmap(this, -1, bmp); + wxStaticBitmap *sbmp = new wxStaticBitmap(this, wxID_ANY, bmp); // layout components wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 ); - sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 ); + sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 ); sizer->Add( CreateTextSizer(_("Life! version 2.2 for wxWidgets\n\n\ (c) 2000 Guillermo Rodriguez Garcia\n\n\ \n\n\ Portions of the code are based in XLife;\n\ XLife is (c) 1989 by Jon Bennett et al.")), 0, wxCENTRE | wxALL, 20 ); - sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 ); + sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 ); sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 ); // activate SetSizer(sizer); - SetAutoLayout(TRUE); sizer->SetSizeHints(this); sizer->Fit(this); Centre(wxBOTH | wxCENTRE_ON_SCREEN); diff --git a/demos/life/life.h b/demos/life/life.h index 7e7777bd15..48e9aca92a 100644 --- a/demos/life/life.h +++ b/demos/life/life.h @@ -44,7 +44,7 @@ class LifeCanvas : public wxWindow { public: // ctor and dtor - LifeCanvas(wxWindow* parent, Life* life, bool interactive = TRUE); + LifeCanvas(wxWindow* parent, Life* life, bool interactive = true); ~LifeCanvas(); // view management diff --git a/samples/tab/tab.cpp b/samples/tab/tab.cpp index 055ebf099d..7b37b5c06e 100644 --- a/samples/tab/tab.cpp +++ b/samples/tab/tab.cpp @@ -39,7 +39,7 @@ bool MyApp::OnInit(void) { // Create the main window #if USE_TABBED_DIALOG - dialog = new MyDialog((wxFrame *) NULL, -1, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE); + dialog = new MyDialog((wxFrame *) NULL, wxID_ANY, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390)); dialog->ShowModal(); diff --git a/samples/taskbar/tbtest.cpp b/samples/taskbar/tbtest.cpp index 131f17b38e..50385b88dd 100644 --- a/samples/taskbar/tbtest.cpp +++ b/samples/taskbar/tbtest.cpp @@ -36,7 +36,7 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit(void) { // Create the main frame window - dialog = new MyDialog(NULL, wxID_ANY, wxT("wxTaskBarIcon Test Dialog"), wxDefaultPosition, wxSize(365, 290), wxDIALOG_MODELESS|wxDEFAULT_DIALOG_STYLE); + dialog = new MyDialog(NULL, wxID_ANY, wxT("wxTaskBarIcon Test Dialog"), wxDefaultPosition, wxSize(365, 290)); dialog->Show(true); diff --git a/samples/validate/validate.cpp b/samples/validate/validate.cpp index 98126e603d..9fba07791b 100644 --- a/samples/validate/validate.cpp +++ b/samples/validate/validate.cpp @@ -171,7 +171,7 @@ void MyFrame::OnToggleBell(wxCommandEvent& event) MyDialog::MyDialog( wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long WXUNUSED(style) ) : - wxDialog(parent, VALIDATE_DIALOG_ID, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxRESIZE_BORDER) + wxDialog(parent, VALIDATE_DIALOG_ID, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { // Sizers automatically ensure a workable layout. wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 38275f47bb..cfa539241f 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -144,8 +144,7 @@ void wxGenericColourDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data) { if ( !wxDialog::Create(parent, -1, wxT("Colour"), - wxPoint(0, 0), wxSize(900, 900), - wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL) ) + wxPoint(0, 0), wxSize(900, 900)) ) return FALSE; dialogParent = parent; diff --git a/src/generic/numdlgg.cpp b/src/generic/numdlgg.cpp index 624a2f4c7b..b5e06f98d6 100644 --- a/src/generic/numdlgg.cpp +++ b/src/generic/numdlgg.cpp @@ -82,8 +82,7 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, long max, const wxPoint& pos) : wxDialog(parent, -1, caption, - pos, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL ) + pos, wxDefaultSize) { m_value = value; m_max = max; diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index e41ee6da36..38938d2c43 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -107,7 +107,6 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, : wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE | - wxDIALOG_MODAL | wxTAB_TRAVERSAL) { if ( data ) @@ -121,7 +120,6 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, : wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE | - wxDIALOG_MODAL | wxTAB_TRAVERSAL) { if ( data ) @@ -133,7 +131,7 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) { // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), - // wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL); + // wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL); wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL ); @@ -405,7 +403,7 @@ wxDC *wxGenericPrintDialog::GetPrintDC() // ---------------------------------------------------------------------------- wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data): -wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL) +wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL) { Init(data); } @@ -598,7 +596,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), - wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL ) + wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL ) { if (data) m_pageData = *data; diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index a812cb4736..b38e80e3a5 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -144,8 +144,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title, if ( maximum > 0 ) { - // note that we can't use wxGA_SMOOTH because it happens to also mean - // wxDIALOG_MODAL and will cause the dialog to be modal. Have an extra + // note that we can't use wxGA_SMOOTH because it happens to + // cause the dialog to be modal. Have an extra // style argument to wxProgressDialog, perhaps. m_gauge = new wxGauge(this, -1, m_maximum, wxDefaultPosition, wxDefaultSize, diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 644f2a8994..9f8a2f6450 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -177,12 +177,6 @@ bool wxDialog::IsModal() const void wxDialog::SetModal( bool WXUNUSED(flag) ) { -/* - if (flag) - m_windowStyle |= wxDIALOG_MODAL; - else - if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; -*/ wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") ); } diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 88b285e8ea..a3fcec04f1 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -133,7 +133,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, m_needParent = FALSE; if (!PreCreation( parent, pos, wxDefaultSize ) || - !CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, wxT("filedialog") )) + !CreateBase( parent, wxID_ANY, pos, wxDefaultSize, style, wxDefaultValidator, wxT("filedialog") )) { wxFAIL_MSG( wxT("wxXX creation failed") ); return; diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 644f2a8994..9f8a2f6450 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -177,12 +177,6 @@ bool wxDialog::IsModal() const void wxDialog::SetModal( bool WXUNUSED(flag) ) { -/* - if (flag) - m_windowStyle |= wxDIALOG_MODAL; - else - if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; -*/ wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") ); } diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 88b285e8ea..a3fcec04f1 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -133,7 +133,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, m_needParent = FALSE; if (!PreCreation( parent, pos, wxDefaultSize ) || - !CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, wxT("filedialog") )) + !CreateBase( parent, wxID_ANY, pos, wxDefaultSize, style, wxDefaultValidator, wxT("filedialog") )) { wxFAIL_MSG( wxT("wxXX creation failed") ); return;