2 /* $Id: combobox.ccg,v 1.9 2006/05/10 20:59:27 murrayc Exp $ */
6 * Copyright 2003 The gtkmm Development Team
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/cellrenderertext.h>
25 #include <gtkmm/treeview_private.h> //For SignalProxy_RowSeparator.
26 #include <gtk/gtkcombobox.h>
27 #include <gtk/gtkcelllayout.h>
32 void ComboBox::unset_active()
34 gtk_combo_box_set_active(gobj(), -1 /* see GTK+ docs */);
37 TreeModel::iterator ComboBox::get_active()
39 Gtk::TreeModel::iterator iter;
41 Glib::RefPtr<Gtk::TreeModel> model = get_model();
44 gtk_combo_box_get_active_iter(gobj(), iter.gobj());
46 //It must be given the model, because the C++ wrapper has extra information.
47 iter.set_model_gobject(model->gobj());
53 TreeModel::const_iterator ComboBox::get_active() const
55 Gtk::TreeModel::iterator iter;
57 Glib::RefPtr<const Gtk::TreeModel> model = get_model();
60 gtk_combo_box_get_active_iter(const_cast<GtkComboBox*>(gobj()), iter.gobj());
62 //It must be given the model, because the C++ wrapper has extra information.
63 iter.set_model_gobject(const_cast<GtkTreeModel*>(model->gobj()));
70 void ComboBox::set_row_separator_func(const SlotRowSeparator& slot)
72 //Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
73 //It will be deleted when SignalProxy_RowSeparator_gtk_callback_destroy() is called.
74 SlotRowSeparator* slot_copy = new SlotRowSeparator(slot);
76 gtk_combo_box_set_row_separator_func(gobj(),
77 &TreeView_Private::SignalProxy_RowSeparator_gtk_callback, slot_copy,
78 &TreeView_Private::SignalProxy_RowSeparator_gtk_callback_destroy);
81 void ComboBox::unset_row_separator_func()
83 gtk_combo_box_set_row_separator_func(gobj(), 0, 0, 0 /* See C docs. */);