X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c331ded69073da6d9b2cec4a12eb09e63347892..4538b3f1b0a3f36d5fe91559afa86c1a1063f751:/utils/dialoged/src/winprop.h?ds=inline diff --git a/utils/dialoged/src/winprop.h b/utils/dialoged/src/winprop.h index 8b4032a8a0..c94458aa79 100644 --- a/utils/dialoged/src/winprop.h +++ b/utils/dialoged/src/winprop.h @@ -28,7 +28,9 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); ~wxDialogEditorPropertyListFrame(); - + + wxPropertyInfo* GetInfo() const { return m_propInfo; } + private: wxPropertySheet* m_propSheet; wxPropertyValidatorRegistry m_registry; @@ -39,16 +41,17 @@ private: // feedback. class wxResourcePropertyListView: public wxPropertyListView { - public: - wxPropertyInfo *propertyInfo; - - wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): - wxPropertyListView(propPanel, flags) - { - propertyInfo = info; - } - void OnPropertyChanged(wxProperty *property); - bool OnClose(void); +public: + wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): + wxPropertyListView(propPanel, flags) + { + m_propertyInfo = info; + } + void OnPropertyChanged(wxProperty *property); + bool OnClose(void); + + wxPropertyInfo* m_propertyInfo; + }; // Generic class for relating an object to a collection of properties. @@ -58,286 +61,294 @@ class wxResourcePropertyListView: public wxPropertyListView class wxPropertyInfo: public wxObject { friend class wxDialogEditorPropertyListFrame; - protected: - static wxWindow *sm_propertyWindow; - wxPropertyInfo(void) - { - } - ~wxPropertyInfo(void) - { - } - public: - virtual wxProperty *GetProperty(wxString& propName) = 0; - virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; - virtual void GetPropertyNames(wxStringList& names) = 0; - virtual bool Edit(wxWindow *parent, const wxString& title); +protected: + static wxWindow *sm_propertyWindow; + wxPropertyInfo(void) + { + } + ~wxPropertyInfo(void) + { + } +public: + virtual wxProperty *GetProperty(wxString& propName) = 0; + virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; + virtual void GetPropertyNames(wxStringList& names) = 0; + virtual bool Edit(wxWindow *parent, const wxString& title); + static void CloseWindow(); // Close the current window if open. }; // For all windows class wxWindowPropertyInfo: public wxPropertyInfo { - protected: - wxWindow *propertyWindow; - wxItemResource *propertyResource; - public: - wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); - ~wxWindowPropertyInfo(void); - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - - inline void SetPropertyWindow(wxWindow *win) { propertyWindow = win; } - - inline void SetResource(wxItemResource *res) { propertyResource = res; } - - // Helper functions for font properties - - wxProperty *GetFontProperty(wxString& name, wxFont *font); - wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont); - - // Fill in the wxItemResource members to mirror the current window settings - virtual bool InstantiateResource(wxItemResource *resource); - - // Set the window style - void SetWindowStyle(wxWindow* win, long style, bool set); +public: + wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); + ~wxWindowPropertyInfo(void); + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + + inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; } + + inline void SetResource(wxItemResource *res) { m_propertyResource = res; } + + // Helper functions for font properties + + wxProperty *GetFontProperty(wxString& name, wxFont *font); + wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont); + + // Fill in the wxItemResource members to mirror the current window settings + virtual bool InstantiateResource(wxItemResource *resource); + + // Set the window style + void SetWindowStyle(wxWindow* win, long style, bool set); + + wxWindow* GetWindow() const { return m_propertyWindow; } + wxItemResource* GetResource() const { return m_propertyResource; } + +protected: + wxWindow* m_propertyWindow; + wxItemResource* m_propertyResource; }; // For panel items class wxItemPropertyInfo: public wxWindowPropertyInfo { - protected: - public: - wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxWindowPropertyInfo(win, res) {} - ~wxItemPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxWindowPropertyInfo(win, res) {} + ~wxItemPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For buttons class wxButtonPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) { } - ~wxButtonPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) { } + ~wxButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For bitmap buttons class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo { - protected: - public: - wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxButtonPropertyInfo(win, res) { } - ~wxBitmapButtonPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxButtonPropertyInfo(win, res) { } + ~wxBitmapButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For static text controls class wxStaticTextPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) { } - ~wxStaticTextPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) { } + ~wxStaticTextPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For static bitmap controls class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) { } - ~wxStaticBitmapPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) { } + ~wxStaticBitmapPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For text/multitext items class wxTextPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxTextPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxTextPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For list boxes class wxListBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxListBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxListBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For choice items class wxChoicePropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxChoicePropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxChoicePropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For choice items class wxComboBoxPropertyInfo: public wxChoicePropertyInfo { - protected: - public: - wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxChoicePropertyInfo(win, res) {} - ~wxComboBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxChoicePropertyInfo(win, res) {} + ~wxComboBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For radiobox items class wxRadioBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxRadioBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxRadioBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For groupbox items class wxGroupBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxGroupBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxGroupBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For checkbox items class wxCheckBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxCheckBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxCheckBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For radiobutton items class wxRadioButtonPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxRadioButtonPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxRadioButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For gauge items class wxGaugePropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxGaugePropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxGaugePropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For scrollbar items class wxScrollBarPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxScrollBarPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxScrollBarPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For slider items class wxSliderPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxSliderPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxSliderPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For panels class wxPanelPropertyInfo: public wxWindowPropertyInfo { - protected: - public: - wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxWindowPropertyInfo(win, res) {} - ~wxPanelPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxWindowPropertyInfo(win, res) {} + ~wxPanelPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); + + // Convert this dialog, and its children, to or from dialog units + void ConvertDialogUnits(bool toDialogUnits); }; int wxStringToFontWeight(wxString& val); @@ -345,39 +356,39 @@ int wxStringToFontStyle(wxString& val); int wxStringToFontFamily(wxString& val); /* - * A validator to allow editing symbol/id pairs - */ +* A validator to allow editing symbol/id pairs +*/ class wxResourceSymbolValidator: public wxPropertyListValidator { - DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator) - protected: - public: - wxResourceSymbolValidator(long flags = 0); - - ~wxResourceSymbolValidator(void); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transferance from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the edit (...) button is pressed. - void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator) +protected: +public: + wxResourceSymbolValidator(long flags = 0); + + ~wxResourceSymbolValidator(void); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transferance from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the edit (...) button is pressed. + void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); }; /* - * A dialog for editing symbol/id pairs - */ +* A dialog for editing symbol/id pairs +*/ class wxResourceSymbolDialog: public wxDialog { @@ -385,31 +396,31 @@ public: wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); - + void Init(); - + inline void SetSymbol(const wxString& symbol) { m_symbolName = symbol; } inline void SetId(long id) { m_symbolId = id; } - + inline wxString GetSymbol() const { return m_symbolName; } inline long GetId() const { return m_symbolId; } - + bool CheckValues(); void OnOK(wxCommandEvent& event); void OnComboBoxSelect(wxCommandEvent& event); void OnSymbolNameUpdate(wxCommandEvent& event); - + protected: wxString m_symbolName; long m_symbolId; wxComboBox* m_nameCtrl; wxTextCtrl* m_idCtrl; - -DECLARE_EVENT_TABLE() + + DECLARE_EVENT_TABLE() }; #define ID_SYMBOLNAME_COMBOBOX 100 #define ID_SYMBOLID_TEXTCTRL 101 #endif - // _WINPROP_H_ +// _WINPROP_H_