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

@@ -845,7 +845,8 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state
int flags = 0;
if (m_toggle)
flags |= wxCONTROL_CHECKED;
if (GetMode() != wxDATAVIEW_CELL_ACTIVATABLE)
if (GetMode() != wxDATAVIEW_CELL_ACTIVATABLE ||
GetEnabled() == false)
flags |= wxCONTROL_DISABLED;
// check boxes we draw must always have the same, standard size (if it's
@@ -868,7 +869,10 @@ void wxDataViewToggleRenderer::WXOnActivate(wxDataViewModel *model,
const wxDataViewItem & item,
unsigned int col)
{
model->ChangeValue(!valueOld.GetBool(), item, col);
if (model->IsEnabled(item, col))
{
model->ChangeValue(!valueOld.GetBool(), item, col);
}
}
wxSize wxDataViewToggleRenderer::GetSize() const