Debian Codegraph @

gtk/src/buildable.hg

raw
1 /* Copyright (C) 2009 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 _DEFS(gtkmm,gtk)
21 _PINCLUDE(glibmm/private/interface_p.h)
22
23 #ifndef DOXYGEN_SHOULD_SKIP_THIS
24 extern "C"
25 {
26 typedef struct _GtkBuildableIface GtkBuildableIface;
27 }
28 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
29
30 namespace Gtk
31 {
32
33 /** A base class for objects that can be built by Gtk::Builder.
34 *
35 * Buildable allows objects to extend and customize thier deserialization from Gtk::Builder UI descriptions.
36 * The interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects.
37 *
38 * All gtkmm widgets, and many non-widget objects, derive from this base class.
39 * The main user of this interface is Gtk::Builder. There should be very little need for applications to call any of Buildable's methods.
40 *
41 * @newin{3,0}
42 */
43 class GTKMM_API Buildable : public Glib::Interface
44 {
45 _CLASS_INTERFACE(Buildable, GtkBuildable, GTK_BUILDABLE, GtkBuildableIface, , , GTKMM_API)
46
47 public:
48 _WRAP_METHOD(void set_name(const Glib::ustring& name), gtk_buildable_set_name)
49 _WRAP_METHOD(Glib::ustring get_name() const, gtk_buildable_get_name)
50
51 //TODO: #m4 _CONVERSION(`(const Glib::RefPtr<Builder>&',`GtkBuilder*',`($3).gobj()')
52 //TODO: _WRAP_METHOD(void add_child(const Glib::RefPtr<Builder>& builder, const Glib::RefPtr<Glib::Object>& child, const Glib::ustring& type), gtk_buildable_add_child)
53
54 /* TODO:
55 _WRAP_METHOD(void gtk_buildable_set_buildable_property (
56 GtkBuilder *builder,
57 const Glib::ustring& name,
58 const GValue *value);
59 _WRAP_METHOD(GObject * gtk_buildable_construct_child (
60 GtkBuilder *builder,
61 const Glib::ustring& name);
62 _WRAP_METHOD(gboolean gtk_buildable_custom_tag_start (
63 GtkBuilder *builder,
64 GObject *child,
65 const Glib::ustring& tagname,
66 GMarkupParser *parser,
67 gpointer *data);
68 _WRAP_METHOD(void gtk_buildable_custom_tag_end (
69 GtkBuilder *builder,
70 GObject *child,
71 const Glib::ustring& tagname,
72 gpointer *data);
73 _WRAP_METHOD(void gtk_buildable_custom_finished (
74 GtkBuilder *builder,
75 GObject *child,
76 const Glib::ustring& tagname,
77 gpointer data);
78 _WRAP_METHOD(void gtk_buildable_parser_finished (
79 GtkBuilder *builder);
80 _WRAP_METHOD(GObject * gtk_buildable_get_internal_child (
81 GtkBuilder *builder,
82 const Glib::ustring& childname);
83 */
84
85 //TODO: Properties, signals, vfuncs.
86
87 #m4begin
88 dnl //Custom-coded vfuncs:
89 dnl
90 _PUSH(SECTION_CC_PRE_INCLUDES)
91 // Needed before gtkmm/private/buildable_p.h is included.
92 typedef struct _GtkBuilder GtkBuilder;
93 _SECTION(SECTION_PCC_CLASS_INIT_VFUNCS)
94 klass->custom_tag_start = &custom_tag_start_vfunc_callback;
95 klass->custom_tag_end = &custom_tag_end_vfunc_callback;
96 _SECTION(SECTION_PH_VFUNCS)
97 static gboolean custom_tag_start_vfunc_callback(
98 GtkBuildable* buildable,
99 GtkBuilder* builder,
100 GObject* child,
101 const gchar* tagname,
102 GMarkupParser* parser,
103 gpointer* data);
104 static void custom_tag_end_vfunc_callback(
105 GtkBuildable* buildable,
106 GtkBuilder* builder,
107 GObject* child,
108 const gchar* tagname,
109 gpointer* data);
110 _POP()
111 #m4end
112 };
113
114 } // namespace Gtk