GNOME Bugzilla – Bug 301597
ComboBox should derive from CellEditable
Last modified: 2010-09-08 10:36:30 UTC
Since GTK+ 2.6, GtkComboBox implements the GtkCellEditable interface, but we can't add this base without breaking ABI. This also means that the GtkCellRenderer::signal_editing_started() sends a null Gtk::CellEditable* parameter when used with a Gtk::CellRendererCombo. Until we can fix this, by breaking ABI, you must use the C API ( g_signal_connect() ).
A few other classes have gained new base classes (implementing new GInterfaces). I've added TODOs in the code.
This is done in the gtkmm-maybe3 branch.
And, what about checkbox? Gtk::CellRenderer::signal_editing_started() doesn't work?
JinZeyu, sorry I don't understand your question. Could you please explain what you mean?
Gtk::TreeModel::ColumnRecord lv_userlist_m_Column; Glib::RefPtr<Gtk::ListStore> lv_userlist_m_refTreeModel; //Gtk::TreeModelColumn <bool> lv_userlist_check; Gtk::TreeModelColumn<Glib::ustring> lv_userlist_check; Gtk::TreeView *lv_userlist; lv_userlist = Gtk::manage(new Gtk::TreeView()); lv_userlist_m_Column.add(lv_userlist_check); lv_userlist_m_refTreeModel = Gtk::ListStore::create(lv_userlist_m_Column); lv_userlist->set_model(lv_userlist_m_refTreeModel); lv_userlist->append_column_editable("Apply to terminal",lv_userlist_check); lv_userlist->get_column(0)->set_min_width(90); lv_userlist->get_column_cell_renderer(0)->signal_editing_started().connect(sigc::mem_fun(*this,&TmainWindow::on_someFunction)); when I double click the cell and start to edit,on_someFunction was called. but if declare lv_userlist_check as follow: Gtk::TreeModelColumn<bool> lv_userlist_check; however I click the cell(it looks like a checkbox),on_someFunction doesn't work
Jinzeyu, that's not related to this bug. Please file a separate bug if necessary. I don't know if it would make sense for a checkbox would support a signal editing signal, but maybe we can find out.
This becomes a pretty big problem when implementing a custom viewer using CellRendererCombo as start_editing() will return NULL due to the dynamic_cast in CellRenderer::start_editing. As a result I can't get the CellEditable to display in my custom widget. It would seem that custom cell viewers will need to work around this by using the C API directly as you would for signal_editing_started(), although it is a pain to do so. The documentation should probably mention this
This is done in git master, and it's in gtkmm 2.90.* releases already.