Support diabling items in GTK+, see #12686: Allow disabling of wxDVC items
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -77,6 +77,8 @@ public:
|
|||||||
// specific attributes: can return NULL if this renderer doesn't render any
|
// specific attributes: can return NULL if this renderer doesn't render any
|
||||||
// text
|
// text
|
||||||
virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; }
|
virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; }
|
||||||
|
|
||||||
|
wxDataViewCellMode GtkGetMode() { return m_mode; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GtkOnCellChanged(const wxVariant& value,
|
virtual void GtkOnCellChanged(const wxVariant& value,
|
||||||
@@ -84,8 +86,9 @@ protected:
|
|||||||
unsigned col);
|
unsigned col);
|
||||||
|
|
||||||
|
|
||||||
GtkCellRenderer *m_renderer;
|
GtkCellRenderer *m_renderer;
|
||||||
int m_alignment;
|
int m_alignment;
|
||||||
|
wxDataViewCellMode m_mode;
|
||||||
|
|
||||||
// true if we hadn't changed any visual attributes or restored them since
|
// true if we hadn't changed any visual attributes or restored them since
|
||||||
// doing this
|
// doing this
|
||||||
|
@@ -1731,6 +1731,7 @@ wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, wxDataViewC
|
|||||||
wxDataViewRendererBase( varianttype, mode, align )
|
wxDataViewRendererBase( varianttype, mode, align )
|
||||||
{
|
{
|
||||||
m_renderer = NULL;
|
m_renderer = NULL;
|
||||||
|
m_mode = mode;
|
||||||
|
|
||||||
// we haven't changed them yet
|
// we haven't changed them yet
|
||||||
m_usingDefaultAttrs = true;
|
m_usingDefaultAttrs = true;
|
||||||
@@ -2945,6 +2946,19 @@ 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