git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
76 lines
2.2 KiB
C++
76 lines
2.2 KiB
C++
// -*- c++ -*-
|
|
/* $Id: linkbutton.ccg,v 1.1 2006/01/29 12:21:43 murrayc Exp $ */
|
|
|
|
/*
|
|
*
|
|
* Copyright 2006 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/gtklinkbutton.h>
|
|
|
|
|
|
static void SignalProxy_UriHook_gtk_callback(GtkLinkButton *button, const gchar *link, gpointer user_data)
|
|
{
|
|
Gtk::LinkButton::SlotUri* the_slot = static_cast<Gtk::LinkButton::SlotUri*>(user_data);
|
|
|
|
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
|
try
|
|
{
|
|
#endif //GLIBMM_EXCEPTIONS_ENABLE
|
|
// use Slot::operator()
|
|
(*the_slot)(Glib::wrap(button), Glib::convert_const_gchar_ptr_to_ustring(link));
|
|
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
|
}
|
|
catch(...)
|
|
{
|
|
Glib::exception_handlers_invoke();
|
|
}
|
|
#endif //GLIBMM_EXCEPTIONS_ENABLE
|
|
}
|
|
|
|
static void SignalProxy_UriHook_gtk_callback_destroy(void* data)
|
|
{
|
|
delete static_cast<Gtk::LinkButton::SlotUri*>(data);
|
|
}
|
|
|
|
|
|
namespace Gtk
|
|
{
|
|
|
|
LinkButton::LinkButton(const Glib::ustring& uri)
|
|
:
|
|
_CONSTRUCT("uri", uri.c_str(), "label", uri.c_str()) //Note that the uri is used for the label too, as in the C _new() function.
|
|
{}
|
|
|
|
void LinkButton::set_uri_hook(const SlotUri& 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 TreeView_Private::SignalProxy_CellData_gtk_callback_destroy() is called.
|
|
SlotUri* slot_copy = new SlotUri(slot);
|
|
|
|
gtk_link_button_set_uri_hook (&SignalProxy_UriHook_gtk_callback, slot_copy, &SignalProxy_UriHook_gtk_callback_destroy);
|
|
}
|
|
|
|
void LinkButton::unset_uri_hook()
|
|
{
|
|
gtk_link_button_set_uri_hook (0, 0, 0);
|
|
}
|
|
|
|
|
|
} // namespace Gtk
|
|
|