1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /* |
---|
3 | * bonobo-ui-sync.h: An abstract base for Bonobo XML / widget sync sync'ing. |
---|
4 | * |
---|
5 | * Author: |
---|
6 | * Michael Meeks (michael@helixcode.com) |
---|
7 | * |
---|
8 | * Copyright 2000 Helix Code, Inc. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef _BONOBO_UI_SYNC_H_ |
---|
12 | #define _BONOBO_UI_SYNC_H_ |
---|
13 | |
---|
14 | #include <stdio.h> |
---|
15 | #include <libgnome/gnome-defs.h> |
---|
16 | #include <gtk/gtkcontainer.h> |
---|
17 | #include <bonobo/bonobo-ui-node.h> |
---|
18 | |
---|
19 | typedef struct _BonoboUISync BonoboUISync; |
---|
20 | |
---|
21 | #include <bonobo/bonobo-ui-engine.h> |
---|
22 | |
---|
23 | BEGIN_GNOME_DECLS |
---|
24 | |
---|
25 | #define BONOBO_TYPE_UI_SYNC (bonobo_ui_sync_get_type ()) |
---|
26 | #define BONOBO_UI_SYNC(obj) (GTK_CHECK_CAST ((obj), BONOBO_TYPE_UI_SYNC, BonoboUISync)) |
---|
27 | #define BONOBO_UI_SYNC_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_UI_SYNC, BonoboUISyncClass)) |
---|
28 | #define BONOBO_IS_UI_SYNC(obj) (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_UI_SYNC)) |
---|
29 | #define BONOBO_IS_UI_SYNC_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), BONOBO_TYPE_UI_SYNC)) |
---|
30 | |
---|
31 | typedef void (*BonoboUISyncStateFn) (BonoboUISync *sync, |
---|
32 | BonoboUINode *node, |
---|
33 | BonoboUINode *cmd_node, |
---|
34 | GtkWidget *widget, |
---|
35 | GtkWidget *parent); |
---|
36 | |
---|
37 | typedef GtkWidget *(*BonoboUISyncBuildFn) (BonoboUISync *sync, |
---|
38 | BonoboUINode *node, |
---|
39 | BonoboUINode *cmd_node, |
---|
40 | int *pos, |
---|
41 | GtkWidget *parent); |
---|
42 | |
---|
43 | typedef struct _BonoboUISyncPrivate BonoboUISyncPrivate; |
---|
44 | |
---|
45 | struct _BonoboUISync { |
---|
46 | GtkObject parent; |
---|
47 | |
---|
48 | BonoboUIEngine *engine; |
---|
49 | gboolean is_recursive; |
---|
50 | gboolean has_widgets; |
---|
51 | |
---|
52 | BonoboUISyncPrivate *priv; |
---|
53 | }; |
---|
54 | |
---|
55 | typedef struct { |
---|
56 | GtkObjectClass parent_class; |
---|
57 | |
---|
58 | BonoboUISyncStateFn sync_state; |
---|
59 | BonoboUISyncStateFn sync_state_placeholder; |
---|
60 | BonoboUISyncBuildFn build; |
---|
61 | BonoboUISyncBuildFn build_placeholder; |
---|
62 | |
---|
63 | void (*update_root) (BonoboUISync *sync, |
---|
64 | BonoboUINode *root); |
---|
65 | |
---|
66 | void (*remove_root) (BonoboUISync *sync, |
---|
67 | BonoboUINode *root); |
---|
68 | |
---|
69 | GList *(*get_widgets) (BonoboUISync *sync, |
---|
70 | BonoboUINode *node); |
---|
71 | |
---|
72 | void (*state_update) (BonoboUISync *sync, |
---|
73 | GtkWidget *widget, |
---|
74 | const char *new_state); |
---|
75 | |
---|
76 | gboolean (*ignore_widget) (BonoboUISync *sync, |
---|
77 | GtkWidget *widget); |
---|
78 | |
---|
79 | gboolean (*can_handle) (BonoboUISync *sync, |
---|
80 | BonoboUINode *node); |
---|
81 | |
---|
82 | void (*stamp_root) (BonoboUISync *sync); |
---|
83 | |
---|
84 | GtkWidget *(*get_attached) (BonoboUISync *sync, |
---|
85 | GtkWidget *widget, |
---|
86 | BonoboUINode *node); |
---|
87 | } BonoboUISyncClass; |
---|
88 | |
---|
89 | GtkType bonobo_ui_sync_get_type (void); |
---|
90 | BonoboUISync *bonobo_ui_sync_construct (BonoboUISync *sync, |
---|
91 | BonoboUIEngine *engine, |
---|
92 | gboolean is_recursive, |
---|
93 | gboolean has_widgets); |
---|
94 | |
---|
95 | gboolean bonobo_ui_sync_is_recursive (BonoboUISync *sync); |
---|
96 | gboolean bonobo_ui_sync_has_widgets (BonoboUISync *sync); |
---|
97 | |
---|
98 | void bonobo_ui_sync_remove_root (BonoboUISync *sync, |
---|
99 | BonoboUINode *root); |
---|
100 | void bonobo_ui_sync_update_root (BonoboUISync *sync, |
---|
101 | BonoboUINode *root); |
---|
102 | |
---|
103 | void bonobo_ui_sync_state (BonoboUISync *sync, |
---|
104 | BonoboUINode *node, |
---|
105 | BonoboUINode *cmd_node, |
---|
106 | GtkWidget *widget, |
---|
107 | GtkWidget *parent); |
---|
108 | void bonobo_ui_sync_state_placeholder (BonoboUISync *sync, |
---|
109 | BonoboUINode *node, |
---|
110 | BonoboUINode *cmd_node, |
---|
111 | GtkWidget *widget, |
---|
112 | GtkWidget *parent); |
---|
113 | |
---|
114 | GtkWidget *bonobo_ui_sync_build (BonoboUISync *sync, |
---|
115 | BonoboUINode *node, |
---|
116 | BonoboUINode *cmd_node, |
---|
117 | int *pos, |
---|
118 | GtkWidget *parent); |
---|
119 | GtkWidget *bonobo_ui_sync_build_placeholder (BonoboUISync *sync, |
---|
120 | BonoboUINode *node, |
---|
121 | BonoboUINode *cmd_node, |
---|
122 | int *pos, |
---|
123 | GtkWidget *parent); |
---|
124 | |
---|
125 | gboolean bonobo_ui_sync_ignore_widget (BonoboUISync *sync, |
---|
126 | GtkWidget *widget); |
---|
127 | |
---|
128 | GList *bonobo_ui_sync_get_widgets (BonoboUISync *sync, |
---|
129 | BonoboUINode *node); |
---|
130 | |
---|
131 | void bonobo_ui_sync_stamp_root (BonoboUISync *sync); |
---|
132 | |
---|
133 | gboolean bonobo_ui_sync_can_handle (BonoboUISync *sync, |
---|
134 | BonoboUINode *node); |
---|
135 | |
---|
136 | GtkWidget *bonobo_ui_sync_get_attached (BonoboUISync *sync, |
---|
137 | GtkWidget *widget, |
---|
138 | BonoboUINode *node); |
---|
139 | |
---|
140 | void bonobo_ui_sync_state_update (BonoboUISync *sync, |
---|
141 | GtkWidget *widget, |
---|
142 | const char *new_state); |
---|
143 | |
---|
144 | gboolean bonobo_ui_sync_do_show_hide (BonoboUISync *sync, |
---|
145 | BonoboUINode *node, |
---|
146 | BonoboUINode *cmd_node, |
---|
147 | GtkWidget *widget); |
---|
148 | |
---|
149 | /* |
---|
150 | * These are to allow you to remove certain types of Sync |
---|
151 | * from a bonobo-window to allow full sub-classing of that. |
---|
152 | * Do not use to instantiate syncs manualy or to sub-class. |
---|
153 | */ |
---|
154 | GtkType bonobo_ui_sync_keys_get_type (void); |
---|
155 | GtkType bonobo_ui_sync_menu_get_type (void); |
---|
156 | GtkType bonobo_ui_sync_status_get_type (void); |
---|
157 | GtkType bonobo_ui_sync_toolbar_get_type (void); |
---|
158 | |
---|
159 | END_GNOME_DECLS |
---|
160 | |
---|
161 | #endif /* _BONOBO_UI_SYNC_H_ */ |
---|