gtkbuilderprivate.h 3.73 KB
Newer Older
Johan Dahlin's avatar
Johan Dahlin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
/* gtkbuilderprivate.h
 * Copyright (C) 2006-2007 Async Open Source,
 *                         Johan Dahlin <jdahlin@async.com.br>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GTK_BUILDER_PRIVATE_H__
#define __GTK_BUILDER_PRIVATE_H__

#include <glib-object.h>
#include "gtkbuilder.h"

typedef struct {
  const gchar *name;
} TagInfo;

typedef struct {
  TagInfo tag;
} CommonInfo;

typedef struct {
  TagInfo tag;
  gchar *class_name;
  gchar *id;
  gchar *constructor;
  GSList *properties;
  GSList *signals;
  GObject *object;
  CommonInfo *parent;
} ObjectInfo;

typedef struct {
  TagInfo tag;
  GSList *packing_properties;
  GObject *object;
  CommonInfo *parent;
  gchar *type;
  gchar *internal_child;
  gboolean added;
} ChildInfo;

typedef struct {
  TagInfo tag;
  gchar *name;
Matthias Clasen's avatar
Matthias Clasen committed
59
  GString *text;
Johan Dahlin's avatar
Johan Dahlin committed
60 61
  gchar *data;
  gboolean translatable;
62
  gchar *context;
Johan Dahlin's avatar
Johan Dahlin committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
} PropertyInfo;

typedef struct {
  TagInfo tag;
  gchar *object_name;
  gchar *name;
  gchar *handler;
  GConnectFlags flags;
  gchar *connect_object_name;
} SignalInfo;

typedef struct {
  GMarkupParser *parser;
  gchar *tagname;
  const gchar *start;
  gpointer data;
  GObject *object;
  GObject *child;
} SubParser;

typedef struct {
  const gchar *last_element;
  GtkBuilder *builder;
  gchar *domain;
  GSList *stack;
  SubParser *subparser;
  GMarkupParseContext *ctx;
  const gchar *filename;
  GSList *finalizers;
  GSList *custom_finalizers;
} ParserData;

typedef GType (*GTypeGetFunc) (void);

97
/* Things only GtkBuilder should use */
Johan Dahlin's avatar
Johan Dahlin committed
98 99 100 101 102 103
void _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
                                       const gchar *filename,
                                       const gchar *buffer,
                                       gsize length,
                                       GError **error);
GObject * _gtk_builder_construct (GtkBuilder *builder,
104 105
                                  ObjectInfo *info,
				  GError    **error);
Johan Dahlin's avatar
Johan Dahlin committed
106 107
void      _gtk_builder_add (GtkBuilder *builder,
                            ChildInfo *child_info);
108 109
void      _gtk_builder_add_signals (GtkBuilder *builder,
				    GSList     *signals);
Johan Dahlin's avatar
Johan Dahlin committed
110 111 112
void      _gtk_builder_finish (GtkBuilder *builder);
void _free_signal_info (SignalInfo *info,
                        gpointer user_data);
113 114

/* Internal API which might be made public at some point */
115 116 117
gboolean _gtk_builder_boolean_from_string (const gchar  *string,
					   gboolean     *value,
					   GError      **error);
118 119 120 121
gboolean _gtk_builder_enum_from_string (GType         type,
                                        const gchar  *string,
                                        gint         *enum_value,
                                        GError      **error);
122 123
gboolean  _gtk_builder_flags_from_string (GType       type,
					  const char *string,
124
					  guint      *value,
125
					  GError    **error);
126 127 128
gchar * _gtk_builder_parser_translate (const gchar *domain,
				       const gchar *context,
				       const gchar *text);
129 130
gchar *   _gtk_builder_get_absolute_filename (GtkBuilder *builder,
					      const gchar *string);
Johan Dahlin's avatar
Johan Dahlin committed
131 132

#endif /* __GTK_BUILDER_PRIVATE_H__ */