From: Robert Roebling Date: Sun, 16 May 2010 15:29:35 +0000 (+0000) Subject: Part II of: Add GetChoice() and GetChoices() getters to all choice renderers and... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f4fcd64832e534aa9478b7147b7a4ffb825874c2 Part II of: Add GetChoice() and GetChoices() getters to all choice renderers and actually mention it in the docs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/gtk/dvrenderers.h b/include/wx/gtk/dvrenderers.h index 3997f8013f..3aa7029144 100644 --- a/include/wx/gtk/dvrenderers.h +++ b/include/wx/gtk/dvrenderers.h @@ -268,6 +268,9 @@ public: void SetAlignment( int align ); + wxString GetChoice(size_t index) const { return m_choices[index]; } + const wxArrayString& GetChoices() const { return m_choices; } + private: wxArrayString m_choices; wxString m_data; diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index f678bb7f23..13df37997b 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1114,6 +1114,7 @@ enum wxDataViewCellRenderState - wxDataViewBitmapRenderer, - wxDataViewDateRenderer, - wxDataViewSpinRenderer. + - wxDataViewChoiceRenderer. Additionally, the user can write own renderers by deriving from wxDataViewCustomRenderer. @@ -1353,6 +1354,38 @@ public: }; +/** + @class wxDataViewChoiceRenderer + + This class is used by wxDataViewCtrl to render choice controls. + It stores a string so that SetValue() and GetValue() operate + on a variant holding a string. + + @library{wxadv} + @category{dvc} +*/ + +class wxDataViewChoiceRenderer: public wxDataViewRenderer +{ +public: + /** + The ctor. + */ + wxDataViewChoiceRenderer( const wxArrayString &choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + + /** + Returns the choice referred to by index. + */ + wxString GetChoice(size_t index) const; + + /** + Returns all choices. + */ + const wxArrayString& GetChoices() const; +}; + /** @class wxDataViewDateRenderer