Gtk::CellLayout & Gtk::TreeModel



I try todo something like in "gtk-demo->Combo boxes" when 
parent of tree is not sensitive.
I try to understand gtk code, and convert it into gtkmm,
but ... 
GTK:
------------------------------------------------------
static void
is_capital_sensitive (GtkCellLayout   *cell_layout,
		      GtkCellRenderer *cell,
		      GtkTreeModel    *tree_model,
		      GtkTreeIter     *iter,
		      gpointer         data)
{
  gboolean sensitive;
  sensitive = !gtk_tree_model_iter_has_child (tree_model, iter);
  g_object_set (cell, "sensitive", sensitive, NULL);
}

renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
				    "text", 0,
				    NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
					renderer,
					is_capital_sensitive,
					NULL, NULL);
---------------------------------------------------------------

my gtkmm:
--------------------------------------------------------
...
Gtk::CellRendererText renderer;
//here is error: Gtk::CellLayout::CellLayout() is protected;
Gtk::CellLayout layout;
layout.pack_start(renderer, true);
layout.add_attribute(renderer, "text", 0);
layout.set_cell_data_func (renderer, is_sensitive);
...

void is_sensitive(Gtk::TreeModel::const_iterator iter)
{
	bool sens = TableModel_Key_Value.iter_has_child_func(iter);
      //has no member .sensitive()
	renderer.sensitive(sens);
}
--------------------------------------------------------

Any Idea?
Please help.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]