X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5ec7dd6eebda65b5f430cebf2f92eaddc4f7c9e..60dd3c0916772e3e64fde7c83d359daae02b40a6:/include/wx/dataview.h diff --git a/include/wx/dataview.h b/include/wx/dataview.h index d94583a945..022ff17bd5 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -20,7 +20,6 @@ #include "wx/textctrl.h" #include "wx/bitmap.h" #include "wx/variant.h" -#include "wx/listctrl.h" #include "wx/dynarray.h" #include "wx/icon.h" @@ -78,7 +77,7 @@ public: operator const void* () const { return m_id; } #ifdef __WXDEBUG__ - void Print( const wxString &text ) const { wxPrintf( "item %s: %d\n", text, (int) m_id ); } + void Print( const wxString &text ) const; #endif private: @@ -118,6 +117,42 @@ private: }; + +// ---------------------------------------------------------------------------- +// wxDataViewItemAttr: a structure containing the visual attributes of an item +// ---------------------------------------------------------------------------- + +// TODO: this should be renamed to wxItemAttr or something general like this + +class WXDLLIMPEXP_ADV wxDataViewItemAttr +{ +public: + // ctors + wxDataViewItemAttr() + { + m_bold = false; + m_italic = false; + } + + // setters + void SetColour(const wxColour& colour) { m_colour = colour; } + void SetBold( bool set ) { m_bold = set; } + void SetItalic( bool set ) { m_italic = set; } + + // accessors + bool HasColour() const { return m_colour.Ok(); } + const wxColour& GetColour() const { return m_colour; } + + bool GetBold() const { return m_bold; } + bool GetItalic() const { return m_italic; } + +private: + wxColour m_colour; + bool m_bold; + bool m_italic; +}; + + // --------------------------------------------------------- // wxDataViewModel // --------------------------------------------------------- @@ -143,6 +178,10 @@ public: virtual bool SetValue( const wxVariant &variant, const wxDataViewItem &item, unsigned int col ) = 0; + // Get text attribute, return false of default attributes should be used + virtual bool GetAttr( const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) ) + { return false; } + // define hierachy virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0; virtual bool IsContainer( const wxDataViewItem &item ) const = 0; @@ -197,6 +236,9 @@ public: virtual bool SetValue( const wxVariant &variant, unsigned int row, unsigned int col ) = 0; + virtual bool GetAttr( unsigned int WXUNUSED(row), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) ) + { return false; } + void RowPrepended(); void RowInserted( unsigned int before ); void RowAppended(); @@ -221,6 +263,7 @@ public: const wxDataViewItem &item, unsigned int col ) const; virtual bool SetValue( const wxVariant &variant, const wxDataViewItem &item, unsigned int col ); + virtual bool GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr ); virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; virtual bool IsContainer( const wxDataViewItem &item ) const; virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; @@ -718,7 +761,7 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); // wxDataViewSpinRenderer // ------------------------------------- -class wxDataViewSpinRenderer: public wxDataViewCustomRenderer +class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer { public: wxDataViewSpinRenderer( int min, int max,