X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4040a396cb22fdaa2db0f79bd782218cd814a540..e9d804ebea801ce6268b962999410c2b21fad617:/include/wx/prop.h diff --git a/include/wx/prop.h b/include/wx/prop.h index bb9ebc64bb..efc9573399 100644 --- a/include/wx/prop.h +++ b/include/wx/prop.h @@ -12,10 +12,12 @@ #ifndef _WX_PROP_H_ #define _WX_PROP_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "prop.h" #endif +#if wxUSE_PROPSHEET + #include "wx/defs.h" #include "wx/string.h" #include "wx/hash.h" @@ -26,6 +28,7 @@ #include "wx/textctrl.h" #include "wx/gdicmn.h" #include "wx/layout.h" +#include "wx/sizer.h" class wxWindow; class wxProperty; @@ -40,34 +43,47 @@ class wxPropertyValidatorRegistry; // A storable sheet of values class WXDLLEXPORT wxPropertySheet: public wxObject { - DECLARE_DYNAMIC_CLASS(wxPropertySheet) - public: - wxPropertySheet(void); - ~wxPropertySheet(void); +public: + wxPropertySheet(const wxString& name = wxT("")); + ~wxPropertySheet(); - // Add a property - virtual void AddProperty(wxProperty *property); + // Set the name of the sheet + inline virtual void SetName(const wxString& name) { m_name=name; } + inline virtual wxString GetName() const { return m_name; } + + // Does this sheet contain a property with this name + virtual bool HasProperty(const wxString& name) const; - // Get property by name - virtual wxProperty *GetProperty(wxString name); + // Set property name to value + virtual bool SetProperty(const wxString& name, const wxPropertyValue& value); - // Clear all properties - virtual void Clear(void); + // Remove property from sheet by name, deleting it + virtual void RemoveProperty(const wxString& name); - virtual bool Save(ostream& str); - virtual bool Load(ostream& str); + // Get the name of the sheet + // Add a property + virtual void AddProperty(wxProperty *property); - virtual void UpdateAllViews(wxPropertyView *thisView = NULL); - inline virtual wxList& GetProperties(void) const { return (wxList&) m_properties; } - - // Sets/clears the modified flag for each property value - virtual void SetAllModified(bool flag = TRUE); + // Get property by name + virtual wxProperty *GetProperty(const wxString& name) const; - protected: - wxObject* m_viewedObject; - wxList m_properties; - wxPropertyView* m_propertyView; + // Clear all properties + virtual void Clear(); + virtual void UpdateAllViews(wxPropertyView *thisView = NULL); + inline virtual wxList& GetProperties() const { return (wxList&) m_properties; } + + // Sets/clears the modified flag for each property value + virtual void SetAllModified(bool flag = TRUE); + +protected: + wxObject* m_viewedObject; + wxList m_properties; + wxPropertyView* m_propertyView; + wxString m_name; + +private: + DECLARE_DYNAMIC_CLASS(wxPropertySheet) }; @@ -75,69 +91,69 @@ class WXDLLEXPORT wxPropertySheet: public wxObject // classes: wxPropertyListView, and wxPropertyFormView. class WXDLLEXPORT wxPropertyView: public wxEvtHandler { - DECLARE_DYNAMIC_CLASS(wxPropertyView) - public: - wxPropertyView(long flags = 0); - ~wxPropertyView(void); - - // Associates and shows the view - virtual void ShowView(wxPropertySheet *WXUNUSED(propertySheet), wxWindow *WXUNUSED(panel)) {} - - // Update this view of the viewed object, called e.g. by - // the object itself. - virtual bool OnUpdateView(void) {return FALSE;}; - - // Override this to do something as soon as the property changed, - // if the view and validators support it. - virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {} - - virtual void AddRegistry(wxPropertyValidatorRegistry *registry); - inline virtual wxList& GetRegistryList(void) const - { return (wxList&) m_validatorRegistryList; } - - virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property); - inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; } - inline virtual wxPropertySheet *GetPropertySheet(void) const { return m_propertySheet; } - - virtual void OnOk(void) {}; - virtual void OnCancel(void) {}; - virtual void OnHelp(void) {}; - - inline virtual bool OnClose(void) { return FALSE; } - inline long GetFlags(void) { return m_buttonFlags; } - - protected: - long m_buttonFlags; - wxPropertySheet* m_propertySheet; - wxProperty* m_currentProperty; - wxList m_validatorRegistryList; - wxPropertyValidator* m_currentValidator; +public: + wxPropertyView(long flags = 0); + ~wxPropertyView(); + + // Associates and shows the view + virtual void ShowView(wxPropertySheet *WXUNUSED(propertySheet), wxWindow *WXUNUSED(panel)) {} + + // Update this view of the viewed object, called e.g. by + // the object itself. + virtual bool OnUpdateView() {return FALSE;}; + + // Override this to do something as soon as the property changed, + // if the view and validators support it. + virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {} + + virtual void AddRegistry(wxPropertyValidatorRegistry *registry); + inline virtual wxList& GetRegistryList() const + { return (wxList&) m_validatorRegistryList; } + + virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property); + inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; } + inline virtual wxPropertySheet *GetPropertySheet() const { return m_propertySheet; } + + inline virtual bool OnClose() { return FALSE; } + inline long GetFlags(void) { return m_buttonFlags; } + +protected: + long m_buttonFlags; + wxPropertySheet* m_propertySheet; + wxProperty* m_currentProperty; + wxList m_validatorRegistryList; + wxPropertyValidator* m_currentValidator; + +private: + DECLARE_DYNAMIC_CLASS(wxPropertyView) }; class WXDLLEXPORT wxPropertyValidator: public wxEvtHandler { - DECLARE_DYNAMIC_CLASS(wxPropertyValidator) - public: - wxPropertyValidator(long flags = 0); - ~wxPropertyValidator(void); - - inline long GetFlags(void) const { return m_validatorFlags; } - inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; } - inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; } - - virtual bool StringToFloat (char *s, float *number); - virtual bool StringToDouble (char *s, double *number); - virtual bool StringToInt (char *s, int *number); - virtual bool StringToLong (char *s, long *number); - virtual char *FloatToString (float number); - virtual char *DoubleToString (double number); - virtual char *IntToString (int number); - virtual char *LongToString (long number); - - protected: - long m_validatorFlags; - wxProperty* m_validatorProperty; +public: + wxPropertyValidator(long flags = 0); + ~wxPropertyValidator(); + + inline long GetFlags() const { return m_validatorFlags; } + inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; } + inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; } + + virtual bool StringToFloat (wxChar *s, float *number); + virtual bool StringToDouble (wxChar *s, double *number); + virtual bool StringToInt (wxChar *s, int *number); + virtual bool StringToLong (wxChar *s, long *number); + virtual wxChar *FloatToString (float number); + virtual wxChar *DoubleToString (double number); + virtual wxChar *IntToString (int number); + virtual wxChar *LongToString (long number); + +protected: + long m_validatorFlags; + wxProperty* m_validatorProperty; + +private: + DECLARE_DYNAMIC_CLASS(wxPropertyValidator) }; @@ -145,14 +161,16 @@ class WXDLLEXPORT wxPropertyValidator: public wxEvtHandler class WXDLLEXPORT wxPropertyValidatorRegistry: public wxHashTable { - DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry) - public: - wxPropertyValidatorRegistry(void); - ~wxPropertyValidatorRegistry(void); +public: + wxPropertyValidatorRegistry(); + ~wxPropertyValidatorRegistry(); - virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator); - virtual wxPropertyValidator *GetValidator(const wxString& roleName); - void ClearRegistry(void); + virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator); + virtual wxPropertyValidator *GetValidator(const wxString& roleName); + void ClearRegistry(); + +private: + DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry) }; /* @@ -178,7 +196,7 @@ class WXDLLEXPORT wxPropertyValue: public wxObject wxPropertyValue(void); // Unknown type wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor - wxPropertyValue(const char *val); + wxPropertyValue(const wxChar *val); wxPropertyValue(const wxString& val); wxPropertyValue(long val); wxPropertyValue(bool val); @@ -187,7 +205,7 @@ class WXDLLEXPORT wxPropertyValue: public wxObject wxPropertyValue(wxList *val); wxPropertyValue(wxStringList *val); // Pointer versions - wxPropertyValue(char **val); + wxPropertyValue(wxChar **val); wxPropertyValue(long *val); wxPropertyValue(bool *val); wxPropertyValue(float *val); @@ -199,11 +217,11 @@ class WXDLLEXPORT wxPropertyValue: public wxObject virtual long IntegerValue(void) const; virtual float RealValue(void) const; virtual bool BoolValue(void) const; - virtual char *StringValue(void) const; + virtual wxChar *StringValue(void) const; virtual long *IntegerValuePtr(void) const; virtual float *RealValuePtr(void) const; virtual bool *BoolValuePtr(void) const; - virtual char **StringValuePtr(void) const; + virtual wxChar **StringValuePtr(void) const; // Get nth arg of clause (starting from 1) virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const; @@ -216,8 +234,8 @@ class WXDLLEXPORT wxPropertyValue: public wxObject virtual wxPropertyValue *NewCopy(void) const; virtual void Copy(wxPropertyValue& copyFrom); - virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause - virtual void WritePropertyType(ostream& stream); // Write as any other subexpression + virtual void WritePropertyClause(wxString &stream); // Write this expression as a top-level clause + virtual void WritePropertyType(wxString &stream); // Write as any other subexpression // Append an expression to a list virtual void Append(wxPropertyValue *expr); @@ -257,7 +275,7 @@ class WXDLLEXPORT wxPropertyValue: public wxObject void operator=(const long val); void operator=(const bool val); void operator=(const float val); - void operator=(const char **val); + void operator=(const wxChar **val); void operator=(const long *val); void operator=(const bool *val); void operator=(const float *val); @@ -269,11 +287,11 @@ class WXDLLEXPORT wxPropertyValue: public wxObject union { long integer; // Also doubles as bool - char *string; + wxChar *string; float real; long *integerPtr; bool *boolPtr; - char **stringPtr; + wxChar **stringPtr; float *realPtr; wxPropertyValue *first; // If is a list expr, points to the first node } m_value; @@ -321,5 +339,8 @@ class WXDLLEXPORT wxProperty: public wxObject inline bool IsEnabled(void) const { return m_enabled; } }; +#endif + // wxUSE_PROPSHEET + #endif // _WX_PROP_H_