X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80ce465c64d6f250e26cd69e62671a189302e897..4608b3f83757f5eac74f7113cf99ab42887ce0b9:/interface/wx/dataview.h diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index f1f7edc84c..f8961f8274 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -167,6 +167,33 @@ public: virtual bool GetAttr(const wxDataViewItem& item, unsigned int col, wxDataViewItemAttr& attr) const; + /** + Override this to indicate that the item should be disabled. + + Disabled items are displayed differently (e.g. grayed out) and cannot + be interacted with. + + The base class version always returns @true, thus making all items + enabled by default. + + @param item + The item whose enabled status is requested. + @param col + The column of the item whose enabled status is requested. + @return + @true if this item should be enabled, @false otherwise. + + @note Currently disabling items is fully implemented only for the + native control implementation in wxOSX/Cocoa and wxGTK. + This feature is only partially supported in the generic + version (used by wxMSW) and not supported by the wxOSX/Carbon + implementation. + + @since 2.9.2 + */ + virtual bool IsEnabled(const wxDataViewItem &item, + unsigned int col) const; + /** Override this so the control can query the child items of an item. Returns the number of items. @@ -249,7 +276,7 @@ public: /** Call this to inform the model that an item has changed. - This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED + This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED event (in which the column fields will not be set) to the user. */ bool ItemChanged(const wxDataViewItem& item); @@ -269,7 +296,7 @@ public: /** Call this to inform the model that several items have changed. - This will eventually emit wxEVT_DATAVIEW_ITEM_VALUE_CHANGED + This will eventually emit @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED events (in which the column fields will not be set) to the user. */ bool ItemsChanged(const wxDataViewItemArray& items); @@ -310,7 +337,7 @@ public: This is also called from wxDataViewCtrl's internal editing code, e.g. when editing a text field in the control. - This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED + This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED event to the user. */ virtual bool ValueChanged(const wxDataViewItem& item, @@ -327,28 +354,17 @@ protected: /** - @class wxDataViewIndexListModel - - wxDataViewIndexListModel is a specialized data model which lets you address - an item by its position (row) rather than its wxDataViewItem (which you can - obtain from this class). - This model also provides its own wxDataViewIndexListModel::Compare - method which sorts the model's data by the index. + @class wxDataViewListModel - This model is not a virtual model since the control stores each wxDataViewItem. - Use wxDataViewVirtualListModel if you need to display millions of items or - have other reason to use a virtual control. + Base class with abstract API for wxDataViewIndexListModel and + wxDataViewVirtualListModel. @library{wxadv} @category{dvc} */ -class wxDataViewIndexListModel : public wxDataViewModel +class wxDataViewListModel : public wxDataViewModel { public: - /** - Constructor. - */ - wxDataViewIndexListModel(unsigned int initial_size = 0); /** Destructor. @@ -382,6 +398,28 @@ public: virtual bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr& attr) const; + /** + Override this if you want to disable specific items. + + The base class version always returns @true, thus making all items + enabled by default. + + @param row + The row of the item whose enabled status is requested. + @param col + The column of the item whose enabled status is requested. + @return + @true if the item at this row and column should be enabled, + @false otherwise. + + @note See wxDataViewModel::IsEnabled() for the current status of + support for disabling the items under different platforms. + + @since 2.9.2 + */ + virtual bool IsEnabledByRow(unsigned int row, + unsigned int col) const; + /** Returns the number of items (i.e. rows) in the list. */ @@ -455,6 +493,34 @@ public: }; +/** + @class wxDataViewIndexListModel + + wxDataViewIndexListModel is a specialized data model which lets you address + an item by its position (row) rather than its wxDataViewItem (which you can + obtain from this class). + This model also provides its own wxDataViewIndexListModel::Compare + method which sorts the model's data by the index. + + This model is not a virtual model since the control stores each wxDataViewItem. + Use wxDataViewVirtualListModel if you need to display millions of items or + have other reason to use a virtual control. + + @see wxDataViewListModel for the API. + + @library{wxadv} + @category{dvc} +*/ + +class wxDataViewIndexListModel : public wxDataViewListModel +{ +public: + /** + Constructor. + */ + wxDataViewIndexListModel(unsigned int initial_size = 0); + +}; /** @class wxDataViewVirtualListModel @@ -464,15 +530,15 @@ public: the exact same interface as wxDataViewIndexListModel. The important difference is that under platforms other than OS X, using this model will result in a truly virtual control able to handle millions of items - as the control doesn't store any item (a feature not supported by the - Carbon API under OS X). + as the control doesn't store any item (a feature not supported by OS X). - @see wxDataViewIndexListModel for the API. + @see wxDataViewListModel for the API. @library{wxadv} @category{dvc} */ -class wxDataViewVirtualListModel : public wxDataViewModel + +class wxDataViewVirtualListModel : public wxDataViewListModel { public: /** @@ -480,10 +546,6 @@ public: */ wxDataViewVirtualListModel(unsigned int initial_size = 0); - /** - Returns the number of virtual items (i.e. rows) in the list. - */ - unsigned int GetCount() const; }; @@ -605,6 +667,8 @@ public: Multiple selection mode. @style{wxDV_ROW_LINES} Use alternating colours for rows if supported by platform and theme. + Currently only supported by the native GTK and OS X implementations + but not by the generic one. @style{wxDV_HORIZ_RULES} Display fine rules between row if supported. @style{wxDV_VERT_RULES} @@ -676,7 +740,8 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator); + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDataViewCtrlNameStr); /** Destructor. @@ -857,7 +922,8 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator); + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDataViewCtrlNameStr); /** Deletes given column. @@ -2626,7 +2692,7 @@ public: void SetColumn(int col); /** - For wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only. + For @c wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only. */ void SetDataViewColumn(wxDataViewColumn* col);