]> Pileus Git - ~andy/gtk/blob - gtk/gtkbuilderprivate.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkbuilderprivate.h
1 /* gtkbuilderprivate.h
2  * Copyright (C) 2006-2007 Async Open Source,
3  *                         Johan Dahlin <jdahlin@async.com.br>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef __GTK_BUILDER_PRIVATE_H__
20 #define __GTK_BUILDER_PRIVATE_H__
21
22 #include "gtkbuilder.h"
23
24 typedef struct {
25   const gchar *name;
26 } TagInfo;
27
28 typedef struct {
29   TagInfo tag;
30 } CommonInfo;
31
32 typedef struct {
33   TagInfo tag;
34   gchar *class_name;
35   gchar *id;
36   gchar *constructor;
37   GSList *properties;
38   GSList *signals;
39   GObject *object;
40   CommonInfo *parent;
41 } ObjectInfo;
42
43 typedef struct {
44   TagInfo tag;
45   gchar *id;
46   GHashTable *objects;
47 } MenuInfo;
48
49 typedef struct {
50   TagInfo tag;
51   GSList *packing_properties;
52   GObject *object;
53   CommonInfo *parent;
54   gchar *type;
55   gchar *internal_child;
56   gboolean added;
57 } ChildInfo;
58
59 typedef struct {
60   TagInfo tag;
61   gchar *name;
62   GString *text;
63   gchar *data;
64   gboolean translatable;
65   gchar *context;
66 } PropertyInfo;
67
68 typedef struct {
69   TagInfo tag;
70   gchar *object_name;
71   gchar *name;
72   gchar *handler;
73   GConnectFlags flags;
74   gchar *connect_object_name;
75 } SignalInfo;
76
77 typedef struct {
78   TagInfo  tag;
79   gchar   *library;
80   gint     major;
81   gint     minor;
82 } RequiresInfo;
83
84 typedef struct {
85   GMarkupParser *parser;
86   gchar *tagname;
87   const gchar *start;
88   gpointer data;
89   GObject *object;
90   GObject *child;
91 } SubParser;
92
93 typedef struct {
94   const gchar *last_element;
95   GtkBuilder *builder;
96   gchar *domain;
97   GSList *stack;
98   SubParser *subparser;
99   GMarkupParseContext *ctx;
100   const gchar *filename;
101   GSList *finalizers;
102   GSList *custom_finalizers;
103
104   GSList *requested_objects; /* NULL if all the objects are requested */
105   gboolean inside_requested_object;
106   gint requested_object_level;
107   gint cur_object_level;
108
109   GHashTable *object_ids;
110 } ParserData;
111
112 typedef GType (*GTypeGetFunc) (void);
113
114 /* Things only GtkBuilder should use */
115 void _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
116                                        const gchar *filename,
117                                        const gchar *buffer,
118                                        gsize length,
119                                        gchar **requested_objs,
120                                        GError **error);
121 GObject * _gtk_builder_construct (GtkBuilder *builder,
122                                   ObjectInfo *info,
123                                   GError    **error);
124 void      _gtk_builder_add_object (GtkBuilder  *builder,
125                                    const gchar *id,
126                                    GObject     *object);
127 void      _gtk_builder_add (GtkBuilder *builder,
128                             ChildInfo *child_info);
129 void      _gtk_builder_add_signals (GtkBuilder *builder,
130                                     GSList     *signals);
131 void      _gtk_builder_finish (GtkBuilder *builder);
132 void _free_signal_info (SignalInfo *info,
133                         gpointer user_data);
134
135 /* Internal API which might be made public at some point */
136 gboolean _gtk_builder_boolean_from_string (const gchar  *string,
137                                            gboolean     *value,
138                                            GError      **error);
139 gboolean _gtk_builder_enum_from_string (GType         type,
140                                         const gchar  *string,
141                                         gint         *enum_value,
142                                         GError      **error);
143 gboolean  _gtk_builder_flags_from_string (GType       type,
144                                           const char *string,
145                                           guint      *value,
146                                           GError    **error);
147 gchar * _gtk_builder_parser_translate (const gchar *domain,
148                                        const gchar *context,
149                                        const gchar *text);
150 gchar *   _gtk_builder_get_resource_path (GtkBuilder *builder,
151                                           const gchar *string);
152 gchar *   _gtk_builder_get_absolute_filename (GtkBuilder *builder,
153                                               const gchar *string);
154
155 void      _gtk_builder_menu_start (ParserData   *parser_data,
156                                    const gchar  *element_name,
157                                    const gchar **attribute_names,
158                                    const gchar **attribute_values,
159                                    GError      **error);
160 void      _gtk_builder_menu_end   (ParserData  *parser_data);
161
162
163 #endif /* __GTK_BUILDER_PRIVATE_H__ */