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> |
---|
4 | * |
---|
5 | * glade-xml.h: public interface of libglade library |
---|
6 | * |
---|
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. |
---|
11 | * |
---|
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. |
---|
16 | * |
---|
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. |
---|
21 | */ |
---|
22 | #ifndef GLADE_XML_H |
---|
23 | #define GLADE_XML_H |
---|
24 | |
---|
25 | #include <glib.h> |
---|
26 | #include <gtk/gtkwidget.h> |
---|
27 | #include <gtk/gtktooltips.h> |
---|
28 | |
---|
29 | G_BEGIN_DECLS |
---|
30 | |
---|
31 | #define GLADE_TYPE_XML (glade_xml_get_type()) |
---|
32 | #define GLADE_XML(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_XML, GladeXML)) |
---|
33 | #define GLADE_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_XML, GladeXMLClass)) |
---|
34 | #define GLADE_IS_XML(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_XML)) |
---|
35 | #define GLADE_IS_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GLADE_TYPE_XML)) |
---|
36 | #define GLADE_XML_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GLADE_TYPE_XML, GladeXMLClass)) |
---|
37 | |
---|
38 | typedef struct _GladeXML GladeXML; |
---|
39 | typedef struct _GladeXMLClass GladeXMLClass; |
---|
40 | typedef struct _GladeXMLPrivate GladeXMLPrivate; |
---|
41 | |
---|
42 | struct _GladeXML { |
---|
43 | /* <public> */ |
---|
44 | GObject parent; |
---|
45 | |
---|
46 | char *filename; |
---|
47 | |
---|
48 | /* <private> */ |
---|
49 | GladeXMLPrivate *priv; |
---|
50 | }; |
---|
51 | |
---|
52 | struct _GladeXMLClass { |
---|
53 | GObjectClass parent_class; |
---|
54 | |
---|
55 | /* Virtual function: gets the appropriate gtype for the typename.*/ |
---|
56 | GType (* lookup_type) (GladeXML*self, const char *gtypename); |
---|
57 | }; |
---|
58 | |
---|
59 | GType glade_xml_get_type (void); |
---|
60 | GladeXML *glade_xml_new (const char *fname, const char *root, |
---|
61 | const char *domain); |
---|
62 | GladeXML *glade_xml_new_from_buffer (const char *buffer, int size, |
---|
63 | const char *root, |
---|
64 | const char *domain); |
---|
65 | gboolean glade_xml_construct (GladeXML *self, const char *fname, |
---|
66 | const char *root, |
---|
67 | const char *domain); |
---|
68 | |
---|
69 | void glade_xml_signal_connect (GladeXML *self, |
---|
70 | const char *handlername, |
---|
71 | GCallback func); |
---|
72 | void glade_xml_signal_connect_data (GladeXML *self, |
---|
73 | const char *handlername, |
---|
74 | GCallback func, |
---|
75 | gpointer user_data); |
---|
76 | /* |
---|
77 | * use gmodule to connect signals automatically. Basically a symbol with |
---|
78 | * the name of the signal handler is searched for, and that is connected to |
---|
79 | * the associated symbols. So setting gtk_main_quit as a signal handler |
---|
80 | * for the destroy signal of a window will do what you expect. |
---|
81 | */ |
---|
82 | void glade_xml_signal_autoconnect (GladeXML *self); |
---|
83 | |
---|
84 | /* if the gtk_signal_connect_object behaviour is required, connect_object |
---|
85 | * will point to the object, otherwise it will be NULL. |
---|
86 | */ |
---|
87 | typedef void (*GladeXMLConnectFunc) (const gchar *handler_name, |
---|
88 | GObject *object, |
---|
89 | const gchar *signal_name, |
---|
90 | const gchar *signal_data, |
---|
91 | GObject *connect_object, |
---|
92 | gboolean after, |
---|
93 | gpointer user_data); |
---|
94 | |
---|
95 | /* |
---|
96 | * These two are to make it easier to use libglade with an interpreted |
---|
97 | * language binding. |
---|
98 | */ |
---|
99 | void glade_xml_signal_connect_full (GladeXML *self, |
---|
100 | const gchar *handler_name, |
---|
101 | GladeXMLConnectFunc func, |
---|
102 | gpointer user_data); |
---|
103 | |
---|
104 | void glade_xml_signal_autoconnect_full (GladeXML *self, |
---|
105 | GladeXMLConnectFunc func, |
---|
106 | gpointer user_data); |
---|
107 | |
---|
108 | |
---|
109 | GtkWidget *glade_xml_get_widget (GladeXML *self, |
---|
110 | const char *name); |
---|
111 | GList *glade_xml_get_widget_prefix (GladeXML *self, |
---|
112 | const char *name); |
---|
113 | |
---|
114 | gchar *glade_xml_relative_file (GladeXML *self, |
---|
115 | const gchar *filename); |
---|
116 | |
---|
117 | /* don't free the results of these two ... */ |
---|
118 | const char *glade_get_widget_name (GtkWidget *widget); |
---|
119 | GladeXML *glade_get_widget_tree (GtkWidget *widget); |
---|
120 | |
---|
121 | |
---|
122 | /* interface for changing the custom widget handling */ |
---|
123 | typedef GtkWidget *(* GladeXMLCustomWidgetHandler) (GladeXML *xml, |
---|
124 | gchar *func_name, |
---|
125 | gchar *name, |
---|
126 | gchar *string1, |
---|
127 | gchar *string2, |
---|
128 | gint int1, |
---|
129 | gint int2, |
---|
130 | gpointer user_data); |
---|
131 | |
---|
132 | void glade_set_custom_handler(GladeXMLCustomWidgetHandler handler, |
---|
133 | gpointer user_data); |
---|
134 | |
---|
135 | #ifndef LIBGLADE_DISABLE_DEPRECATED |
---|
136 | #define glade_xml_new_with_domain glade_xml_new |
---|
137 | #define glade_xml_new_from_memory glade_xml_new_from_buffer |
---|
138 | #endif |
---|
139 | |
---|
140 | G_END_DECLS |
---|
141 | |
---|
142 | #endif |
---|
143 | |
---|