Esempio n. 1
0
void setCellRendererCombo(string treeviewcolumn, string combolist, Gtk::TreeModelColumnBase& col, sigc::slot<void, const Glib::ustring&, const Gtk::TreeModel::iterator& > sig) {
    Glib::RefPtr<Gtk::ListStore> combo_list = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object(combolist.c_str()));
    Gtk::CellRendererCombo* renderer = new Gtk::CellRendererCombo();
    renderer->property_has_entry() = false;
    renderer->property_model() = combo_list;
    renderer->property_text_column() = 0;
    renderer->property_editable() = true;

    Glib::RefPtr<Gtk::TreeView::Column> column = Glib::RefPtr<Gtk::TreeView::Column>::cast_static(VRGuiBuilder()->get_object(treeviewcolumn.c_str()));
    column->pack_start(*renderer);

    column->add_attribute(renderer->property_text(), col);
    renderer->signal_changed().connect(sig);
}
Esempio n. 2
0
void setCellRendererCombo(string treeviewcolumn, string combolist, Gtk::TreeModelColumnBase& col, void (* fkt)(GtkCellRendererCombo*, gchar*, GtkTreeIter*, gpointer)) {
    Glib::RefPtr<Gtk::ListStore> combo_list = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object(combolist.c_str()));
    Gtk::CellRendererCombo* renderer = new Gtk::CellRendererCombo();
    renderer->property_has_entry() = false;
    renderer->property_model() = combo_list;
    renderer->property_text_column() = 0;
    renderer->property_editable() = true;

    Glib::RefPtr<Gtk::TreeView::Column> column = Glib::RefPtr<Gtk::TreeView::Column>::cast_static(VRGuiBuilder()->get_object(treeviewcolumn.c_str()));
    column->pack_start(*renderer);

    column->add_attribute(renderer->property_text(), col);
    g_signal_connect (renderer->gobj(), "changed", G_CALLBACK (fkt), NULL);
}