+ Constructor.
+ */
+ wxDataViewCustomRenderer(const wxString& varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ /**
+ Destructor.
+ */
+ virtual ~wxDataViewCustomRenderer();
+
+ /**
+ Override this to react to cell @em activation. Activating a cell is an
+ alternative to showing inline editor when the value can be edited in a
+ simple way that doesn't warrant full editor control. The most typical
+ use of cell activation is toggling the checkbox in
+ wxDataViewToggleRenderer; others would be e.g. an embedded volume
+ slider or a five-star rating column.
+
+ The exact means of activating a cell are platform-dependent, but they
+ are usually similar to those used for inline editing of values.
+ Typically, a cell would be activated by Space or Enter keys or by left
+ mouse click.
+
+ This method will only be called if the cell has the
+ wxDATAVIEW_CELL_ACTIVATABLE mode.
+
+ @param cell
+ Coordinates of the activated cell's area.
+ @param model
+ The model to manipulate in response.
+ @param item
+ Activated item.
+ @param col
+ Activated column of @a item.
+ @param mouseEvent
+ If the activation was triggered by mouse click, contains the
+ corresponding event. Is @NULL otherwise (for keyboard activation).
+ Mouse coordinates are adjusted to be relative to the cell.
+
+ @since 2.9.3
+
+ @note Do not confuse this method with item activation in wxDataViewCtrl
+ and the wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. That one is
+ used for activating the item (or, to put it differently, the
+ entire row) similarly to analogous messages in wxTreeCtrl and
+ wxListCtrl, and the effect differs (play a song, open a file
+ etc.). Cell activation, on the other hand, is all about
+ interacting with the individual cell.
+
+ @see CreateEditorCtrl()
+ */
+ virtual bool ActivateCell(const wxRect& cell,
+ wxDataViewModel* model,
+ const wxDataViewItem & item,
+ unsigned int col,
+ const wxMouseEvent *mouseEvent);
+
+ /**
+ Override this to create the actual editor control once editing
+ is about to start.
+
+ This method will only be called if the cell has the
+ wxDATAVIEW_CELL_EDITABLE mode. Editing is typically triggered by slowly
+ double-clicking the cell or by a platform-dependent keyboard shortcut
+ (F2 is typical on Windows, Space and/or Enter is common elsewhere and
+ supported on Windows too).
+
+ @param parent
+ The parent of the editor control.
+ @param labelRect
+ Indicates the position and size of the editor control. The control
+ should be created in place of the cell and @a labelRect should be
+ respected as much as possible.
+ @param value
+ Initial value of the editor.
+
+ An example:
+ @code
+ {
+ long l = value;
+ return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
+ labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
+ }
+ @endcode
+
+ @see ActivateCell()
+ */
+ virtual wxWindow* CreateEditorCtrl(wxWindow* parent,
+ wxRect labelRect,
+ const wxVariant& value);
+
+ /**
+ Return the attribute to be used for rendering.
+
+ This function may be called from Render() implementation to use the
+ attributes defined for the item if the renderer supports them.
+
+ Notice that when Render() is called, the wxDC object passed to it is
+ already set up to use the correct attributes (e.g. its font is set to
+ bold or italic version if wxDataViewItemAttr::GetBold() or GetItalic()
+ returns true) so it may not be necessary to call it explicitly if you
+ only want to render text using the items attributes.
+
+ @since 2.9.1
+ */
+ const wxDataViewItemAttr& GetAttr() const;
+
+ /**
+ Return size required to show content.
+ */
+ virtual wxSize GetSize() const = 0;
+
+ /**
+ Override this so that the renderer can get the value from the editor
+ control (pointed to by @a editor):
+ @code
+ {
+ wxSpinCtrl *sc = (wxSpinCtrl*) editor;
+ long l = sc->GetValue();
+ value = l;
+ return true;
+ }
+ @endcode
+ */
+ virtual bool GetValueFromEditorCtrl(wxWindow* editor,
+ wxVariant& value);
+
+ /**
+ Override this and make it return @true in order to
+ indicate that this renderer supports in-place editing.
+ */
+ virtual bool HasEditorCtrl() const;
+
+ /**
+ Override this to react to a left click. This method will only be
+ called in @c wxDATAVIEW_CELL_ACTIVATABLE mode. This method is
+ deprecated, please use ActivateCell instead.
+ */
+ virtual bool LeftClick( wxPoint cursor,
+ wxRect cell,
+ wxDataViewModel * model,
+ const wxDataViewItem & item,
+ unsigned int col );
+
+ /**
+ Override this to react to the activation of a cell. This method is
+ deprecated, please use ActivateCell instead.
+ */
+ virtual bool Activate(wxRect cell,
+ wxDataViewModel * model,
+ const wxDataViewItem & item,
+ unsigned int col);
+
+
+ /**
+ Override this to render the cell.
+ Before this is called, wxDataViewRenderer::SetValue was called
+ so that this instance knows what to render.
+ */
+ virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
+
+ /**
+ This method should be called from within Render() whenever you need to
+ render simple text.
+ This will ensure that the correct colour, font and vertical alignment will
+ be chosen so the text will look the same as text drawn by native renderers.
+ */
+ void RenderText(const wxString& text, int xoffset, wxRect cell,
+ wxDC* dc, int state);
+
+ /**
+ Override this to start a drag operation. Not yet supported.
+ */
+ virtual bool StartDrag(const wxPoint& cursor,
+ const wxRect& cell,
+ wxDataViewModel* model,
+ const wxDataViewItem & item,
+ unsigned int col);
+
+protected:
+ /**
+ Helper for GetSize() implementations, respects attributes.
+ */
+ wxSize GetTextExtent(const wxString& str) const;
+};
+
+
+
+/**
+ @class wxDataViewBitmapRenderer
+
+ This class is used by wxDataViewCtrl to render bitmap controls.
+
+ @library{wxadv}
+ @category{dvc}
+*/
+class wxDataViewBitmapRenderer : public wxDataViewRenderer
+{
+public:
+ /**
+ The ctor.
+ */
+ wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+};
+
+
+/**
+ The flags used by wxDataViewColumn.
+ Can be combined together.
+*/
+enum wxDataViewColumnFlags
+{
+ wxDATAVIEW_COL_RESIZABLE = 1,
+ wxDATAVIEW_COL_SORTABLE = 2,
+ wxDATAVIEW_COL_REORDERABLE = 4,
+ wxDATAVIEW_COL_HIDDEN = 8
+};
+
+/**
+ @class wxDataViewColumn
+
+ This class represents a column in a wxDataViewCtrl.
+ One wxDataViewColumn is bound to one column in the data model to which the
+ wxDataViewCtrl has been associated.
+
+ An instance of wxDataViewRenderer is used by this class to render its data.
+
+ @library{wxadv}
+ @category{dvc}
+*/
+class wxDataViewColumn : public wxSettableHeaderColumn
+{
+public:
+ /**
+ Constructs a text column.
+
+ @param title
+ The title of the column.
+ @param renderer
+ The class which will render the contents of this column.
+ @param model_column
+ The index of the model's column which is associated with this object.
+ @param width
+ The width of the column.
+ The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
+ @param align
+ The alignment of the column title.
+ @param flags
+ One or more flags of the ::wxDataViewColumnFlags enumeration.
+ */
+ wxDataViewColumn(const wxString& title,
+ wxDataViewRenderer* renderer,
+ unsigned int model_column,
+ int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE);
+
+ /**
+ Constructs a bitmap column.
+
+ @param bitmap
+ The bitmap of the column.
+ @param renderer
+ The class which will render the contents of this column.
+ @param model_column
+ The index of the model's column which is associated with this object.
+ @param width
+ The width of the column.
+ The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
+ @param align
+ The alignment of the column title.
+ @param flags
+ One or more flags of the ::wxDataViewColumnFlags enumeration.
+ */
+ wxDataViewColumn(const wxBitmap& bitmap,
+ wxDataViewRenderer* renderer,
+ unsigned int model_column,
+ int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE);
+
+ /**
+ Returns the index of the column of the model, which this
+ wxDataViewColumn is displaying.
+ */
+ unsigned int GetModelColumn() const;
+
+ /**
+ Returns the owning wxDataViewCtrl.
+ */
+ wxDataViewCtrl* GetOwner() const;
+
+ /**
+ Returns the renderer of this wxDataViewColumn.
+
+ @see wxDataViewRenderer.
+ */
+ wxDataViewRenderer* GetRenderer() const;
+};
+
+
+
+/**
+ @class wxDataViewListCtrl
+
+ This class is a wxDataViewCtrl which internally uses a wxDataViewListStore
+ and forwards most of its API to that class.
+
+ The purpose of this class is to offer a simple way to display and
+ edit a small table of data without having to write your own wxDataViewModel.
+
+ @code
+ wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY );
+
+ listctrl->AppendToggleColumn( "Toggle" );
+ listctrl->AppendTextColumn( "Text" );
+
+ wxVector<wxVariant> data;
+ data.push_back( wxVariant(true) );
+ data.push_back( wxVariant("row 1") );
+ listctrl->AppendItem( data );
+
+ data.clear();
+ data.push_back( wxVariant(false) );
+ data.push_back( wxVariant("row 3") );
+ listctrl->AppendItem( data );
+ @endcode
+
+ @beginStyleTable
+ See wxDataViewCtrl for the list of supported styles.
+ @endStyleTable
+
+ @beginEventEmissionTable
+ See wxDataViewCtrl for the list of events emitted by this class.
+ @endEventTable
+
+ @library{wxadv}
+ @category{ctrl,dvc}
+*/
+class wxDataViewListCtrl: public wxDataViewCtrl
+{
+public:
+ /**
+ Default ctor.
+ */
+ wxDataViewListCtrl();
+
+ /**
+ Constructor. Calls Create().
+ */
+ wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator );
+
+ /**
+ Destructor. Deletes the image list if any.
+ */
+ ~wxDataViewListCtrl();
+
+ /**
+ Creates the control and a wxDataViewListStore as its internal model.
+ */
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator );
+
+ //@{
+ /**
+ Returns the store.
+ */
+ wxDataViewListStore *GetStore();
+ const wxDataViewListStore *GetStore() const;
+ //@}
+
+ /**
+ Returns the position of given @e item or wxNOT_FOUND if it's
+ not a valid item.
+
+ @since 2.9.2
+ */
+ int ItemToRow(const wxDataViewItem &item) const;
+
+ /**
+ Returns the wxDataViewItem at the given @e row.
+
+ @since 2.9.2
+ */
+ wxDataViewItem RowToItem(int row) const;
+
+ //@{
+ /**
+ @name Selection handling functions
+ */
+
+ /**
+ Returns index of the selected row or wxNOT_FOUND.
+
+ @see wxDataViewCtrl::GetSelection()
+
+ @since 2.9.2
+ */
+ int GetSelectedRow() const;
+
+ /**
+ Selects given row.
+
+ @see wxDataViewCtrl::Select()
+
+ @since 2.9.2
+ */
+ void SelectRow(unsigned row);
+
+ /**
+ Unselects given row.
+
+ @see wxDataViewCtrl::Unselect()
+
+ @since 2.9.2
+ */
+ void UnselectRow(unsigned row);
+
+ /**
+ Returns true if @a row is selected.
+
+ @see wxDataViewCtrl::IsSelected()
+
+ @since 2.9.2
+ */
+ bool IsRowSelected(unsigned row) const;
+
+ //@}
+
+ /**
+ @name Column management functions
+ */
+ //@{
+
+ /**
+ Appends a column to the control and additionally appends a
+ column to the store with the type string.