X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e607eac25c66866c3ad05313eb65510dd31ab557..937d5b6075db060b98daa0f0fadbaa528bc85554:/include/wx/propgrid/property.h diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index ed034939c6..99027163b7 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -98,7 +98,11 @@ public: DontUseCellBgCol }; - virtual void Render( wxDC& dc, + /** + Returns @true if rendered something in the foreground (text or + bitmap. + */ + virtual bool Render( wxDC& dc, const wxRect& rect, const wxPropertyGrid* propertyGrid, wxPGProperty* property, @@ -162,6 +166,31 @@ public: }; +/** + @class wxPGDefaultRenderer + + Default cell renderer, that can handles the common + scenarios. +*/ +class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer +{ +public: + virtual bool Render( wxDC& dc, + const wxRect& rect, + const wxPropertyGrid* propertyGrid, + wxPGProperty* property, + int column, + int item, + int flags ) const; + + virtual wxSize GetImageSize( const wxPGProperty* property, + int column, + int item ) const; + +protected: +}; + + class WXDLLIMPEXP_PROPGRID wxPGCellData : public wxObjectRefData { friend class wxPGCell; @@ -191,6 +220,8 @@ protected: bool m_hasValidText; }; +#endif // !SWIG + /** @class wxPGCell @@ -227,6 +258,11 @@ public: return (m_refData && GetData()->m_hasValidText); } + /** + Sets empty but valid data to this cell object. + */ + void SetEmptyData(); + /** Merges valid data from srcCell into this. */ @@ -272,39 +308,17 @@ public: return *this; } -protected: +private: virtual wxObjectRefData *CreateRefData() const { return new wxPGCellData(); } virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; }; - -/** @class wxPGDefaultRenderer - - Default cell renderer, that can handles the common - scenarios. -*/ -class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer -{ -public: - virtual void Render( wxDC& dc, - const wxRect& rect, - const wxPropertyGrid* propertyGrid, - wxPGProperty* property, - int column, - int item, - int flags ) const; - - virtual wxSize GetImageSize( const wxPGProperty* property, - int column, - int item ) const; - -protected: -}; - // ----------------------------------------------------------------------- +#ifndef SWIG + /** @class wxPGAttributeStorage wxPGAttributeStorage is somewhat optimized storage for @@ -536,10 +550,17 @@ wxPG_PROP_BEING_DELETED = 0x00200000 */ #define wxPG_ATTR_UNITS wxS("Units") -/** Universal, string. When set, will be shown in property's value cell - when displayed value string is empty, or value is unspecified. +/** When set, will be shown as 'greyed' text in property's value cell when + the actual displayed value is blank. +*/ +#define wxPG_ATTR_HINT wxS("Hint") + +#if wxPG_COMPATIBILITY_1_4 +/** + @deprecated Use "Hint" (wxPG_ATTR_HINT) instead. */ #define wxPG_ATTR_INLINE_HELP wxS("InlineHelp") +#endif /** Universal, wxArrayString. Set to enable auto-completion in any wxTextCtrl-based property editor. @@ -673,8 +694,12 @@ wxPG_PROP_BEING_DELETED = 0x00200000 #define wxPG_ATTR_MAX wxPGGlobalVars->m_strMax #undef wxPG_ATTR_UNITS #define wxPG_ATTR_UNITS wxPGGlobalVars->m_strUnits +#undef wxPG_ATTR_HINT +#define wxPG_ATTR_HINT wxPGGlobalVars->m_strHint +#if wxPG_COMPATIBILITY_1_4 #undef wxPG_ATTR_INLINE_HELP #define wxPG_ATTR_INLINE_HELP wxPGGlobalVars->m_strInlineHelp +#endif #endif // !SWIG @@ -813,7 +838,7 @@ public: @param values Values for choices. If NULL, indexes are used. */ - wxPGChoices( const wxChar** labels, const long* values = NULL ) + wxPGChoices( const wxChar* const* labels, const long* values = NULL ) { Init(); Set(labels,values); @@ -861,7 +886,7 @@ public: @param values Values for added choices. If empty, relevant entry indexes are used. */ - void Add( const wxChar** labels, const ValArrItem* values = NULL ); + void Add( const wxChar* const* labels, const ValArrItem* values = NULL ); /** Version that works with wxArrayString and wxArrayInt. */ void Add( const wxArrayString& arr, const wxArrayInt& arrint = wxArrayInt() ); @@ -989,7 +1014,7 @@ public: #ifndef SWIG /** Does not create copies for itself. */ - void Set( const wxChar** labels, const long* values = NULL ) + void Set( const wxChar* const* labels, const long* values = NULL ) { Free(); Add(labels,values); @@ -1431,12 +1456,16 @@ public: */ virtual void RefreshChildren(); - /** Special handling for attributes of this property. + /** + Reimplement this member function to add special handling for + attributes of this property. - If returns false, then the attribute will be automatically stored in - m_attributes. + @return Return @false to have the attribute automatically stored in + m_attributes. Default implementation simply does that and + nothing else. - Default implementation simply returns false. + @remarks To actually set property attribute values from the + application, use wxPGProperty::SetAttribute() instead. */ virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); @@ -1628,6 +1657,11 @@ public: return GetValueAsString(0); } + /** + Returns property's hint text (shown in empty value cell). + */ + inline wxString GetHintText() const; + /** Returns property grid where property lies. */ wxPropertyGrid* GetGrid() const; @@ -2038,7 +2072,7 @@ public: void SetValueToUnspecified() { wxVariant val; // Create NULL variant - SetValue(val); + SetValue(val, NULL, wxPG_SETVAL_REFRESH_EDITOR); } // Helper function (for wxPython bindings and such) for settings protected @@ -2062,7 +2096,7 @@ public: return m_validator; return DoGetValidator(); } -#endif // #if wxUSE_VALIDATORS +#endif // wxUSE_VALIDATORS #ifndef SWIG /** Returns client data (void*) of a property. @@ -2458,6 +2492,7 @@ public: int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const; virtual wxString ValueToString( wxVariant& value, int argFlags ) const; + virtual wxString GetValueAsString( int argFlags = 0 ) const; protected: void SetTextColIndex( unsigned int colInd )