Debian Codegraph @

gtk/src/modelbutton.hg

raw
1 /* Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/button.h>
18 #include <giomm/icon.h>
19
20 _DEFS(gtkmm,gtk)
21 _PINCLUDE(gtkmm/private/button_p.h)
22
23 namespace Gtk
24 {
25 _WRAP_ENUM(ButtonRole, GtkButtonRole, decl_prefix GTKMM_API)
26
27 /** A button that uses a Gio::Action as model.
28 *
29 * ModelButton is a button class that can use a Gio::Action as its model.
30 * In contrast to ToggleButton or RadioButton, which can also
31 * be backed by a Gio::Action via Actionable::property_action_name(),
32 * ModelButton will adapt its appearance according to the kind of
33 * action it is backed by, and appear either as a plain, check or radio button.
34 *
35 * Model buttons are used with popovers from a menu model bound to the popover.
36 * They can also be used manually in a PopoverMenu.
37 *
38 * When the action is specified via Actionable::property_action_name()
39 * and Actionable::property_action_target(), the role of the button
40 * (i.e. whether it is a plain, check or radio button) is determined by
41 * the type of the action and doesn't have to be explicitly specified
42 * with property_role().
43 *
44 * The content of the button is specified by property_text() and property_icon().
45 *
46 * The appearance of model buttons can be influenced with
47 * property_centered() and property_iconic().
48 *
49 * Model buttons have built-in support for submenus in PopoverMenu.
50 * To make a ModelButton that opens a submenu when activated, set
51 * property_menu_name(). To make a button that goes
52 * back to the parent menu, you should set property_inverted()
53 * to place the submenu indicator at the opposite side.
54 *
55 * @newin{3,18}
56 *
57 * @ingroup Widgets
58 */
59 class GTKMM_API ModelButton : public Button
60 {
61 _CLASS_GTKOBJECT(ModelButton, GtkModelButton, GTK_MODEL_BUTTON, Gtk::Button, GtkButton, , , GTKMM_API)
62
63 public:
64 _CTOR_DEFAULT
65
66 _WRAP_PROPERTY("role", ButtonRole)
67 _WRAP_PROPERTY("icon", Gio::Icon)
68 _WRAP_PROPERTY("text", Glib::ustring)
69 _WRAP_PROPERTY("active", bool)
70 _WRAP_PROPERTY("menu-name", Glib::ustring)
71 _WRAP_PROPERTY("inverted", bool)
72 _WRAP_PROPERTY("centered", bool)
73 _WRAP_PROPERTY("iconic", bool)
74
75 // ModelButton has no methods, signals, child properties nor vfuncs.
76 };
77
78 } //namespace Gtk