Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / src / linkbutton.hg
1 /* $Id: linkbutton.hg,v 1.2 2006/03/22 16:53:22 murrayc Exp $ */
2
3 /* linkbutton.h
4  * 
5  * Copyright (C) 2006 The gtkmm Development Team
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include <gtkmm/button.h>
23 _DEFS(gtkmm,gtk)
24 _PINCLUDE(gtkmm/private/button_p.h)
25
26
27 namespace Gtk
28 {
29
30 /** Create buttons bound to a URL.
31  *
32  * A Gtk::LinkButton is a Gtk::Button with a hyperlink, similar to the one
33  * used by web browsers, which triggers an action when clicked. It is useful
34  * to show quick links to resources.
35  *
36  * The URI bound to a Gtk::LinkButton can be set specifically using set_uri(), 
37  * and retrieved using get_uri().
38  * Gtk::LinkButton offers a global hook, which is called when the used clicks on it: see set_uri_hook(). 
39  *
40  * @newin2p10
41  * @ingroup Widgets
42  */
43 class LinkButton : public Button
44 {
45   _CLASS_GTKOBJECT(LinkButton, GtkLinkButton, GTK_LINK_BUTTON, Gtk::Button, GtkButton)
46 public:
47   _CTOR_DEFAULT
48   explicit LinkButton(const Glib::ustring& uri);
49   _IGNORE(gtk_link_button_new)
50   _WRAP_CTOR(LinkButton(const Glib::ustring& uri, const Glib::ustring& label),gtk_link_button_new_with_label)
51
52   _WRAP_METHOD(Glib::ustring get_uri() const, gtk_link_button_get_uri)
53   _WRAP_METHOD(void set_uri(const Glib::ustring& uri), gtk_link_button_set_uri)
54
55   /** For instance,
56    * void on_linkbutton_uri(Gtk::LinkButton *button, const Glib::ustring& uri);
57    *
58    * @see set_uri_hook().
59    */
60   typedef sigc::slot<void, Gtk::LinkButton*, const Glib::ustring&> SlotUri;
61
62   /** Sets slot as the function that should be invoked every time a user clicks a LinkButton. 
63    * This function is called before every signal handler registered for the "clicked" signal.
64    *
65    * @param slot A function called each time a LinkButton is clicked.
66    * @newin2p12
67    */
68   static void set_uri_hook(const SlotUri& slot);
69   _IGNORE(gtk_link_button_set_uri_hook)
70
71   /** Unsets any previously set slot as the function that should be invoked every time a user clicks a LinkButton. 
72    * @see set_uri_hook().
73    * @newin2p12
74    */
75   static void unset_uri_hook();
76
77
78   _WRAP_PROPERTY("uri", Glib::ustring)                                           
79 };
80
81
82 } // namespace Gtk
83