Debian Codegraph @

gtk/src/actionable.hg

raw
1 /* Copyright (C) 2012 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 _CONFIGINCLUDE(gtkmmconfig.h)
18
19 #include <glibmm/interface.h>
20
21 _DEFS(gtkmm,gtk)
22 _PINCLUDE(glibmm/private/interface_p.h)
23
24 #ifndef DOXYGEN_SHOULD_SKIP_THIS
25 extern "C"
26 {
27 typedef struct _GtkActionableInterface GtkActionableInterface;
28 }
29 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
30
31 namespace Gtk
32 {
33
34 //TODO: Have the appropriate widgets derive from this interface when there is
35 //an ABI break. See:
36 //https://docs.gtk.org/gtk3/iface.Actionable.html#implementations.
37
38 /** This interface provides a convenient way of associating widgets with
39 * actions on a ApplicationWindow or Application.
40 *
41 * It primarily consists of two properties: "action-name" and "action-target".
42 * There are also some convenience APIs for setting these properties.
43 *
44 * This interface is presently only meaningful if used on a widget that is (or
45 * will be) located inside of a ApplicationWindow and can only be used to
46 * associate the widget with actions on that window, or its associated
47 * Application.
48 * @newin{3,4}
49 */
50 class GTKMM_API Actionable : public Glib::Interface
51 {
52 _CLASS_INTERFACE(Actionable, GtkActionable, GTK_ACTIONABLE, GtkActionableInterface, , , GTKMM_API)
53
54 public:
55 _WRAP_METHOD(Glib::ustring get_action_name() const, gtk_actionable_get_action_name)
56 _WRAP_METHOD(void set_action_name(const Glib::ustring& action_name), gtk_actionable_set_action_name)
57
58 #m4 _CONVERSION(`GVariant*',`Glib::VariantBase',`Glib::wrap($3,true)')
59 _WRAP_METHOD(Glib::VariantBase get_action_target_value(), gtk_actionable_get_action_target_value)
60 _WRAP_METHOD(const Glib::VariantBase get_action_target_value() const, gtk_actionable_get_action_target_value, constversion)
61 _WRAP_METHOD(void set_action_target_value(const Glib::VariantBase& target_value), gtk_actionable_set_action_target_value)
62
63 _IGNORE(gtk_actionable_set_action_target) //gtk_actionable_set_action_target() is just a C convenience method.
64
65 _WRAP_METHOD(void set_detailed_action_name(const Glib::ustring& detailed_action_name), gtk_actionable_set_detailed_action_name)
66
67 _WRAP_PROPERTY("action-name", Glib::ustring)
68 _WRAP_PROPERTY("action-target", Glib::VariantBase)
69
70 #m4 _CONVERSION(`Glib::ustring',`const gchar*',`$3.empty() ? nullptr : $3.c_str()')
71 _WRAP_VFUNC(Glib::ustring get_action_name() const, "get_action_name", keep_return)
72
73 _WRAP_VFUNC(void set_action_name(const Glib::ustring& action_name), "set_action_name")
74
75 #m4 _CONVERSION(`Glib::VariantBase',`GVariant*',`$3.gobj()')
76 _WRAP_VFUNC(Glib::VariantBase get_action_target_value() const, "get_action_target_value", keep_return)
77
78 #m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3,true)')
79 _WRAP_VFUNC(void set_action_target_value(const Glib::VariantBase& action_target_value), "set_action_target_value")
80 };
81
82 } // namespace Gtk