Add the possibility to disable invisible wxDataViewCtrl items.

Add new wxDataViewModel::IsEnabled() and wxDataViewListStore::IsEnabledByRow()
methods and implement support for actually disabling the items in wxOSX/Cocoa
native implementation of wxDataViewCtrl and limited support for it in the
generic version.

We need to implement this in wxGTK using GtkCellRenderer "sensitive" propriety
later.

Closes #12686.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-12-19 15:02:56 +00:00
parent 46405e36bf
commit 98f8e6666b
11 changed files with 132 additions and 2 deletions

View File

@@ -167,6 +167,32 @@ 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. This feature is
partially supported in the generic version but not in wxGTK or
wxOSX/Carbon native implementations.
@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.
@@ -371,6 +397,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.
*/