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
This commit is contained in:
@@ -185,8 +185,8 @@ public:
|
|||||||
|
|
||||||
@note Currently disabling items is fully implemented only for the
|
@note Currently disabling items is fully implemented only for the
|
||||||
native control implementation in wxOSX/Cocoa. This feature is
|
native control implementation in wxOSX/Cocoa. This feature is
|
||||||
partially supported in the generic version but not in wxGTK or
|
only partially supported in the generic version (wxMSW) and
|
||||||
wxOSX/Carbon native implementations.
|
currently not supported by the wxOSX/Carbon implementation.
|
||||||
|
|
||||||
@since 2.9.2
|
@since 2.9.2
|
||||||
*/
|
*/
|
||||||
|
@@ -2930,6 +2930,22 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
|
|||||||
|
|
||||||
cell->SetValue( value );
|
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
|
// deal with attributes: if the renderer doesn't support them at all, we
|
||||||
// don't even need to query the model for them
|
// 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
|
// else: no custom attributes specified and we're already using the default
|
||||||
// ones -- nothing to do
|
// 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"
|
} // extern "C"
|
||||||
|
Reference in New Issue
Block a user