]> git.saurik.com Git - wxWidgets.git/commitdiff
Misc changes, including to wxPropertyForm and sample to make it work
authorJulian Smart <julian@anthemion.co.uk>
Wed, 29 Sep 1999 15:55:50 +0000 (15:55 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 29 Sep 1999 15:55:50 +0000 (15:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

distrib/msw/tmake/b32.t
distrib/msw/tmake/bcc.t
include/wx/propform.h
samples/proplist/test.cpp
samples/proplist/test.h
src/generic/propform.cpp
src/makevc.env
src/msw/makefile.b32
src/msw/makefile.bcc

index f6aa42cb3f50524816d1dab7213e24bb6566e464..3fb5fd74c9a70a3c0b9925b1304743f5d7ab2c18 100644 (file)
@@ -334,7 +334,10 @@ cleanall: clean
 
 
 MFTYPE=b32
-makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+# Can't use this or we'll have to distribute all tmake files with wxWindows
+# makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+
+self:
        cd $(WXWIN)\distrib\msw\tmake
        tmake -t $(MFTYPE) wxwin.pro -o makefile.$(MFTYPE)
        copy makefile.$(MFTYPE) $(WXWIN)\src\msw
index 3a3659ff2022933e6e2821c2809f75188e5dfbdf..615e6e7abec132588132330ab33b60b551b3758d 100644 (file)
@@ -302,7 +302,10 @@ cleanall: clean
 
 
 MFTYPE=bcc
-makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+# Can't use this or we'll have to distribute all tmake files with wxWindows
+#makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+
+self:
        cd $(WXWIN)\distrib\msw\tmake
        tmake -t $(MFTYPE) wxwin.pro -o makefile.$(MFTYPE)
        copy makefile.$(MFTYPE) $(WXWIN)\src\msw
index 4acff593bb97dcd3d1325a84a66d9e64bab91e1c..42ae9e863dad924a3c2f6f38971f6b891e2bb3a7 100644 (file)
@@ -64,9 +64,13 @@ class WXDLLEXPORT wxPropertyFormView: public wxPropertyView
   virtual bool OnClose();
   virtual void OnDoubleClick(wxControl *item);
 
-  // TODO: does OnCommand still get called...???
+  // TODO: does OnCommand still get called...??? No,
+  // make ProcessEvent do it.
   virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
 
+  // Extend event processing to process OnCommand
+  virtual bool ProcessEvent(wxEvent& event);
+
   inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
   inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
 
index 91f753fbae79b6ece2b7040a28ef0adc9cff93e7..3af946119a02c18819fe66a2c92cb1a2c5c35e23 100644 (file)
@@ -205,7 +205,6 @@ void MyApp::PropertyFormTest(bool useDialog)
   if (m_childWindow)
     return;
 
-#if 0
   wxPropertySheet *sheet = new wxPropertySheet;
 
   sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0)));
@@ -217,58 +216,134 @@ void MyApp::PropertyFormTest(bool useDialog)
 
   wxPropertyFormView *view = new wxPropertyFormView(NULL);
 
-  wxDialogBox *propDialog = NULL;
+  wxDialog *propDialog = NULL;
   wxPropertyFormFrame *propFrame = NULL;
   if (useDialog)
   {
-    propDialog = new PropFormDialog(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(380, 250),
-               wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
+    propDialog = new PropFormDialog(view, NULL, "Property Form Test",
+         wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
     m_childWindow = propDialog;
   }
   else
   {
-    propFrame = new PropFormFrame(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(280, 250));
+    propFrame = new PropFormFrame(view, NULL, "Property Form Test", wxPoint(-1,
+         -1), wxSize(380, 250));
     propFrame->Initialize();
     m_childWindow = propFrame;
   }
   
   wxPanel *panel = propDialog ? propDialog : propFrame->GetPropertyPanel();
-  panel->SetLabelPosition(wxVERTICAL);
-  
+  wxLayoutConstraints* c;
+
+#if 0
+  if (!propDialog)
+  {
+    c = new wxLayoutConstraints;
+    c->left.SameAs(m_childWindow, wxLeft, 4);
+    c->right.SameAs(m_childWindow, wxRight, 4);
+    c->top.SameAs(m_childWindow, wxTop, 4);
+    c->bottom.SameAs(m_childWindow, wxBottom, 40);
+
+    panel->SetConstraints(c);
+  }
+#endif
   // Add items to the panel
+  wxButton *okButton = new wxButton(panel, wxID_OK, "OK", wxPoint(-1, -1),
+    wxSize(80, 26), 0, wxDefaultValidator, "ok");
+  wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel",  wxPoint(-1, -1),
+    wxSize(80, 26), 0, wxDefaultValidator, "cancel");
+  wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, "Update",  wxPoint(-1, -1),
+    wxSize(80, 26), 0, wxDefaultValidator, "update");
+  wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, "Revert",  wxPoint(-1, -1),
+    wxSize(80, 26), 0, wxDefaultValidator, "revert");
+
+  c = new wxLayoutConstraints;
+  c->right.SameAs(panel, wxRight, 4);
+  c->bottom.SameAs(panel, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  revertButton->SetConstraints(c);
+  c = new wxLayoutConstraints;
+  c->right.SameAs(revertButton, wxLeft, 4);
+  c->bottom.SameAs(panel, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  updateButton->SetConstraints(c);
+
+  c = new wxLayoutConstraints;
+  c->right.SameAs(updateButton, wxLeft, 4);
+  c->bottom.SameAs(panel, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  cancelButton->SetConstraints(c);
+
+  c = new wxLayoutConstraints;
+  c->right.SameAs(cancelButton, wxLeft, 4);
+  c->bottom.SameAs(panel, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  okButton->SetConstraints(c);
+
+  // The name of this text item matches the "fred" property
+  wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize(
+    200, -1), 0, wxDefaultValidator, "fred");
   
-  (void) new wxButton(panel, -1, "OK", -1, -1, -1, -1, 0, "ok");
-  (void) new wxButton(panel, -1, "Cancel", -1, -1, 80, -1, 0, "cancel");
-  (void) new wxButton(panel, -1, "Update", -1, -1, 80, -1, 0, "update");
-  (void) new wxButton(panel, -1, "Revert", -1, -1, -1, -1, 0, "revert");
-  panel->NewLine();
+  c = new wxLayoutConstraints;
+  c->left.SameAs(panel, wxLeft, 4);
+  c->top.SameAs(panel, wxTop, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  text->SetConstraints(c);
+
+  wxCheckBox *checkBox = new wxCheckBox(panel, -1, "Yes or no", wxPoint(-1, -1),
+    wxSize(-1, -1), 0, wxDefaultValidator, "tough choice");
+
+  c = new wxLayoutConstraints;
+  c->left.SameAs(text, wxRight, 20);
+  c->top.SameAs(panel, wxTop, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  checkBox->SetConstraints(c);
   
-  // The name of this text item matches the "fred" property
-  (void) new wxText(panel, -1, "Fred", "", -1, -1, 90, -1, 0, "fred");
-  (void) new wxCheckBox(panel, -1, "Yes or no", -1, -1, -1, -1, 0, "tough choice");
-  (void) new wxSlider(panel, -1, "Scale", 0, -50, 50, 150, -1, -1, wxHORIZONTAL, "ian");
-  panel->NewLine();
-  (void) new wxListBox(panel, -1, "Constrained", wxSINGLE, -1, -1, 100, 90, 0, NULL, 0, "constrained");
+  wxSlider *slider = new wxSlider(panel, -1, -50, 50, 150, wxPoint(-1, -1),
+    wxSize(200,10), 0, wxDefaultValidator, "ian");
+
+  c = new wxLayoutConstraints;
+  c->left.SameAs(panel, wxLeft, 4);
+  c->top.SameAs(text, wxBottom, 10);
+  c->height.AsIs();
+  c->width.AsIs();
+  slider->SetConstraints(c);
+
+  wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1), wxSize(200, 100),
+    0, NULL, 0, wxDefaultValidator, "constrained");
+
+  c = new wxLayoutConstraints;
+  c->left.SameAs(panel, wxLeft, 4);
+  c->top.SameAs(slider, wxBottom, 10);
+  c->height.AsIs();
+  c->width.AsIs();
+  listBox->SetConstraints(c);
 
   view->AddRegistry(&myFormValidatorRegistry);
 
-  if (useDialog)
-  {
-    view->ShowView(sheet, propDialog);
-    view->AssociateNames();
-    view->TransferToDialog();
+  panel->SetAutoLayout(TRUE);
+
+  view->ShowView(sheet, panel);
+  view->AssociateNames();
+  view->TransferToDialog();
+
+  if (useDialog) {
+    propDialog->Layout();
     propDialog->Centre(wxBOTH);
     propDialog->Show(TRUE);
-  }
-  else
-  {
-    view->ShowView(sheet, propFrame->GetPropertyPanel());
-    view->AssociateNames();
-    view->TransferToDialog();
+  } else {
+    // panel->Layout();
     propFrame->Centre(wxBOTH);
     propFrame->Show(TRUE);
   }
-#endif
 }
 
 BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)
@@ -295,6 +370,7 @@ void PropListDialog::OnCloseWindow(wxCloseEvent& event)
 
 BEGIN_EVENT_TABLE(PropFormFrame, wxPropertyFormFrame)
     EVT_CLOSE(PropFormFrame::OnCloseWindow)
+    EVT_SIZE(PropFormFrame::OnSize)
 END_EVENT_TABLE()
 
 void PropFormFrame::OnCloseWindow(wxCloseEvent& event)
@@ -304,6 +380,12 @@ void PropFormFrame::OnCloseWindow(wxCloseEvent& event)
     wxPropertyFormFrame::OnCloseWindow(event);
 }
 
+void PropFormFrame::OnSize(wxSizeEvent& event)
+{
+    wxPropertyFormFrame::OnSize(event);
+    GetPropertyPanel()->Layout();
+}
+
 BEGIN_EVENT_TABLE(PropFormDialog, wxPropertyFormDialog)
     EVT_CLOSE(PropFormDialog::OnCloseWindow)
 END_EVENT_TABLE()
index 232a6bf60c133250e02eb71516f0e7ca086df577..5c0e34b0bdbfcfc6525f62fc210a0f381d97a68b 100644 (file)
@@ -97,6 +97,7 @@ public:
     }
 
     void OnCloseWindow(wxCloseEvent& event);
+    void OnSize(wxSizeEvent& event);
 
     DECLARE_EVENT_TABLE()
 };
index 686db00abf5578b2384242338a012973a8b8e731..d017b0d4b8583543b369f9408b188cb811a279ab 100644 (file)
@@ -242,6 +242,20 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
   }
 }
 
+// Extend event processing to call OnCommand
+bool wxPropertyFormView::ProcessEvent(wxEvent& event)
+{
+    if (wxEvtHandler::ProcessEvent(event))
+        return TRUE;
+    else if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxUpdateUIEvent)) && event.GetEventObject())
+    {
+        OnCommand(* ((wxWindow*) event.GetEventObject()), (wxCommandEvent&) event);
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
 void wxPropertyFormView::OnDoubleClick(wxControl *item)
 {
   if (!m_propertySheet)
index 454960f2641bbc3e7e9914402a3810a1f2dedbbe..c29e600dcb0232095362735f4a2f9c52506614c6 100644 (file)
@@ -140,7 +140,7 @@ D=$(D)DLL
 WXLIB=$(WXDIR)\lib\$(WXLIBNAME).lib
 
 INC=-I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib -I$(WXDIR)/src/jpeg $(EXTRAINC)
-LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\zlib.lib $(WXDIR)\lib\jpeg.lib $(WXDIR)\lib\xpm.lib
+LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\zlib.lib $(WXDIR)\lib\jpeg.lib $(WXDIR)\lib\xpm.lib
 
 MAKEPRECOMP=/YcWX/WXPREC.H
 OPTIONS=
index 6f198e6b39f1122dfce261460a7d41467347ad01..a15b3b58ef89357bcae8606f15b6a86c62cff8c9 100644 (file)
@@ -1,6 +1,6 @@
 
 
-# This file was automatically generated by tmake at 17:51, 1999/09/20
+# This file was automatically generated by tmake at 16:55, 1999/09/29
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
 
 #
@@ -139,6 +139,7 @@ COMMONOBJS = \
                $(MSWDIR)\hash.obj \
                $(MSWDIR)\helpbase.obj \
                $(MSWDIR)\http.obj \
+               $(MSWDIR)\imagall.obj \
                $(MSWDIR)\imagbmp.obj \
                $(MSWDIR)\image.obj \
                $(MSWDIR)\imaggif.obj \
@@ -580,6 +581,8 @@ $(MSWDIR)\helpbase.obj: $(COMMDIR)\helpbase.$(SRCSUFF)
 
 $(MSWDIR)\http.obj: $(COMMDIR)\http.$(SRCSUFF)
 
+$(MSWDIR)\imagall.obj: $(COMMDIR)\imagall.$(SRCSUFF)
+
 $(MSWDIR)\imagbmp.obj: $(COMMDIR)\imagbmp.$(SRCSUFF)
 
 $(MSWDIR)\image.obj: $(COMMDIR)\image.$(SRCSUFF)
@@ -834,7 +837,10 @@ cleanall: clean
 
 
 MFTYPE=b32
-makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+# Can't use this or we'll have to distribute all tmake files with wxWindows
+# makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+
+self:
        cd $(WXWIN)\distrib\msw\tmake
        tmake -t $(MFTYPE) wxwin.pro -o makefile.$(MFTYPE)
        copy makefile.$(MFTYPE) $(WXWIN)\src\msw
index 8803697729fdb4d7f3412b9bb7d84099a00eb797..5cdf787518e587188fd4d300f564bf99da9e5e01 100644 (file)
@@ -1,6 +1,6 @@
 
 
-# This file was automatically generated by tmake at 17:51, 1999/09/20
+# This file was automatically generated by tmake at 16:55, 1999/09/29
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
 
 #
@@ -128,6 +128,7 @@ COMMONOBJS = \
                $(MSWDIR)\gifdecod.obj \
                $(MSWDIR)\hash.obj \
                $(MSWDIR)\helpbase.obj \
+               $(MSWDIR)\imagall.obj \
                $(MSWDIR)\imagbmp.obj \
                $(MSWDIR)\image.obj \
                $(MSWDIR)\imaggif.obj \
@@ -484,6 +485,8 @@ $(MSWDIR)\hash.obj: $(COMMDIR)\hash.$(SRCSUFF)
 
 $(MSWDIR)\helpbase.obj: $(COMMDIR)\helpbase.$(SRCSUFF)
 
+$(MSWDIR)\imagall.obj: $(COMMDIR)\imagall.$(SRCSUFF)
+
 $(MSWDIR)\imagbmp.obj: $(COMMDIR)\imagbmp.$(SRCSUFF)
 
 $(MSWDIR)\image.obj: $(COMMDIR)\image.$(SRCSUFF)
@@ -729,7 +732,10 @@ cleanall: clean
 
 
 MFTYPE=bcc
-makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+# Can't use this or we'll have to distribute all tmake files with wxWindows
+#makefile.$(MFTYPE) : $(WXWIN)\distrib\msw\tmake\filelist.txt $(WXWIN)\distrib\msw\tmake\$(MFTYPE).t
+
+self:
        cd $(WXWIN)\distrib\msw\tmake
        tmake -t $(MFTYPE) wxwin.pro -o makefile.$(MFTYPE)
        copy makefile.$(MFTYPE) $(WXWIN)\src\msw