]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/samples/deprecated/proplist/proplist.cpp
Regenerate the msvc makefiles after TARGET_CPU option added
[wxWidgets.git] / contrib / samples / deprecated / proplist / proplist.cpp
index bb962d52dbcc4b543f6f0c747905a54e0f69b4f5..29b746899fc0fb6c161a139f5ea7ca94ea92e229 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "proplist_sample.h"
-#endif
-
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
@@ -72,11 +68,11 @@ bool MyApp::OnInit(void)
   m_mainFrame->SetMenuBar(menu_bar);
 
   m_mainFrame->Centre(wxBOTH);
-  m_mainFrame->Show(TRUE);
+  m_mainFrame->Show(true);
 
   SetTopWindow(m_mainFrame);
-    
-  return TRUE;
+
+  return true;
 }
 
 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
@@ -91,48 +87,48 @@ END_EVENT_TABLE()
 
 // Define my frame constructor
 MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type):
-  wxFrame(frame, -1, title, pos, size, type)
+  wxFrame(frame, wxID_ANY, title, pos, size, type)
 {
 }
 
 // Define the behaviour for the frame closing
 // - must delete all frames except for the main one.
-void MyFrame::OnCloseWindow(wxCloseEvent& event)
+void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
 {
     if (wxGetApp().m_childWindow)
     {
-        wxGetApp().m_childWindow->Close(TRUE);
+        wxGetApp().m_childWindow->Close(true);
     }
 
     Destroy();
 }
 
-void MyFrame::OnQuit(wxCommandEvent& event)
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 {
-    Close(TRUE);
+    Close(true);
 }
 
-void MyFrame::OnDialogList(wxCommandEvent& event)
+void MyFrame::OnDialogList(wxCommandEvent& WXUNUSED(event))
 {
-    wxGetApp().PropertyListTest(TRUE);
+    wxGetApp().PropertyListTest(true);
 }
 
-void MyFrame::OnFrameList(wxCommandEvent& event)
+void MyFrame::OnFrameList(wxCommandEvent& WXUNUSED(event))
 {
-    wxGetApp().PropertyListTest(FALSE);
+    wxGetApp().PropertyListTest(false);
 }
 
-void MyFrame::OnDialogForm(wxCommandEvent& event)
+void MyFrame::OnDialogForm(wxCommandEvent& WXUNUSED(event))
 {
-    wxGetApp().PropertyFormTest(TRUE);
+    wxGetApp().PropertyFormTest(true);
 }
 
-void MyFrame::OnFrameForm(wxCommandEvent& event)
+void MyFrame::OnFrameForm(wxCommandEvent& WXUNUSED(event))
 {
-    wxGetApp().PropertyFormTest(FALSE);
+    wxGetApp().PropertyFormTest(false);
 }
 
-void MyFrame::OnAbout(wxCommandEvent& event)
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     (void)wxMessageBox(_T("Property Classes Demo\nAuthor: Julian Smart"), _T("About Property Classes Test"));
 }
@@ -159,7 +155,7 @@ void MyApp::PropertyListTest(bool useDialog)
     wxPropertySheet *sheet = new wxPropertySheet;
 
     sheet->AddProperty(new wxProperty(_T("fred"), 1.0, _T("real")));
-    sheet->AddProperty(new wxProperty(_T("tough choice"), (bool)TRUE, _T("bool")));
+    sheet->AddProperty(new wxProperty(_T("tough choice"), true, _T("bool")));
     sheet->AddProperty(new wxProperty(_T("ian"), (long)45, _T("integer"), new wxIntegerListValidator(-50, 50)));
     sheet->AddProperty(new wxProperty(_T("bill"), 25.0, _T("real"), new wxRealListValidator(0.0, 100.0)));
     sheet->AddProperty(new wxProperty(_T("julian"), _T("one"), _T("string")));
@@ -174,20 +170,21 @@ void MyApp::PropertyListTest(bool useDialog)
         (
             NULL,
             wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS
-            |wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES
+            | wxPROP_DYNAMIC_VALUE_FIELD | wxPROP_PULLDOWN | wxPROP_SHOWVALUES
         );
 
-    wxDialog *propDialog = NULL;
-    wxPropertyListFrame *propFrame = NULL;
+    PropListDialog *propDialog = NULL;
+    PropListFrame *propFrame = NULL;
     if (useDialog)
     {
         propDialog = new PropListDialog(view, NULL, _T("Property Sheet Test"),
-        wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
+            wxDefaultPosition, wxSize(400, 500));
         m_childWindow = propDialog;
     }
     else
     {
-        propFrame = new PropListFrame(view, NULL, _T("Property Sheet Test"), wxPoint(-1, -1), wxSize(400, 500));
+        propFrame = new PropListFrame(view, NULL, _T("Property Sheet Test"),
+            wxDefaultPosition, wxSize(400, 500));
         m_childWindow = propFrame;
     }
 
@@ -196,17 +193,15 @@ void MyApp::PropertyListTest(bool useDialog)
     if (useDialog)
     {
         view->ShowView(sheet, (wxPanel *)propDialog);
-        propDialog->Centre(wxBOTH);
-        propDialog->Show(TRUE);
     }
     else
     {
         propFrame->Initialize();
         view->ShowView(sheet, propFrame->GetPropertyPanel());
-
-        propFrame->Centre(wxBOTH);
-        propFrame->Show(TRUE);
     }
+
+    m_childWindow->Centre(wxBOTH);
+    m_childWindow->Show(true);
 }
 
 void MyApp::PropertyFormTest(bool useDialog)
@@ -217,7 +212,7 @@ void MyApp::PropertyFormTest(bool useDialog)
     wxPropertySheet *sheet = new wxPropertySheet;
 
     sheet->AddProperty(new wxProperty(_T("fred"), 25.0, _T("real"), new wxRealFormValidator(0.0, 100.0)));
-    sheet->AddProperty(new wxProperty(_T("tough choice"), (bool)TRUE, _T("bool")));
+    sheet->AddProperty(new wxProperty(_T("tough choice"), true, _T("bool")));
     sheet->AddProperty(new wxProperty(_T("ian"), (long)45, _T("integer"), new wxIntegerFormValidator(-50, 50)));
     sheet->AddProperty(new wxProperty(_T("julian"), _T("one"), _T("string")));
     wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL);
@@ -231,13 +226,13 @@ void MyApp::PropertyFormTest(bool useDialog)
     if (useDialog)
     {
         propDialog = new PropFormDialog(view, NULL, _T("Property Form Test"),
-        wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
+            wxDefaultPosition, wxSize(380, 250));
         m_childWindow = propDialog;
     }
     else
     {
         propFrame = new PropFormFrame(view, NULL, _T("Property Form Test"),
-            wxPoint(-1, -1), wxSize(380, 250));
+            wxDefaultPosition, wxSize(380, 250));
         propFrame->Initialize();
         m_childWindow = propFrame;
     }
@@ -267,15 +262,15 @@ void MyApp::PropertyFormTest(bool useDialog)
         panel->SetConstraints(c);
     }
 #endif
+
     // Add items to the panel
-    wxButton *okButton = new wxButton(panel, wxID_OK, _T("OK"), wxPoint(-1, -1),
+    wxButton *okButton = new wxButton(panel, wxID_OK, _T("OK"), wxDefaultPosition,
         wxSize(80, 26), 0, wxDefaultValidator, _T("ok"));
-    wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, _T("Cancel"),  wxPoint(-1, -1),
+    wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, _T("Cancel"),  wxDefaultPosition,
         wxSize(80, 26), 0, wxDefaultValidator, _T("cancel"));
-    wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, _T("Update"),  wxPoint(-1, -1),
+    wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, _T("Update"),  wxDefaultPosition,
         wxSize(80, 26), 0, wxDefaultValidator, _T("update"));
-    wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, _T("Revert"),  wxPoint(-1, -1),
+    wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, _T("Revert"),  wxDefaultPosition,
         wxSize(80, 26), 0, wxDefaultValidator, _T("revert"));
 
     c = new wxLayoutConstraints;
@@ -307,8 +302,8 @@ void MyApp::PropertyFormTest(bool useDialog)
     okButton->SetConstraints(c);
 
     // The name of this text item matches the "fred" property
-    wxTextCtrl *text = new wxTextCtrl(panel, -1, _T("Fred"), wxPoint(-1, -1), wxSize(
-    200, -1), 0, wxDefaultValidator, _T("fred"));
+    wxTextCtrl *text = new wxTextCtrl(panel, wxID_ANY, _T("Fred"), wxDefaultPosition,
+        wxSize( 200, wxDefaultCoord), 0, wxDefaultValidator, _T("fred"));
 
     c = new wxLayoutConstraints;
     c->left.SameAs(panel, wxLeft, 4);
@@ -317,8 +312,8 @@ void MyApp::PropertyFormTest(bool useDialog)
     c->width.AsIs();
     text->SetConstraints(c);
 
-    wxCheckBox *checkBox = new wxCheckBox(panel, -1, _T("Yes or no"), wxPoint(-1, -1),
-        wxSize(-1, -1), 0, wxDefaultValidator, _T("tough choice"));
+    wxCheckBox *checkBox = new wxCheckBox(panel, wxID_ANY, _T("Yes or no"), wxDefaultPosition,
+        wxDefaultSize, 0, wxDefaultValidator, _T("tough choice"));
 
     c = new wxLayoutConstraints;
     c->left.SameAs(text, wxRight, 20);
@@ -327,7 +322,7 @@ void MyApp::PropertyFormTest(bool useDialog)
     c->width.AsIs();
     checkBox->SetConstraints(c);
 
-  wxSlider *slider = new wxSlider(panel, -1, -50, 50, 150, wxPoint(-1, -1),
+    wxSlider *slider = new wxSlider(panel, wxID_ANY, -50, 50, 150, wxDefaultPosition,
     wxSize(200,10), 0, wxDefaultValidator, _T("ian"));
 
     c = new wxLayoutConstraints;
@@ -337,7 +332,7 @@ void MyApp::PropertyFormTest(bool useDialog)
     c->width.AsIs();
     slider->SetConstraints(c);
 
-    wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1),
+    wxListBox *listBox = new wxListBox(panel, wxID_ANY, wxDefaultPosition,
         wxSize(200, 100), 0, NULL, 0, wxDefaultValidator, _T("constrained"));
 
     c = new wxLayoutConstraints;
@@ -349,7 +344,7 @@ void MyApp::PropertyFormTest(bool useDialog)
 
     view->AddRegistry(&myFormValidatorRegistry);
 
-    panel->SetAutoLayout(TRUE);
+    panel->SetAutoLayout(true);
 
     view->ShowView(sheet, panel);
     view->AssociateNames();
@@ -357,15 +352,13 @@ void MyApp::PropertyFormTest(bool useDialog)
 
     if (useDialog) {
         propDialog->Layout();
-        propDialog->Centre(wxBOTH);
-        propDialog->Show(TRUE);
     }
     else
     {
         // panel->Layout();
-        propFrame->Centre(wxBOTH);
-        propFrame->Show(TRUE);
     }
+    m_childWindow->Centre(wxBOTH);
+    m_childWindow->Show(true);
 }
 
 BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)