Debian Codegraph @

gtk/src/toolbutton.hg

raw
1 /* Copyright (C) 2003 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/toolitem.h>
18 _DEFS(gtkmm,gtk)
19 _PINCLUDE(gtkmm/private/toolitem_p.h)
20
21 namespace Gtk
22 {
23
24 //TODO: Derive from (and implement) Actionable when we can break ABI.
25
26 /** A Gtk::ToolItem subclass that displays buttons.
27 *
28 * A ToolButton is are Gtk::ToolItem containing a button.
29 * @ingroup Widgets
30 */
31 class GTKMM_API ToolButton : public ToolItem
32 {
33 _CLASS_GTKOBJECT(ToolButton, GtkToolButton, GTK_TOOL_BUTTON, Gtk::ToolItem, GtkToolItem, , , GTKMM_API)
34 public:
35
36 /** Creates a new ToolButton.
37 */
38 _CTOR_DEFAULT()
39
40 // _WRAP_CTOR does not take a 'deprecated' parameter.
41 // _WRAP_CTOR(ToolButton(const Gtk::StockID& stock_id), gtk_tool_button_new_from_stock)
42 #ifndef GTKMM_DISABLE_DEPRECATED
43 /** Creates a new ToolButton from a StockID.
44 *
45 * The ToolButton will be created according to the @a stock_id properties.
46 *
47 * @param stock_id The StockID which determines the look of the ToolButton.
48 * @deprecated Use the constructor with @a icon_widget and @a label parameters instead.
49 */
50 explicit ToolButton(const Gtk::StockID& stock_id);
51 _IGNORE(gtk_tool_button_new_from_stock)
52 #endif // GTKMM_DISABLE_DEPRECATED
53
54 /** Creates a new ToolButton with a label.
55 *
56 * The ToolButton will have the label @a label.
57 *
58 * @param label The string used to display the label for this ToolButton.
59 */
60 explicit ToolButton(const Glib::ustring& label);
61
62 /** Creates a new ToolButton with an image.
63 *
64 * The ToolButton will have the label @a label and an image widget @a icon_widget.
65 *
66 * @param icon_widget The widget placed as the ToolButton's icon.
67 * @param label The string used to display the label for this ToolButton.
68 */
69 _WRAP_CTOR(ToolButton(Widget& icon_widget, const Glib::ustring& label = Glib::ustring()), gtk_tool_button_new)
70
71 _WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_tool_button_set_label)
72 _WRAP_METHOD(Glib::ustring get_label() const, gtk_tool_button_get_label)
73 _WRAP_METHOD(void set_use_underline(bool use_underline = true), gtk_tool_button_set_use_underline)
74 _WRAP_METHOD(bool get_use_underline() const, gtk_tool_button_get_use_underline)
75 _WRAP_METHOD(void set_stock_id(const Gtk::StockID& stock_id), gtk_tool_button_set_stock_id, deprecated "Use set_icon_name() instead.")
76 _WRAP_METHOD(Glib::ustring get_stock_id() const, gtk_tool_button_get_stock_id, deprecated "Use get_icon_name() instead.")
77 _WRAP_METHOD(void set_icon_name(const Glib::ustring& icon_name), gtk_tool_button_set_icon_name)
78 _WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_tool_button_get_icon_name)
79 _WRAP_METHOD(void set_icon_widget(Widget& icon_widget), gtk_tool_button_set_icon_widget)
80 _WRAP_METHOD(Widget* get_icon_widget(), gtk_tool_button_get_icon_widget)
81 _WRAP_METHOD(const Widget* get_icon_widget() const, gtk_tool_button_get_icon_widget, constversion)
82 _WRAP_METHOD(void set_label_widget(Widget& label_widget), gtk_tool_button_set_label_widget)
83 _WRAP_METHOD(Widget* get_label_widget(), gtk_tool_button_get_label_widget)
84 _WRAP_METHOD(const Widget* get_label_widget() const, gtk_tool_button_get_label_widget, constversion)
85
86 //TODO: We use this in toolbar.ccg. Check if it should really be deprecated.
87 _WRAP_SIGNAL(void clicked(), "clicked")
88
89 _WRAP_PROPERTY("label", Glib::ustring)
90 _WRAP_PROPERTY("use_underline", bool)
91 _WRAP_PROPERTY("label_widget", Gtk::Widget*)
92 _WRAP_PROPERTY("stock_id", Glib::ustring, deprecated "Use property_icon_name() instead.")
93 _WRAP_PROPERTY("icon_name", Glib::ustring)
94 _WRAP_PROPERTY("icon_widget", Gtk::Widget)
95 };
96
97 } // namespace Gtk