X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/457814b5aa2ee5c83abc65a6aee2a3ebcb1af34f..630d84f26f30e2cac046baa864f93596e51368b2:/utils/wxprop/src/prop.h diff --git a/utils/wxprop/src/prop.h b/utils/wxprop/src/prop.h index e62e022ebb..616268f4c9 100644 --- a/utils/wxprop/src/prop.h +++ b/utils/wxprop/src/prop.h @@ -41,11 +41,6 @@ class wxPropertyValidatorRegistry; class wxPropertySheet: public wxObject { DECLARE_DYNAMIC_CLASS(wxPropertySheet) - protected: - wxObject *viewedObject; - wxList properties; - wxPropertyView *propertyView; - public: wxPropertySheet(void); ~wxPropertySheet(void); @@ -63,10 +58,16 @@ class wxPropertySheet: public wxObject virtual bool Load(ostream& str); virtual void UpdateAllViews(wxPropertyView *thisView = NULL); - inline virtual wxList& GetProperties(void) { return properties; } + 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); + + protected: + wxObject* m_viewedObject; + wxList m_properties; + wxPropertyView* m_propertyView; + }; @@ -75,18 +76,12 @@ class wxPropertySheet: public wxObject class wxPropertyView: public wxEvtHandler { DECLARE_DYNAMIC_CLASS(wxPropertyView) - protected: - long buttonFlags; - wxPropertySheet *propertySheet; - wxProperty *currentProperty; - wxList validatorRegistryList; - wxPropertyValidator *currentValidator; public: wxPropertyView(long flags = 0); ~wxPropertyView(void); // Associates and shows the view - virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel) {}; + virtual void ShowView(wxPropertySheet *WXUNUSED(propertySheet), wxWindow *WXUNUSED(panel)) {} // Update this view of the viewed object, called e.g. by // the object itself. @@ -97,35 +92,39 @@ class wxPropertyView: public wxEvtHandler virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {} virtual void AddRegistry(wxPropertyValidatorRegistry *registry); - inline virtual wxList& GetRegistryList(void) - { return validatorRegistryList; } + inline virtual wxList& GetRegistryList(void) const + { return (wxList&) m_validatorRegistryList; } virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property); - inline virtual void SetPropertySheet(wxPropertySheet *sheet) { propertySheet = sheet; } - inline virtual wxPropertySheet *GetPropertySheet(void) { return propertySheet; } + 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 buttonFlags; } + inline long GetFlags(void) { return m_buttonFlags; } + + protected: + long m_buttonFlags; + wxPropertySheet* m_propertySheet; + wxProperty* m_currentProperty; + wxList m_validatorRegistryList; + wxPropertyValidator* m_currentValidator; }; class wxPropertyValidator: public wxEvtHandler { DECLARE_DYNAMIC_CLASS(wxPropertyValidator) - protected: - long validatorFlags; - wxProperty *validatorProperty; public: wxPropertyValidator(long flags = 0); ~wxPropertyValidator(void); - inline long GetFlags(void) { return validatorFlags; } - inline void SetValidatorProperty(wxProperty *prop) { validatorProperty = prop; } - inline wxProperty *GetValidatorProperty(void) { return validatorProperty; } + 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); @@ -135,6 +134,10 @@ class wxPropertyValidator: public wxEvtHandler virtual char *DoubleToString (double number); virtual char *IntToString (int number); virtual char *LongToString (long number); + + protected: + long m_validatorFlags; + wxProperty* m_validatorProperty; }; @@ -172,24 +175,6 @@ typedef enum { class wxPropertyValue: public wxObject { DECLARE_DYNAMIC_CLASS(wxPropertyValue) - public: - wxObject *client_data; - wxPropertyValueType type; - bool modifiedFlag; - - union { - long integer; // Also doubles as bool - char *string; - float real; - long *integerPtr; - bool *boolPtr; - char **stringPtr; - float *realPtr; - wxPropertyValue *first; // If is a list expr, points to the first node - } value; - - wxPropertyValue *next; // If this is a node in a list, points to the next node - wxPropertyValue *last; // If is a list expr, points to the last node wxPropertyValue(void); // Unknown type wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor @@ -209,26 +194,26 @@ class wxPropertyValue: public wxObject ~wxPropertyValue(void); - virtual inline wxPropertyValueType Type(void) { return type; } - virtual inline void SetType(wxPropertyValueType typ) { type = typ; } - virtual long IntegerValue(void); - virtual float RealValue(void); - virtual bool BoolValue(void); - virtual char *StringValue(void); - virtual long *IntegerValuePtr(void); - virtual float *RealValuePtr(void); - virtual bool *BoolValuePtr(void); - virtual char **StringValuePtr(void); + virtual inline wxPropertyValueType Type(void) const { return m_type; } + virtual inline void SetType(wxPropertyValueType typ) { m_type = typ; } + virtual long IntegerValue(void) const; + virtual float RealValue(void) const; + virtual bool BoolValue(void) const; + virtual char *StringValue(void) const; + virtual long *IntegerValuePtr(void) const; + virtual float *RealValuePtr(void) const; + virtual bool *BoolValuePtr(void) const; + virtual char **StringValuePtr(void) const; // Get nth arg of clause (starting from 1) - virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg); + virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const; // Return nth argument of a list expression (starting from zero) - virtual wxPropertyValue *Nth(int arg); + virtual wxPropertyValue *Nth(int arg) const; // Returns the number of elements in a list expression - virtual int Number(void); + virtual int Number(void) const; - virtual wxPropertyValue *NewCopy(void); + virtual wxPropertyValue *NewCopy(void) const; virtual void Copy(wxPropertyValue& copyFrom); virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause @@ -240,13 +225,16 @@ class wxPropertyValue: public wxObject virtual void Insert(wxPropertyValue *expr); // Get first expr in list - virtual inline wxPropertyValue *GetFirst(void) { return ((type == wxPropertyValueList) ? value.first : NULL); } + virtual inline wxPropertyValue *GetFirst(void) const + { return ((m_type == wxPropertyValueList) ? m_value.first : (wxPropertyValue*)NULL); } // Get next expr if this is a node in a list - virtual inline wxPropertyValue *GetNext(void) { return next; } + virtual inline wxPropertyValue *GetNext(void) const + { return m_next; } // Get last expr in list - virtual inline wxPropertyValue *GetLast(void) { return ((type == wxPropertyValueList) ? last : NULL); } + virtual inline wxPropertyValue *GetLast(void) const + { return ((m_type == wxPropertyValueList) ? m_last : (wxPropertyValue*)NULL); } // Delete this node from the list virtual void Delete(wxPropertyValue *node); @@ -254,13 +242,13 @@ class wxPropertyValue: public wxObject // Clear list virtual void ClearList(void); - virtual inline void SetClientData(wxObject *data) { client_data = data; } - virtual inline wxObject *GetClientData(void) { return client_data; } + virtual inline void SetClientData(wxObject *data) { m_clientData = data; } + virtual inline wxObject *GetClientData(void) { return m_clientData; } virtual wxString GetStringRepresentation(void); - inline void SetModified(bool flag = TRUE) { modifiedFlag = flag; } - inline bool GetModified(void) { return modifiedFlag; } + inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; } + inline bool GetModified(void) { return m_modifiedFlag; } // Operators void operator=(const wxPropertyValue& val); @@ -273,6 +261,26 @@ class wxPropertyValue: public wxObject void operator=(const long *val); void operator=(const bool *val); void operator=(const float *val); + + public: + wxObject* m_clientData; + wxPropertyValueType m_type; + bool m_modifiedFlag; + + union { + long integer; // Also doubles as bool + char *string; + float real; + long *integerPtr; + bool *boolPtr; + char **stringPtr; + float *realPtr; + wxPropertyValue *first; // If is a list expr, points to the first node + } m_value; + + wxPropertyValue* m_next; // If this is a node in a list, points to the next node + wxPropertyValue* m_last; // If is a list expr, points to the last node + }; /* @@ -283,13 +291,13 @@ class wxProperty: public wxObject { DECLARE_DYNAMIC_CLASS(wxProperty) protected: - bool enabled; + bool m_enabled; public: - wxPropertyValue value; - wxString name; - wxString propertyRole; - wxPropertyValidator *propertyValidator; - wxWindow *propertyWindow; // Usually a panel item, if anything + wxPropertyValue m_value; + wxString m_name; + wxString m_propertyRole; + wxPropertyValidator* m_propertyValidator; + wxWindow* m_propertyWindow; // Usually a panel item, if anything wxProperty(void); wxProperty(wxProperty& copyFrom); @@ -297,20 +305,20 @@ class wxProperty: public wxObject wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL); ~wxProperty(void); - virtual wxPropertyValue& GetValue(void); - virtual wxPropertyValidator *GetValidator(void); - virtual wxString& GetName(void); - virtual wxString& GetRole(void); + virtual wxPropertyValue& GetValue(void) const; + virtual wxPropertyValidator *GetValidator(void) const; + virtual wxString& GetName(void) const; + virtual wxString& GetRole(void) const; virtual void SetValue(const wxPropertyValue& val); virtual void SetValidator(wxPropertyValidator *v); virtual void SetName(wxString& nm); virtual void SetRole(wxString& role); void operator=(const wxPropertyValue& val); - virtual inline void SetWindow(wxWindow *win) { propertyWindow = win; } - virtual inline wxWindow *GetWindow(void) { return propertyWindow; } + virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; } + virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; } - inline void Enable(bool en) { enabled = en; } - inline bool IsEnabled(void) { return enabled; } + inline void Enable(bool en) { m_enabled = en; } + inline bool IsEnabled(void) const { return m_enabled; } }; #endif