X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4040a396cb22fdaa2db0f79bd782218cd814a540..1ccabb813a537c2541f88eb39a83f964d2d42f00:/include/wx/propform.h diff --git a/include/wx/propform.h b/include/wx/propform.h index ede043929e..426bd05a52 100644 --- a/include/wx/propform.h +++ b/include/wx/propform.h @@ -16,6 +16,8 @@ #pragma interface "propform.h" #endif +#if wxUSE_PROPSHEET + #include "wx/prop.h" //// @@ -61,12 +63,16 @@ class WXDLLEXPORT wxPropertyFormView: public wxPropertyView void OnUpdate(wxCommandEvent& event); void OnRevert(wxCommandEvent& event); - virtual bool OnClose(void); + 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; } @@ -85,7 +91,7 @@ public: wxWindow* m_propertyWindow; // Panel that the controls will appear on wxWindow* m_managedWindow; // Frame or dialog - + wxButton* m_windowCloseButton; // Or OK wxButton* m_windowCancelButton; wxButton* m_windowHelpButton; @@ -93,7 +99,7 @@ public: DECLARE_EVENT_TABLE() }; - + /* * The type of validator used for forms (wxForm style but using an existing panel * or dialog box). @@ -116,10 +122,10 @@ class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator public: wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { } ~wxPropertyFormValidator(void) {} - + // Called to check value is OK (e.g. when OK is pressed) // Return FALSE if value didn't check out; signal to restore old value. - virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { return TRUE; } // Does the transferance from the property editing area to the property itself. @@ -129,20 +135,27 @@ class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator // Called by the view to transfer the property to the window. virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0; - virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) { } - virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { } - virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { } - virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + wxWindow *WXUNUSED(parentWindow) ) { } + virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow), wxCommandEvent& WXUNUSED(event) ) {} +private: +// Virtual function hiding suppression +#if WXWIN_COMPATIBILITY_2 + virtual void OnCommand(wxWindow& win, + wxCommandEvent& event) + { wxEvtHandler::OnCommand(win, event); } +#endif }; /* * Some default validators */ - + class WXDLLEXPORT wxRealFormValidator: public wxPropertyFormValidator { DECLARE_DYNAMIC_CLASS(wxRealFormValidator) @@ -222,76 +235,99 @@ class WXDLLEXPORT wxStringFormValidator: public wxPropertyFormValidator /* * A default dialog box class to use. */ - + class WXDLLEXPORT wxPropertyFormDialog: public wxDialog { - DECLARE_CLASS(wxPropertyFormDialog) - public: - wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); - bool OnClose(void); - void OnDefaultAction(wxControl *item); - void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - private: - wxPropertyFormView* m_view; +public: + wxPropertyFormDialog(wxPropertyFormView *v = NULL, + wxWindow *parent = NULL, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = _T("dialogBox")); + + void OnCloseWindow(wxCloseEvent& event); + void OnDefaultAction(wxControl *item); + void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + +private: + wxPropertyFormView* m_view; + + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxPropertyFormDialog) }; /* * A default panel class to use. */ - + class WXDLLEXPORT wxPropertyFormPanel: public wxPanel { - DECLARE_CLASS(wxPropertyFormPanel) - public: - wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"): - wxPanel(parent, -1, pos, size, style, name) - { - m_view = v; - } - void OnDefaultAction(wxControl *item); - void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - private: - wxPropertyFormView* m_view; +public: + wxPropertyFormPanel(wxPropertyFormView *v = NULL, + wxWindow *parent = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = _T("panel")) + : wxPanel(parent, -1, pos, size, style, name) + { + m_view = v; + } + void OnDefaultAction(wxControl *item); + void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + void SetView(wxPropertyFormView* view) { m_view = view; } + wxPropertyFormView* GetView() const { return m_view; } + +private: + wxPropertyFormView* m_view; + + DECLARE_CLASS(wxPropertyFormPanel) }; /* * A default frame class to use. */ - + class WXDLLEXPORT wxPropertyFormFrame: public wxFrame { - DECLARE_CLASS(wxPropertyFormFrame) - public: - wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"): - wxFrame(parent, -1, title, pos, size, style, name) - { - m_view = v; - m_propertyPanel = NULL; - } - bool OnClose(void); - - // Must call this to create panel and associate view - virtual bool Initialize(void); - virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); - inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; } - - private: - wxPropertyFormView* m_view; - wxPanel* m_propertyPanel; +public: + wxPropertyFormFrame(wxPropertyFormView *v = NULL, + wxFrame *parent = NULL, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = _T("frame")) + : wxFrame(parent, -1, title, pos, size, style, name) + { + m_view = v; + m_propertyPanel = NULL; + } + void OnCloseWindow(wxCloseEvent& event); + + // Must call this to create panel and associate view + virtual bool Initialize(void); + virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); + inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; } + +private: + wxPropertyFormView* m_view; + wxPanel* m_propertyPanel; + + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxPropertyFormFrame) }; +#endif + // wxUSE_PROPSHEET + #endif // _WX_PROPFORM_H_