1 | /* Gnome panel: basep widget |
---|
2 | * (C) 1997 the Free Software Foundation |
---|
3 | * |
---|
4 | * Authors: George Lebl |
---|
5 | * Jacob Berkman |
---|
6 | */ |
---|
7 | #ifndef BASEP_WIDGET_H |
---|
8 | #define BASEP_WIDGET_H |
---|
9 | |
---|
10 | #include "panel-widget.h" |
---|
11 | |
---|
12 | BEGIN_GNOME_DECLS |
---|
13 | |
---|
14 | #define TYPE_BASEP_WIDGET (basep_widget_get_type ()) |
---|
15 | #define BASEP_WIDGET(o) (GTK_CHECK_CAST((o), TYPE_BASEP_WIDGET, BasePWidget)) |
---|
16 | #define BASEP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST((k), TYPE_BASEP_WIDGET, BasePWidgetClass)) |
---|
17 | #define IS_BASEP_WIDGET(o) (GTK_CHECK_TYPE((o), TYPE_BASEP_WIDGET)) |
---|
18 | #define IS_BASEP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), TYPE_BASEP_WIDGET)) |
---|
19 | |
---|
20 | #define TYPE_BASEP_POS (basep_pos_get_type ()) |
---|
21 | #define BASEP_POS(o) (GTK_CHECK_CAST((o), TYPE_BASEP_POS, BasePPos)) |
---|
22 | #define BASEP_POS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), TYPE_BASEP_POS, BasePPosClass)) |
---|
23 | #define IS_BASEP_POS(o) (GTK_CHECK_TYPE((o), TYPE_BASEP_POS)) |
---|
24 | #define IS_BASEP_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), TYPE_BASEP_POS)) |
---|
25 | |
---|
26 | typedef struct _BasePWidget BasePWidget; |
---|
27 | typedef struct _BasePWidgetClass BasePWidgetClass; |
---|
28 | |
---|
29 | typedef struct _BasePPos BasePPos; |
---|
30 | typedef struct _BasePPosClass BasePPosClass; |
---|
31 | |
---|
32 | typedef enum { |
---|
33 | BASEP_EXPLICIT_HIDE, |
---|
34 | BASEP_AUTO_HIDE |
---|
35 | } BasePMode; |
---|
36 | |
---|
37 | typedef enum { |
---|
38 | BASEP_SHOWN, |
---|
39 | BASEP_MOVING, |
---|
40 | BASEP_AUTO_HIDDEN, |
---|
41 | BASEP_HIDDEN_LEFT, |
---|
42 | BASEP_HIDDEN_RIGHT |
---|
43 | } BasePState; |
---|
44 | |
---|
45 | typedef enum { |
---|
46 | BASEP_LEVEL_DEFAULT, |
---|
47 | BASEP_LEVEL_ABOVE, |
---|
48 | BASEP_LEVEL_NORMAL, |
---|
49 | BASEP_LEVEL_BELOW |
---|
50 | } BasePLevel; |
---|
51 | |
---|
52 | struct _BasePWidget |
---|
53 | { |
---|
54 | GtkWindow window; |
---|
55 | GtkAllocation shown_alloc; |
---|
56 | |
---|
57 | int screen; |
---|
58 | |
---|
59 | GtkWidget *ebox; |
---|
60 | |
---|
61 | GtkWidget *panel; |
---|
62 | |
---|
63 | GtkWidget *table; |
---|
64 | GtkWidget *hidebutton_n; |
---|
65 | GtkWidget *hidebutton_e; |
---|
66 | GtkWidget *hidebutton_w; |
---|
67 | GtkWidget *hidebutton_s; |
---|
68 | |
---|
69 | GtkWidget *frame; |
---|
70 | GtkWidget *innerebox; |
---|
71 | |
---|
72 | BasePPos *pos; |
---|
73 | |
---|
74 | BasePMode mode; |
---|
75 | BasePState state; |
---|
76 | BasePLevel level; |
---|
77 | gboolean avoid_on_maximize; |
---|
78 | |
---|
79 | gboolean hidebuttons_enabled; |
---|
80 | gboolean hidebutton_pixmaps_enabled; |
---|
81 | |
---|
82 | int enter_notify_timer_tag; |
---|
83 | int leave_notify_timer_tag; |
---|
84 | gboolean autohide_inhibit; |
---|
85 | int drawers_open; |
---|
86 | |
---|
87 | gboolean request_cube; |
---|
88 | gboolean keep_in_screen; |
---|
89 | |
---|
90 | gboolean compliant_wm; |
---|
91 | |
---|
92 | /* drag offsets, where the panel was clicked when started |
---|
93 | * to be moved */ |
---|
94 | int offset_x; |
---|
95 | int offset_y; |
---|
96 | }; |
---|
97 | |
---|
98 | struct _BasePWidgetClass |
---|
99 | { |
---|
100 | GtkWindowClass parent_class; |
---|
101 | |
---|
102 | /* signals */ |
---|
103 | /*FIXME: perhaps the type_change signal should be implemented |
---|
104 | so that we don't have to handle the update_config_type in menu.c |
---|
105 | but in panel.c along with the other update stuff */ |
---|
106 | /*void (*type_change) (BasePWidget *basep, |
---|
107 | PanelType type);*/ |
---|
108 | |
---|
109 | void (* mode_change) (BasePWidget *basep, |
---|
110 | BasePMode mode); |
---|
111 | |
---|
112 | void (* state_change) (BasePWidget *basep, |
---|
113 | BasePState state); |
---|
114 | |
---|
115 | void (* screen_change) (BasePWidget *basep, |
---|
116 | int screen); |
---|
117 | |
---|
118 | }; |
---|
119 | |
---|
120 | /* we mostly want the class for this */ |
---|
121 | struct _BasePPos { |
---|
122 | GtkObject object; |
---|
123 | |
---|
124 | BasePWidget *basep; |
---|
125 | }; |
---|
126 | |
---|
127 | struct _BasePPosClass { |
---|
128 | GtkObjectClass parent_class; |
---|
129 | |
---|
130 | /* virtual functions */ |
---|
131 | void (*set_hidebuttons) (BasePWidget *basep); |
---|
132 | |
---|
133 | void (*update_winhints) (BasePWidget *basep); |
---|
134 | |
---|
135 | PanelOrientType |
---|
136 | (*get_applet_orient) (BasePWidget *basep); |
---|
137 | |
---|
138 | void (*set_pos) (BasePWidget *basep, |
---|
139 | int x, int y, |
---|
140 | int w, int h, |
---|
141 | gboolean force); |
---|
142 | |
---|
143 | void (*get_pos) (BasePWidget *basep, |
---|
144 | int *x, int *y, |
---|
145 | int w, int h); |
---|
146 | |
---|
147 | void (*get_size) (BasePWidget *basep, |
---|
148 | int *w, int *h); |
---|
149 | |
---|
150 | PanelOrientType (*get_hide_orient) (BasePWidget *basep); |
---|
151 | |
---|
152 | void (*get_hide_size) (BasePWidget *basep, |
---|
153 | PanelOrientType hide_orient, |
---|
154 | int *w, int *h); |
---|
155 | |
---|
156 | void (*get_hide_pos) (BasePWidget *basep, |
---|
157 | PanelOrientType hide_orient, |
---|
158 | int *x, int *y, |
---|
159 | int w, int h); |
---|
160 | |
---|
161 | void (*get_menu_pos) (BasePWidget *basep, |
---|
162 | GtkWidget *widget, |
---|
163 | GtkRequisition *mreq, |
---|
164 | int *x, int *y, |
---|
165 | int wx, int wy, |
---|
166 | int ww, int wh); |
---|
167 | |
---|
168 | void (*realize) (GtkWidget *widget); |
---|
169 | |
---|
170 | void (*north_clicked) (BasePWidget *basep); |
---|
171 | void (*south_clicked) (BasePWidget *basep); |
---|
172 | void (*east_clicked) (BasePWidget *basep); |
---|
173 | void (*west_clicked) (BasePWidget *basep); |
---|
174 | |
---|
175 | void (*pre_convert_hook) (BasePWidget *basep); |
---|
176 | }; |
---|
177 | |
---|
178 | GtkType basep_pos_get_type (void) G_GNUC_CONST; |
---|
179 | GtkType basep_widget_get_type (void) G_GNUC_CONST; |
---|
180 | GtkWidget* basep_widget_construct (BasePWidget *basep, |
---|
181 | gboolean packed, |
---|
182 | gboolean reverse_arrows, |
---|
183 | int screen, |
---|
184 | PanelOrientation orient, |
---|
185 | int sz, |
---|
186 | BasePMode mode, |
---|
187 | BasePState state, |
---|
188 | BasePLevel level, |
---|
189 | gboolean avoid_on_maximize, |
---|
190 | gboolean hidebuttons_enabled, |
---|
191 | gboolean hidebutton_pixmaps_enabled, |
---|
192 | PanelBackType back_type, |
---|
193 | char *back_pixmap, |
---|
194 | gboolean fit_pixmap_bg, |
---|
195 | gboolean strech_pixmap_bg, |
---|
196 | gboolean rotate_pixmap_bg, |
---|
197 | GdkColor *back_color); |
---|
198 | |
---|
199 | /* changing parameters */ |
---|
200 | void basep_widget_change_params (BasePWidget *basep, |
---|
201 | int screen, |
---|
202 | PanelOrientation orient, |
---|
203 | int sz, |
---|
204 | BasePMode mode, |
---|
205 | BasePState state, |
---|
206 | BasePLevel level, |
---|
207 | gboolean avoid_on_maximize, |
---|
208 | gboolean hidebuttons_enabled, |
---|
209 | gboolean hidebutton_pixmaps_enabled, |
---|
210 | PanelBackType back_type, |
---|
211 | char *pixmap_name, |
---|
212 | gboolean fit_pixmap_bg, |
---|
213 | gboolean strech_pixmap_bg, |
---|
214 | gboolean rotate_pixmap_bg, |
---|
215 | GdkColor *back_color); |
---|
216 | |
---|
217 | /*gboolean basep_widget_convert_to (BasePWidget *basep, |
---|
218 | PanelType type);*/ |
---|
219 | |
---|
220 | void basep_widget_enable_buttons_ (BasePWidget *basep, |
---|
221 | gboolean enabled); |
---|
222 | |
---|
223 | #define basep_widget_enable_buttons(basep) \ |
---|
224 | (basep_widget_enable_buttons_ ((basep),TRUE)) |
---|
225 | |
---|
226 | #define basep_widget_disable_buttons(basep) \ |
---|
227 | (basep_widget_enable_buttons_ ((basep),FALSE)) |
---|
228 | |
---|
229 | void basep_widget_set_hidebuttons (BasePWidget *basep); |
---|
230 | void basep_widget_update_winhints (BasePWidget *basep); |
---|
231 | |
---|
232 | /*autohide*/ |
---|
233 | gboolean basep_widget_autoshow (gpointer data); |
---|
234 | gboolean basep_widget_autohide (gpointer data); |
---|
235 | |
---|
236 | /*queue an autohide*/ |
---|
237 | void basep_widget_queue_autoshow (BasePWidget *basep); |
---|
238 | void basep_widget_queue_autohide (BasePWidget *basep); |
---|
239 | |
---|
240 | /*explicit hiding*/ |
---|
241 | void basep_widget_explicit_hide (BasePWidget *basep, |
---|
242 | BasePState hidestate); |
---|
243 | void basep_widget_explicit_show (BasePWidget *basep); |
---|
244 | |
---|
245 | void basep_widget_do_hiding (BasePWidget *basep, |
---|
246 | PanelOrientType hide_orient, |
---|
247 | int leftover, |
---|
248 | int step); |
---|
249 | |
---|
250 | void basep_widget_do_showing (BasePWidget *basep, |
---|
251 | PanelOrientType hide_orient, |
---|
252 | int leftover, |
---|
253 | int step); |
---|
254 | |
---|
255 | void basep_widget_get_position (BasePWidget *basep, |
---|
256 | PanelOrientType hide_orient, |
---|
257 | int *x, int *y, |
---|
258 | int w, int h); |
---|
259 | |
---|
260 | void basep_widget_get_menu_pos (BasePWidget *basep, |
---|
261 | GtkWidget *menu, |
---|
262 | int *x, int *y, |
---|
263 | int wx, int wy, |
---|
264 | int ww, int wh); |
---|
265 | |
---|
266 | PanelOrientType basep_widget_get_applet_orient (BasePWidget *basep); |
---|
267 | |
---|
268 | /* initialize drag offsets according to cursor */ |
---|
269 | void basep_widget_init_offsets (BasePWidget *basep); |
---|
270 | |
---|
271 | void basep_widget_set_pos (BasePWidget *basep, |
---|
272 | int x, int y); |
---|
273 | |
---|
274 | void basep_widget_get_pos (BasePWidget *basep, |
---|
275 | int *x, int *y); |
---|
276 | |
---|
277 | void basep_widget_get_size (BasePWidget *basep, |
---|
278 | int *w, int *h); |
---|
279 | |
---|
280 | PanelOrientType basep_widget_get_hide_orient (BasePWidget *basep); |
---|
281 | |
---|
282 | /* |
---|
283 | void basep_widget_get_hide_size (BasePWidget *basep, |
---|
284 | PanelOrientType hide_orient, |
---|
285 | int *w, int *h); |
---|
286 | |
---|
287 | void basep_widget_get_hide_pos (BasePWidget *basep, |
---|
288 | PanelOrientType hide_orient, |
---|
289 | int *w, int *h); |
---|
290 | */ |
---|
291 | |
---|
292 | void basep_widget_pre_convert_hook (BasePWidget *basep); |
---|
293 | |
---|
294 | void basep_widget_set_state (BasePWidget *basep, |
---|
295 | BasePState state, |
---|
296 | gboolean emit); |
---|
297 | void basep_widget_screen_change (BasePWidget *basep, |
---|
298 | int screen); |
---|
299 | |
---|
300 | void basep_update_frame (BasePWidget *basep); |
---|
301 | |
---|
302 | /* redo the widget->window based on new compliancy setting */ |
---|
303 | void basep_widget_redo_window (BasePWidget *basep); |
---|
304 | |
---|
305 | /* -1 means don't set, caller will not get queue resized as optimization */ |
---|
306 | |
---|
307 | void basep_border_recalc (int screen); |
---|
308 | void basep_border_queue_recalc (int screen); |
---|
309 | void basep_border_get (int screen, |
---|
310 | BorderEdge edge, |
---|
311 | int *left, |
---|
312 | int *center, |
---|
313 | int *right); |
---|
314 | |
---|
315 | #define GNOME_PANEL_HINTS (WIN_HINTS_SKIP_FOCUS|WIN_HINTS_SKIP_WINLIST|WIN_HINTS_SKIP_TASKBAR) |
---|
316 | |
---|
317 | END_GNOME_DECLS |
---|
318 | |
---|
319 | #endif /* __BASEP_WIDGET_H__ */ |
---|