1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /* |
---|
3 | * bonobo-ui-xml.h: A module for merging, overlaying and de-merging XML |
---|
4 | * |
---|
5 | * Author: |
---|
6 | * Michael Meeks (michael@helixcode.com) |
---|
7 | * |
---|
8 | * Copyright 2000 Helix Code, Inc. |
---|
9 | */ |
---|
10 | #ifndef _BONOBO_UI_XML_H_ |
---|
11 | #define _BONOBO_UI_XML_H_ |
---|
12 | |
---|
13 | #include <gtk/gtkobject.h> |
---|
14 | #include <bonobo/bonobo-ui-node.h> |
---|
15 | #include <bonobo/bonobo-ui-engine.h> |
---|
16 | |
---|
17 | #define BONOBO_UI_XML_TYPE (bonobo_ui_xml_get_type ()) |
---|
18 | #define BONOBO_UI_XML(o) (GTK_CHECK_CAST ((o), BONOBO_UI_XML_TYPE, BonoboUIXml)) |
---|
19 | #define BONOBO_UI_XML_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BONOBO_UI_XML_TYPE, BonoboUIXmlClass)) |
---|
20 | #define BONOBO_IS_UI_XML(o) (GTK_CHECK_TYPE ((o), BONOBO_UI_XML_TYPE)) |
---|
21 | #define BONOBO_IS_UI_XML_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_UI_XML_TYPE)) |
---|
22 | |
---|
23 | typedef struct _BonoboUIXml BonoboUIXml; |
---|
24 | |
---|
25 | typedef struct { |
---|
26 | gpointer id; |
---|
27 | gboolean dirty; |
---|
28 | GSList *overridden; |
---|
29 | } BonoboUIXmlData; |
---|
30 | |
---|
31 | typedef gboolean (*BonoboUIXmlCompareFn) (gpointer id_a, |
---|
32 | gpointer id_b); |
---|
33 | typedef BonoboUIXmlData *(*BonoboUIXmlDataNewFn) (void); |
---|
34 | typedef void (*BonoboUIXmlDataFreeFn) (BonoboUIXmlData *data); |
---|
35 | typedef void (*BonoboUIXmlDumpFn) (BonoboUIXml *tree, |
---|
36 | BonoboUINode *node); |
---|
37 | typedef void (*BonoboUIXmlAddNode) (BonoboUINode *parent, |
---|
38 | BonoboUINode *child, |
---|
39 | gpointer user_data); |
---|
40 | typedef void (*BonoboUIXmlWatchFn) (BonoboUIXml *xml, |
---|
41 | const char *path, |
---|
42 | BonoboUINode *opt_node, |
---|
43 | gpointer user_data); |
---|
44 | |
---|
45 | struct _BonoboUIXml { |
---|
46 | GtkObject object; |
---|
47 | |
---|
48 | BonoboUIXmlCompareFn compare; |
---|
49 | BonoboUIXmlDataNewFn data_new; |
---|
50 | BonoboUIXmlDataFreeFn data_free; |
---|
51 | BonoboUIXmlDumpFn dump; |
---|
52 | BonoboUIXmlAddNode add_node; |
---|
53 | BonoboUIXmlWatchFn watch; |
---|
54 | gpointer user_data; |
---|
55 | |
---|
56 | BonoboUINode *root; |
---|
57 | |
---|
58 | GSList *watches; |
---|
59 | }; |
---|
60 | |
---|
61 | typedef struct { |
---|
62 | GtkObjectClass object_klass; |
---|
63 | |
---|
64 | void (*override) (BonoboUINode *new_node, |
---|
65 | BonoboUINode *old_node); |
---|
66 | void (*replace_override) (BonoboUINode *new_node, |
---|
67 | BonoboUINode *old_node); |
---|
68 | void (*reinstate) (BonoboUINode *node); |
---|
69 | void (*rename) (BonoboUINode *node); |
---|
70 | void (*remove) (BonoboUINode *node); |
---|
71 | |
---|
72 | gpointer dummy; |
---|
73 | } BonoboUIXmlClass; |
---|
74 | |
---|
75 | GtkType bonobo_ui_xml_get_type (void); |
---|
76 | |
---|
77 | BonoboUIXml *bonobo_ui_xml_new (BonoboUIXmlCompareFn compare, |
---|
78 | BonoboUIXmlDataNewFn data_new, |
---|
79 | BonoboUIXmlDataFreeFn data_free, |
---|
80 | BonoboUIXmlDumpFn dump, |
---|
81 | BonoboUIXmlAddNode add_node, |
---|
82 | gpointer user_data); |
---|
83 | |
---|
84 | /* Nominaly BonoboUIXmlData * */ |
---|
85 | gpointer bonobo_ui_xml_get_data (BonoboUIXml *tree, |
---|
86 | BonoboUINode *node); |
---|
87 | |
---|
88 | void bonobo_ui_xml_set_dirty (BonoboUIXml *tree, |
---|
89 | BonoboUINode *node); |
---|
90 | |
---|
91 | void bonobo_ui_xml_clean (BonoboUIXml *tree, |
---|
92 | BonoboUINode *node); |
---|
93 | |
---|
94 | BonoboUINode *bonobo_ui_xml_get_path (BonoboUIXml *tree, |
---|
95 | const char *path); |
---|
96 | BonoboUINode *bonobo_ui_xml_get_path_wildcard (BonoboUIXml *tree, |
---|
97 | const char *path, |
---|
98 | gboolean *wildcard); |
---|
99 | |
---|
100 | char *bonobo_ui_xml_make_path (BonoboUINode *node); |
---|
101 | char *bonobo_ui_xml_get_parent_path (const char *path); |
---|
102 | |
---|
103 | BonoboUIError bonobo_ui_xml_merge (BonoboUIXml *tree, |
---|
104 | const char *path, |
---|
105 | BonoboUINode *nodes, |
---|
106 | gpointer id); |
---|
107 | |
---|
108 | BonoboUIError bonobo_ui_xml_rm (BonoboUIXml *tree, |
---|
109 | const char *path, |
---|
110 | gpointer id); |
---|
111 | |
---|
112 | void bonobo_ui_xml_dump (BonoboUIXml *tree, |
---|
113 | BonoboUINode *node, |
---|
114 | const char *msg); |
---|
115 | |
---|
116 | void bonobo_ui_xml_set_watch_fn (BonoboUIXml *tree, |
---|
117 | BonoboUIXmlWatchFn watch); |
---|
118 | |
---|
119 | void bonobo_ui_xml_add_watch (BonoboUIXml *tree, |
---|
120 | const char *path, |
---|
121 | gpointer user_data); |
---|
122 | |
---|
123 | void bonobo_ui_xml_remove_watch_by_data (BonoboUIXml *tree, |
---|
124 | gpointer user_data); |
---|
125 | |
---|
126 | #endif /* _BONOBO_UI_XML_H_ */ |
---|