From: Robert Roebling Date: Mon, 20 Dec 2010 19:13:13 +0000 (+0000) Subject: Correction to: Support diabling items in GTK+, see #12686: Allow disabling of wxDVC... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9c09addd35bc1ec4dc38e1ff111ce534db289f00 Correction to: Support diabling items in GTK+, see #12686: Allow disabling of wxDVC items git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index e9da457e58..f1ff60bf57 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -185,8 +185,8 @@ public: @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. + only partially supported in the generic version (wxMSW) and + currently not supported by the wxOSX/Carbon implementation. @since 2.9.2 */ diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 3bbb38b53b..4ebd29fc9a 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -2930,6 +2930,22 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column), cell->SetValue( value ); + // deal with disabled items + bool enabled = wx_model->IsEnabled( item, cell->GetOwner()->GetModelColumn() ); + + // a) this sets the appearance to disabled grey + GValue gvalue = { 0, }; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, enabled ); + g_object_set_property( G_OBJECT(renderer), "sensitive", &gvalue ); + g_value_unset( &gvalue ); + + // b) this actually disables the control/renderer + if (enabled) + cell->SetMode( cell->GtkGetMode() ); + else + cell->SetMode( wxDATAVIEW_CELL_INERT ); + // deal with attributes: if the renderer doesn't support them at all, we // don't even need to query the model for them @@ -2947,18 +2963,6 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column), // else: no custom attributes specified and we're already using the default // ones -- nothing to do - // deal with disabled items - bool enabled = wx_model->IsEnabled( item, cell->GetOwner()->GetModelColumn()); - GValue gvalue = { 0, }; - g_value_init( &gvalue, G_TYPE_BOOLEAN ); - g_value_set_boolean( &gvalue, enabled ); - g_object_set_property( G_OBJECT(renderer), "sensitive", &gvalue ); - g_value_unset( &gvalue ); - - if (enabled) - cell->SetMode( cell->GtkGetMode() ); - else - cell->SetMode( wxDATAVIEW_CELL_INERT ); } } // extern "C"