mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 18:46:34 +01:00
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
81 lines
2.9 KiB
C++
81 lines
2.9 KiB
C++
// -*- c++ -*-
|
|
/* $Id: celllayout.ccg,v 1.8 2006/05/11 11:40:24 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 <gtk/gtkcelllayout.h>
|
|
|
|
|
|
static void SignalProxy_CellData_gtk_callback(GtkCellLayout* /* cell_layout */, GtkCellRenderer* /* cell */, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer data)
|
|
{
|
|
Gtk::CellLayout::SlotCellData* the_slot = static_cast<Gtk::CellLayout::SlotCellData*>(data);
|
|
|
|
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
|
try
|
|
{
|
|
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
|
//We ignore the cell, because that was given as an argument to the connecting method, so the caller should know which one it is already.
|
|
//And we ignore the tree_model because that can be obtained from the iter or from the CellLayout itself.
|
|
(*the_slot)(Gtk::TreeModel::const_iterator(tree_model, iter));
|
|
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
|
}
|
|
|
|
static void SignalProxy_CellData_gtk_callback_destroy(void* data)
|
|
{
|
|
delete static_cast<Gtk::CellLayout::SlotCellData*>(data);
|
|
}
|
|
|
|
namespace Gtk
|
|
{
|
|
|
|
#ifdef GLIBMM_PROPERTIES_ENABLED
|
|
void CellLayout::add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column)
|
|
{
|
|
gtk_cell_layout_add_attribute(gobj(),
|
|
(GtkCellRenderer*) property.get_object()->gobj(), property.get_name(), column.index());
|
|
}
|
|
#endif //GLIBMM_PROPERTIES_ENABLED
|
|
|
|
void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, const TreeModelColumnBase& column)
|
|
{
|
|
gtk_cell_layout_add_attribute(gobj(),
|
|
(GtkCellRenderer*) cell.gobj(), attribute.c_str(), column.index());
|
|
}
|
|
|
|
void CellLayout::set_cell_data_func(CellRenderer& cell, const SlotCellData& slot)
|
|
{
|
|
// Create a copy of the slot object. A pointer to this will be passed
|
|
// through the callback's data parameter. It will be deleted
|
|
// when SignalProxy_CellData_gtk_callback_destroy() is called.
|
|
SlotCellData* slot_copy = new SlotCellData(slot);
|
|
|
|
gtk_cell_layout_set_cell_data_func(gobj(), cell.gobj(),
|
|
&SignalProxy_CellData_gtk_callback, slot_copy,
|
|
&SignalProxy_CellData_gtk_callback_destroy);
|
|
}
|
|
|
|
|
|
} //namespace Gtk
|
|
|
|
|