13
0
livetrax/libs/gtkmm2/gtk/src/combobox.ccg
David Robillard 35fc31a1de Remove ancient/unused flowcanvas and libglademm from repository.
Update libraries to latest stable released version (except gnomecanvasmm, which is strangely packaged...).
Fixes building (at least here).


git-svn-id: svn://localhost/ardour2/trunk@2790 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-12-18 06:05:55 +00:00

88 lines
2.5 KiB
C++

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