1
/* -*- Mode: C; c-basic-offset: 4 -*-
2
* libglade - a library for building interfaces from XML files at runtime
3
* Copyright (C) 1998-2002 James Henstridge <james@daa.com.au>
5
* glade-build.h: functions useful for adding support for new widgets.
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
26
#include <glib-object.h>
28
#include <glade/glade-xml.h>
29
#include <gtk/gtkwidget.h>
30
#include <gtk/gtkwindow.h>
31
#include <gtk/gtkaccelgroup.h>
32
#include <gtk/gtkadjustment.h>
34
#include <glade/glade-parser.h>
38
/* create a new widget of some type. Don't parse `standard' widget options */
39
typedef GtkWidget *(* GladeNewFunc) (GladeXML *xml,
41
GladeWidgetInfo *info);
42
/* call glade_xml_build_widget on each child node, and pack in self */
43
typedef void (* GladeBuildChildrenFunc) (GladeXML *xml,
45
GladeWidgetInfo *info);
46
typedef GtkWidget *(* GladeFindInternalChildFunc) (GladeXML *xml,
48
const gchar *childname);
50
typedef void (* GladeApplyCustomPropFunc) (GladeXML *xml,
52
const gchar *propname,
55
/* register handlers for a widget */
56
void glade_register_widget(GType type,
58
GladeBuildChildrenFunc build_children,
59
GladeFindInternalChildFunc find_internal_child);
61
/* register a custom handler for a property (that may not have an
62
* associated gobject property. Works in conjunction with
63
* glade_standard_build_widget. */
64
void glade_register_custom_prop(GType type,
65
const gchar *prop_name,
66
GladeApplyCustomPropFunc apply_prop);
68
/* set the current toplevel widget while building (use NULL to unset) */
69
void glade_xml_set_toplevel(GladeXML *xml, GtkWindow *window);
71
/* make sure that xml->priv->accel_group is a valid AccelGroup */
72
GtkAccelGroup *glade_xml_ensure_accel(GladeXML *xml);
74
void glade_xml_handle_widget_prop(GladeXML *self, GtkWidget *widget,
75
const gchar *prop_name,
76
const gchar *value_name);
78
void glade_xml_set_packing_property (GladeXML *self,
79
GtkWidget *parent, GtkWidget *child,
80
const char *name, const char *value);
82
/* this function is called to build the interface by GladeXML */
83
GtkWidget *glade_xml_build_widget(GladeXML *self, GladeWidgetInfo *info);
85
/* this function is used to get a pointer to the internal child of a
86
* container widget. It would generally be called by the
87
* build_children callback for any children with the internal_child
89
void glade_xml_handle_internal_child(GladeXML *self, GtkWidget *parent,
90
GladeChildInfo *child_info);
92
/* This function performs half of what glade_xml_build_widget does. It is
93
* useful when the widget has already been created. Usually it would not
94
* have any use at all. */
95
void glade_xml_set_common_params(GladeXML *self,
97
GladeWidgetInfo *info);
99
gboolean glade_xml_set_value_from_string (GladeXML *xml,
104
GtkWidget *glade_standard_build_widget(GladeXML *xml, GType widget_type,
105
GladeWidgetInfo *info);
107
/* A standard child building routine that can be used in widget builders */
108
void glade_standard_build_children(GladeXML *self, GtkWidget *parent,
109
GladeWidgetInfo *info);
111
/* this is a wrapper for gtk_type_enum_find_value, that just returns the
112
* integer value for the enum */
113
gint glade_enum_from_string(GType type, const char *string);
114
guint glade_flags_from_string(GType type, const char *string);
116
/* the module dynamic loading interface ... */
118
/* increase this when there is a binary incompatible change in the
119
* libglade module API */
120
#define GLADE_MODULE_API_VERSION 1
121
gchar *glade_module_check_version(gint version);
123
#define GLADE_MODULE_CHECK_INIT \
124
G_MODULE_EXPORT const gchar *g_module_check_init(GModule *gmodule); \
126
g_module_check_init(GModule *gmodule) \
128
return glade_module_check_version(GLADE_MODULE_API_VERSION); \
131
/* prototype for plugin init function (should be implemented by plugin) */
132
G_MODULE_EXPORT void glade_module_register_widgets(void);