Misc changes, including to wxPropertyForm and sample to make it work

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-09-29 15:55:50 +00:00
parent 51c0a521a9
commit 1b9315eb77
9 changed files with 158 additions and 39 deletions

View 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

View 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

View 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; }

View 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");
(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->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
(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");
wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize(
200, -1), 0, wxDefaultValidator, "fred");
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);
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()

View File

@@ -97,6 +97,7 @@ public:
}
void OnCloseWindow(wxCloseEvent& event);
void OnSize(wxSizeEvent& event);
DECLARE_EVENT_TABLE()
};

View 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)

View 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=

View 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

View 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