X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a6ca568ce0dc3a24cb03209cf307973cbe2fbaf6..aaf5f98682223a5ceb3496e7a25865ad791e8ab7:/include/wx/propgrid/property.h diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index b8a1581e5a..b585a68823 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -137,14 +137,28 @@ public: wxPGProperty* property, const wxPGEditor* editor ) const; - /** Utility to render cell bitmap and set text colour plus bg brush colour. + /** Utility to render cell bitmap and set text colour plus bg brush + colour. - Returns image width that, for instance, can be passed to DrawText. + @return Returns image width, which, for instance, can be passed to + DrawText. */ int PreDrawCell( wxDC& dc, const wxRect& rect, const wxPGCell& cell, int flags ) const; + + /** + Utility to be called after drawing is done, to revert whatever + changes PreDrawCell() did. + + @param flags + Same as those passed to PreDrawCell(). + */ + void PostDrawCell( wxDC& dc, + const wxPropertyGrid* propGrid, + const wxPGCell& cell, + int flags ) const; }; @@ -162,6 +176,7 @@ public: void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; } void SetFgCol( const wxColour& col ) { m_fgCol = col; } void SetBgCol( const wxColour& col ) { m_bgCol = col; } + void SetFont( const wxFont& font ) { m_font = font; } protected: virtual ~wxPGCellData() { } @@ -170,14 +185,16 @@ protected: wxBitmap m_bitmap; wxColour m_fgCol; wxColour m_bgCol; + wxFont m_font; // True if m_text is valid and specified bool m_hasValidText; }; -/** @class wxPGCell +/** + @class wxPGCell - Base class for simple wxPropertyGrid cell information. + Base class for wxPropertyGrid cell information. */ class WXDLLIMPEXP_PROPGRID wxPGCell : public wxObject { @@ -218,11 +235,32 @@ public: void SetText( const wxString& text ); void SetBitmap( const wxBitmap& bitmap ); void SetFgCol( const wxColour& col ); + + /** + Sets font of the cell. + + @remarks Because wxPropertyGrid does not support rows of + different height, it makes little sense to change + size of the font. Therefore it is recommended + to use return value of wxPropertyGrid::GetFont() + or wxPropertyGrid::GetCaptionFont() as a basis + for the font that, after modifications, is passed + to this member function. + */ + void SetFont( const wxFont& font ); + void SetBgCol( const wxColour& col ); const wxString& GetText() const { return GetData()->m_text; } const wxBitmap& GetBitmap() const { return GetData()->m_bitmap; } const wxColour& GetFgCol() const { return GetData()->m_fgCol; } + + /** + Returns font of the cell. If no specific font is set for this + cell, then the font will be invalid. + */ + const wxFont& GetFont() const { return GetData()->m_font; } + const wxColour& GetBgCol() const { return GetData()->m_bgCol; } wxPGCell& operator=( const wxPGCell& other ) @@ -435,7 +473,11 @@ wxPG_PROP_CLASS_SPECIFIC_1 = 0x00080000, /** Indicates the bit useable by derived properties. */ -wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000 +wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000, + +/** Indicates that the property is being deleted and should be ignored. +*/ +wxPG_PROP_BEING_DELETED = 0x00200000 }; @@ -727,7 +769,7 @@ private: Helper class for managing choices of wxPropertyGrid properties. Each entry can have label, value, bitmap, text colour, and background colour. - + wxPGChoices uses reference counting, similar to other wxWidgets classes. This means that assignment operator and copy constructor only copy the reference and not the actual data. Use Copy() member function to create a @@ -1557,10 +1599,25 @@ public: /** Returns wxPGCell of given column. + + @remarks const version of this member function returns 'default' + wxPGCell object if the property itself didn't hold + cell data. */ const wxPGCell& GetCell( unsigned int column ) const; - wxPGCell& GetCell( unsigned int column ); + /** + Returns wxPGCell of given column, creating one if necessary. + */ + wxPGCell& GetCell( unsigned int column ) + { + return GetOrCreateCell(column); + } + + /** + Returns wxPGCell of given column, creating one if necessary. + */ + wxPGCell& GetOrCreateCell( unsigned int column ); /** Return number of displayed common values for this property. */ @@ -1957,7 +2014,7 @@ public: void SetLabel( const wxString& label ) { m_label = label; } - inline void SetName( const wxString& newName ); + void SetName( const wxString& newName ); /** Changes what sort of parent this property is for its children. @@ -2238,6 +2295,13 @@ protected: /** Deletes all sub-properties. */ void Empty(); + bool HasCell( unsigned int column ) const + { + if ( m_cells.size() > column ) + return true; + return false; + } + void InitAfterAdded( wxPropertyGridPageState* pageState, wxPropertyGrid* propgrid );