X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02b51ae521db06ef12a3c2a37a5378a9f715e707..5b88a837ba75928cd3835a6b97ae2bf5ad983a6e:/interface/wx/dataview.h diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index ce3da34d0b..79db099c1f 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -67,14 +67,14 @@ associating the model with a control like this: @code - wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, ID_MUSIC_CTRL ); + wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY ); wxDataViewModel *musicModel = new MyMusicModel; - m_musicCtrl-AssociateModel( musicModel ); - musicModel-DecRef(); // avoid memory leak !! + m_musicCtrl->AssociateModel( musicModel ); + musicModel->DecRef(); // avoid memory leak !! + // add columns now @endcode - @library{wxadv} @category{dvc} */ @@ -107,7 +107,7 @@ public: virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int column, - bool ascending); + bool ascending) const; /** Override this to indicate that the item has special font attributes. @@ -522,44 +522,48 @@ public: Display fine rules between columns is supported. @style{wxDV_VARIABLE_LINE_HEIGHT} Allow variable line heights. - This can be inefficient when displaying large number of items. + This can be inefficient when displaying large number of items. @endStyleTable - @beginEventTable{wxDataViewEvent} + @beginEventEmissionTable{wxDataViewEvent} @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. + Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. + @event{EVT_DATAVIEW_ITEM_START_EDITING(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. This + event can be vetoed in order to prevent editing on an item by item + basis. Still experimental. @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event. @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. @event{EVT_DATAVIEW_ITEM_DROP(id, func)} - Process a wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. @endEventTable @library{wxadv} @@ -1373,7 +1377,7 @@ public: Override this and make it return @true in order to indicate that this renderer supports in-place editing. */ - virtual bool HasEditorCtrl(); + virtual bool HasEditorCtrl() const; /** Overrride this to react to a left click. @@ -1456,7 +1460,7 @@ enum wxDataViewColumnFlags @library{wxadv} @category{dvc} */ -class wxDataViewColumn : public wxHeaderColumn +class wxDataViewColumn : public wxSettableHeaderColumn { public: /** @@ -1538,22 +1542,29 @@ public: edit a small table of data without having to write your own wxDataViewModel. @code - wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, -1 ); + wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY ); listctrl->AppendToggleColumn( "Toggle" ); listctrl->AppendTextColumn( "Text" ); wxVector data; - data.push_back( true ); - data.push_back( "row 1" ); + data.push_back( wxVariant(true) ); + data.push_back( wxVariant("row 1") ); listctrl->AppendItem( data ); data.clear(); - data.push_back( false ); - data.push_back( "row 3" ); + 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} @@ -1596,75 +1607,99 @@ public: //@} /** - Appends a column to the control and additonally appends a - column to the store with the type @a varianttype. + @name Column management functions + */ + //@{ + + /** + Appends a column to the control and additionally appends a + column to the store with the type string. + */ + virtual void AppendColumn( wxDataViewColumn *column ); + + /** + Appends a column to the control and additionally appends a + column to the list store with the type @a varianttype. */ void AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); /** - Prepends a column to the control and additonally prepends a - column to the store with the type @a varianttype. + Appends a text column to the control and the store. + + See wxDataViewColumn::wxDataViewColumn for more info about + the parameters. */ - void PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); + wxDataViewColumn *AppendTextColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int width = -1, wxAlignment align = wxALIGN_LEFT, + int flags = wxDATAVIEW_COL_RESIZABLE ); /** - Inserts a column to the control and additonally inserts a - column to the store with the type @a varianttype. + Appends a toggle column to the control and the store. + + See wxDataViewColumn::wxDataViewColumn for more info about + the parameters. */ - void InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); + wxDataViewColumn *AppendToggleColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, + int width = -1, wxAlignment align = wxALIGN_LEFT, + int flags = wxDATAVIEW_COL_RESIZABLE ); /** - Overridden from wxDataViewCtrl + Appends a progress column to the control and the store. - Appends a column to the control and additonally appends a - column to the store with the type string. + See wxDataViewColumn::wxDataViewColumn for more info about + the parameters. */ - virtual void AppendColumn( wxDataViewColumn *column ); + wxDataViewColumn *AppendProgressColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int width = -1, wxAlignment align = wxALIGN_LEFT, + int flags = wxDATAVIEW_COL_RESIZABLE ); /** - Overridden from wxDataViewCtrl + Appends an icon-and-text column to the control and the store. - Prepends a column to the control and additonally prepends a - column to the store with the type string. + See wxDataViewColumn::wxDataViewColumn for more info about + the parameters. */ - virtual void PrependColumn( wxDataViewColumn *column ); + wxDataViewColumn *AppendIconTextColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int width = -1, wxAlignment align = wxALIGN_LEFT, + int flags = wxDATAVIEW_COL_RESIZABLE ); /** - Overridden from wxDataViewCtrl - - Inserts a column to the control and additonally inserts a + Inserts a column to the control and additionally inserts a column to the store with the type string. */ virtual void InsertColumn( unsigned int pos, wxDataViewColumn *column ); /** - Inserts a text column to the control and the store. + Inserts a column to the control and additionally inserts a + column to the list store with the type @a varianttype. */ - wxDataViewColumn *AppendTextColumn( const wxString &label, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, - int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + void InsertColumn( unsigned int pos, wxDataViewColumn *column, + const wxString &varianttype ); /** - Inserts a toggle column to the control and the store. + Prepends a column to the control and additionally prepends a + column to the store with the type string. */ - wxDataViewColumn *AppendToggleColumn( const wxString &label, - wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, - int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + virtual void PrependColumn( wxDataViewColumn *column ); /** - Inserts a progress column to the control and the store. + Prepends a column to the control and additionally prepends a + column to the list store with the type @a varianttype. */ - wxDataViewColumn *AppendProgressColumn( const wxString &label, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, - int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + void PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); + //@} + + /** - Inserts a icon and text column to the control and the store. + @name Item management functions */ - wxDataViewColumn *AppendIconTextColumn( const wxString &label, - wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, - int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); - + //@{ + /** Appends an item (=row) to the control and store. */ @@ -1678,7 +1713,7 @@ public: /** Inserts an item (=row) to the control and store. */ - void InsertItem( unsigned int row, const wxVector &values, wxClientData *data = NULL ); + void InsertItem( unsigned int row, const wxVector &values, wxClientData *data = NULL ); /** Delete the row at position @a row. @@ -1731,6 +1766,8 @@ public: respective column. */ bool GetToggleValue( unsigned int row, unsigned int col ) const; + + //@} }; @@ -1741,8 +1778,16 @@ public: and forwards most of its API to that class. Additionally, it uses a wxImageList to store a list of icons. - The main purpose of this class is to look like a wxTreeCtrl to make a transition - from it to the wxDataViewCtrl class simpler. + The main purpose of this class is to represent a possible replacement for + wxTreeCtrl. + + @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} @@ -2238,6 +2283,43 @@ public: This is the event class for the wxDataViewCtrl notifications. + @beginEventTable{wxDataViewEvent} + @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. + @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. + @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. + @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. + @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. + @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. + @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. + @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. + @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. + @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event. + @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. + @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. + @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. + @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. + @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. + @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. + @event{EVT_DATAVIEW_ITEM_DROP(id, func)} + Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. + @endEventTable + @library{wxadv} @category{events,dvc} */