1 | /* GTK - The GIMP Toolkit |
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library; if not, write to the |
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. |
18 | */ |
19 | |
20 | /* |
21 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
22 | * file for a list of people on the GTK+ Team. See the ChangeLog |
23 | * files for a list of changes. These files are distributed with |
24 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
25 | */ |
26 | |
27 | #ifndef __GTK_WINDOW_H__ |
28 | #define __GTK_WINDOW_H__ |
29 | |
30 | |
31 | #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
32 | #error "Only <gtk/gtk.h> can be included directly." |
33 | #endif |
34 | |
35 | #include <gtk/gtkaccelgroup.h> |
36 | #include <gtk/gtkbin.h> |
37 | |
38 | |
39 | G_BEGIN_DECLS |
40 | |
41 | #define GTK_TYPE_WINDOW (gtk_window_get_type ()) |
42 | #define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow)) |
43 | #define GTK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW, GtkWindowClass)) |
44 | #define GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW)) |
45 | #define GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW)) |
46 | #define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass)) |
47 | |
48 | |
49 | typedef struct _GtkWindowClass GtkWindowClass; |
50 | typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo; |
51 | typedef struct _GtkWindowGroup GtkWindowGroup; |
52 | typedef struct _GtkWindowGroupClass GtkWindowGroupClass; |
53 | |
54 | struct _GtkWindow |
55 | { |
56 | GtkBin bin; |
57 | |
58 | gchar *GSEAL (title); |
59 | gchar *GSEAL (wmclass_name); |
60 | gchar *GSEAL (wmclass_class); |
61 | gchar *GSEAL (wm_role); |
62 | |
63 | GtkWidget *GSEAL (focus_widget); |
64 | GtkWidget *GSEAL (default_widget); |
65 | GtkWindow *GSEAL (transient_parent); |
66 | GtkWindowGeometryInfo *GSEAL (geometry_info); |
67 | GdkWindow *GSEAL (frame); |
68 | GtkWindowGroup *GSEAL (group); |
69 | |
70 | guint16 GSEAL (configure_request_count); |
71 | guint GSEAL (allow_shrink) : 1; |
72 | guint GSEAL (allow_grow) : 1; |
73 | guint GSEAL (configure_notify_received) : 1; |
74 | /* The following flags are initially TRUE (before a window is mapped). |
75 | * They cause us to compute a configure request that involves |
76 | * default-only parameters. Once mapped, we set them to FALSE. |
77 | * Then we set them to TRUE again on unmap (for position) |
78 | * and on unrealize (for size). |
79 | */ |
80 | guint GSEAL (need_default_position) : 1; |
81 | guint GSEAL (need_default_size) : 1; |
82 | guint GSEAL (position) : 3; |
83 | guint GSEAL (type) : 4; /* GtkWindowType */ |
84 | guint GSEAL (has_user_ref_count) : 1; |
85 | guint GSEAL (has_focus) : 1; |
86 | |
87 | guint GSEAL (modal) : 1; |
88 | guint GSEAL (destroy_with_parent) : 1; |
89 | |
90 | guint GSEAL (has_frame) : 1; |
91 | |
92 | /* gtk_window_iconify() called before realization */ |
93 | guint GSEAL (iconify_initially) : 1; |
94 | guint GSEAL (stick_initially) : 1; |
95 | guint GSEAL (maximize_initially) : 1; |
96 | guint GSEAL (decorated) : 1; |
97 | |
98 | guint GSEAL (type_hint) : 3; /* GdkWindowTypeHint if the hint is one of the original eight. If not, then |
99 | * it contains GDK_WINDOW_TYPE_HINT_NORMAL |
100 | */ |
101 | guint GSEAL (gravity) : 5; /* GdkGravity */ |
102 | |
103 | guint GSEAL (is_active) : 1; |
104 | guint GSEAL (has_toplevel_focus) : 1; |
105 | |
106 | guint GSEAL (frame_left); |
107 | guint GSEAL (frame_top); |
108 | guint GSEAL (frame_right); |
109 | guint GSEAL (frame_bottom); |
110 | |
111 | guint GSEAL (keys_changed_handler); |
112 | |
113 | GdkModifierType GSEAL (mnemonic_modifier); |
114 | GdkScreen *GSEAL (screen); |
115 | }; |
116 | |
117 | struct _GtkWindowClass |
118 | { |
119 | GtkBinClass parent_class; |
120 | |
121 | void (* set_focus) (GtkWindow *window, |
122 | GtkWidget *focus); |
123 | gboolean (* frame_event) (GtkWindow *window, |
124 | GdkEvent *event); |
125 | |
126 | /* G_SIGNAL_ACTION signals for keybindings */ |
127 | |
128 | void (* activate_focus) (GtkWindow *window); |
129 | void (* activate_default) (GtkWindow *window); |
130 | |
131 | /* as of GTK+ 2.12 the "move-focus" signal has been moved to GtkWidget, |
132 | * so this is merley a virtual function now. Overriding it in subclasses |
133 | * continues to work though. |
134 | */ |
135 | void (* move_focus) (GtkWindow *window, |
136 | GtkDirectionType direction); |
137 | |
138 | void (*keys_changed) (GtkWindow *window); |
139 | |
140 | /* Padding for future expansion */ |
141 | void (*_gtk_reserved1) (void); |
142 | void (*_gtk_reserved2) (void); |
143 | void (*_gtk_reserved3) (void); |
144 | void (*_gtk_reserved4) (void); |
145 | }; |
146 | |
147 | #define GTK_TYPE_WINDOW_GROUP (gtk_window_group_get_type ()) |
148 | #define GTK_WINDOW_GROUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_WINDOW_GROUP, GtkWindowGroup)) |
149 | #define GTK_WINDOW_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW_GROUP, GtkWindowGroupClass)) |
150 | #define GTK_IS_WINDOW_GROUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_WINDOW_GROUP)) |
151 | #define GTK_IS_WINDOW_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW_GROUP)) |
152 | #define GTK_WINDOW_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW_GROUP, GtkWindowGroupClass)) |
153 | |
154 | struct _GtkWindowGroup |
155 | { |
156 | GObject parent_instance; |
157 | |
158 | GSList *GSEAL (grabs); |
159 | }; |
160 | |
161 | struct _GtkWindowGroupClass |
162 | { |
163 | GObjectClass parent_class; |
164 | |
165 | /* Padding for future expansion */ |
166 | void (*_gtk_reserved1) (void); |
167 | void (*_gtk_reserved2) (void); |
168 | void (*_gtk_reserved3) (void); |
169 | void (*_gtk_reserved4) (void); |
170 | }; |
171 | |
172 | #ifdef G_OS_WIN32 |
173 | /* Reserve old names for DLL ABI backward compatibility */ |
174 | #define gtk_window_set_icon_from_file gtk_window_set_icon_from_file_utf8 |
175 | #define gtk_window_set_default_icon_from_file gtk_window_set_default_icon_from_file_utf8 |
176 | #endif |
177 | |
178 | GType gtk_window_get_type (void) G_GNUC_CONST; |
179 | GtkWidget* gtk_window_new (GtkWindowType type); |
180 | void gtk_window_set_title (GtkWindow *window, |
181 | const gchar *title); |
182 | const gchar *gtk_window_get_title (GtkWindow *window); |
183 | void gtk_window_set_wmclass (GtkWindow *window, |
184 | const gchar *wmclass_name, |
185 | const gchar *wmclass_class); |
186 | void gtk_window_set_role (GtkWindow *window, |
187 | const gchar *role); |
188 | void gtk_window_set_startup_id (GtkWindow *window, |
189 | const gchar *startup_id); |
190 | const gchar *gtk_window_get_role (GtkWindow *window); |
191 | void gtk_window_add_accel_group (GtkWindow *window, |
192 | GtkAccelGroup *accel_group); |
193 | void gtk_window_remove_accel_group (GtkWindow *window, |
194 | GtkAccelGroup *accel_group); |
195 | void gtk_window_set_position (GtkWindow *window, |
196 | GtkWindowPosition position); |
197 | gboolean gtk_window_activate_focus (GtkWindow *window); |
198 | void gtk_window_set_focus (GtkWindow *window, |
199 | GtkWidget *focus); |
200 | GtkWidget *gtk_window_get_focus (GtkWindow *window); |
201 | void gtk_window_set_default (GtkWindow *window, |
202 | GtkWidget *default_widget); |
203 | GtkWidget *gtk_window_get_default_widget (GtkWindow *window); |
204 | gboolean gtk_window_activate_default (GtkWindow *window); |
205 | |
206 | void gtk_window_set_transient_for (GtkWindow *window, |
207 | GtkWindow *parent); |
208 | GtkWindow *gtk_window_get_transient_for (GtkWindow *window); |
209 | void gtk_window_set_opacity (GtkWindow *window, |
210 | gdouble opacity); |
211 | gdouble gtk_window_get_opacity (GtkWindow *window); |
212 | void gtk_window_set_type_hint (GtkWindow *window, |
213 | GdkWindowTypeHint hint); |
214 | GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window); |
215 | void gtk_window_set_skip_taskbar_hint (GtkWindow *window, |
216 | gboolean setting); |
217 | gboolean gtk_window_get_skip_taskbar_hint (GtkWindow *window); |
218 | void (GtkWindow *window, |
219 | gboolean setting); |
220 | gboolean (GtkWindow *window); |
221 | void gtk_window_set_urgency_hint (GtkWindow *window, |
222 | gboolean setting); |
223 | gboolean gtk_window_get_urgency_hint (GtkWindow *window); |
224 | void gtk_window_set_accept_focus (GtkWindow *window, |
225 | gboolean setting); |
226 | gboolean gtk_window_get_accept_focus (GtkWindow *window); |
227 | void gtk_window_set_focus_on_map (GtkWindow *window, |
228 | gboolean setting); |
229 | gboolean gtk_window_get_focus_on_map (GtkWindow *window); |
230 | void gtk_window_set_destroy_with_parent (GtkWindow *window, |
231 | gboolean setting); |
232 | gboolean gtk_window_get_destroy_with_parent (GtkWindow *window); |
233 | void gtk_window_set_mnemonics_visible (GtkWindow *window, |
234 | gboolean setting); |
235 | gboolean gtk_window_get_mnemonics_visible (GtkWindow *window); |
236 | |
237 | void gtk_window_set_resizable (GtkWindow *window, |
238 | gboolean resizable); |
239 | gboolean gtk_window_get_resizable (GtkWindow *window); |
240 | |
241 | void gtk_window_set_gravity (GtkWindow *window, |
242 | GdkGravity gravity); |
243 | GdkGravity gtk_window_get_gravity (GtkWindow *window); |
244 | |
245 | |
246 | void gtk_window_set_geometry_hints (GtkWindow *window, |
247 | GtkWidget *geometry_widget, |
248 | GdkGeometry *geometry, |
249 | GdkWindowHints geom_mask); |
250 | |
251 | void gtk_window_set_screen (GtkWindow *window, |
252 | GdkScreen *screen); |
253 | GdkScreen* gtk_window_get_screen (GtkWindow *window); |
254 | |
255 | gboolean gtk_window_is_active (GtkWindow *window); |
256 | gboolean gtk_window_has_toplevel_focus (GtkWindow *window); |
257 | |
258 | |
259 | #ifndef GTK_DISABLE_DEPRECATED |
260 | /* gtk_window_set_has_frame () must be called before realizing the window_*/ |
261 | void gtk_window_set_has_frame (GtkWindow *window, |
262 | gboolean setting); |
263 | gboolean gtk_window_get_has_frame (GtkWindow *window); |
264 | void gtk_window_set_frame_dimensions (GtkWindow *window, |
265 | gint left, |
266 | gint top, |
267 | gint right, |
268 | gint bottom); |
269 | void gtk_window_get_frame_dimensions (GtkWindow *window, |
270 | gint *left, |
271 | gint *top, |
272 | gint *right, |
273 | gint *bottom); |
274 | #endif |
275 | void gtk_window_set_decorated (GtkWindow *window, |
276 | gboolean setting); |
277 | gboolean gtk_window_get_decorated (GtkWindow *window); |
278 | void gtk_window_set_deletable (GtkWindow *window, |
279 | gboolean setting); |
280 | gboolean gtk_window_get_deletable (GtkWindow *window); |
281 | |
282 | void gtk_window_set_icon_list (GtkWindow *window, |
283 | GList *list); |
284 | GList* gtk_window_get_icon_list (GtkWindow *window); |
285 | void gtk_window_set_icon (GtkWindow *window, |
286 | GdkPixbuf *icon); |
287 | void gtk_window_set_icon_name (GtkWindow *window, |
288 | const gchar *name); |
289 | gboolean gtk_window_set_icon_from_file (GtkWindow *window, |
290 | const gchar *filename, |
291 | GError **err); |
292 | GdkPixbuf* gtk_window_get_icon (GtkWindow *window); |
293 | const gchar * |
294 | gtk_window_get_icon_name (GtkWindow *window); |
295 | void gtk_window_set_default_icon_list (GList *list); |
296 | GList* gtk_window_get_default_icon_list (void); |
297 | void gtk_window_set_default_icon (GdkPixbuf *icon); |
298 | void gtk_window_set_default_icon_name (const gchar *name); |
299 | const gchar * |
300 | gtk_window_get_default_icon_name (void); |
301 | gboolean gtk_window_set_default_icon_from_file (const gchar *filename, |
302 | GError **err); |
303 | |
304 | void gtk_window_set_auto_startup_notification (gboolean setting); |
305 | |
306 | /* If window is set modal, input will be grabbed when show and released when hide */ |
307 | void gtk_window_set_modal (GtkWindow *window, |
308 | gboolean modal); |
309 | gboolean gtk_window_get_modal (GtkWindow *window); |
310 | GList* gtk_window_list_toplevels (void); |
311 | |
312 | void gtk_window_add_mnemonic (GtkWindow *window, |
313 | guint keyval, |
314 | GtkWidget *target); |
315 | void gtk_window_remove_mnemonic (GtkWindow *window, |
316 | guint keyval, |
317 | GtkWidget *target); |
318 | gboolean gtk_window_mnemonic_activate (GtkWindow *window, |
319 | guint keyval, |
320 | GdkModifierType modifier); |
321 | void gtk_window_set_mnemonic_modifier (GtkWindow *window, |
322 | GdkModifierType modifier); |
323 | GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window); |
324 | |
325 | gboolean gtk_window_activate_key (GtkWindow *window, |
326 | GdkEventKey *event); |
327 | gboolean gtk_window_propagate_key_event (GtkWindow *window, |
328 | GdkEventKey *event); |
329 | |
330 | void gtk_window_present (GtkWindow *window); |
331 | void gtk_window_present_with_time (GtkWindow *window, |
332 | guint32 timestamp); |
333 | void gtk_window_iconify (GtkWindow *window); |
334 | void gtk_window_deiconify (GtkWindow *window); |
335 | void gtk_window_stick (GtkWindow *window); |
336 | void gtk_window_unstick (GtkWindow *window); |
337 | void gtk_window_maximize (GtkWindow *window); |
338 | void gtk_window_unmaximize (GtkWindow *window); |
339 | void gtk_window_fullscreen (GtkWindow *window); |
340 | void gtk_window_unfullscreen (GtkWindow *window); |
341 | void gtk_window_set_keep_above (GtkWindow *window, gboolean setting); |
342 | void gtk_window_set_keep_below (GtkWindow *window, gboolean setting); |
343 | |
344 | void gtk_window_begin_resize_drag (GtkWindow *window, |
345 | GdkWindowEdge edge, |
346 | gint button, |
347 | gint root_x, |
348 | gint root_y, |
349 | guint32 timestamp); |
350 | void gtk_window_begin_move_drag (GtkWindow *window, |
351 | gint button, |
352 | gint root_x, |
353 | gint root_y, |
354 | guint32 timestamp); |
355 | |
356 | #ifndef GTK_DISABLE_DEPRECATED |
357 | void gtk_window_set_policy (GtkWindow *window, |
358 | gint allow_shrink, |
359 | gint allow_grow, |
360 | gint auto_shrink); |
361 | #define gtk_window_position gtk_window_set_position |
362 | #endif /* GTK_DISABLE_DEPRECATED */ |
363 | |
364 | /* Set initial default size of the window (does not constrain user |
365 | * resize operations) |
366 | */ |
367 | void gtk_window_set_default_size (GtkWindow *window, |
368 | gint width, |
369 | gint height); |
370 | void gtk_window_get_default_size (GtkWindow *window, |
371 | gint *width, |
372 | gint *height); |
373 | void gtk_window_resize (GtkWindow *window, |
374 | gint width, |
375 | gint height); |
376 | void gtk_window_get_size (GtkWindow *window, |
377 | gint *width, |
378 | gint *height); |
379 | void gtk_window_move (GtkWindow *window, |
380 | gint x, |
381 | gint y); |
382 | void gtk_window_get_position (GtkWindow *window, |
383 | gint *root_x, |
384 | gint *root_y); |
385 | gboolean gtk_window_parse_geometry (GtkWindow *window, |
386 | const gchar *geometry); |
387 | GtkWindowGroup *gtk_window_get_group (GtkWindow *window); |
388 | gboolean gtk_window_has_group (GtkWindow *window); |
389 | |
390 | /* Ignore this unless you are writing a GUI builder */ |
391 | void gtk_window_reshow_with_initial_size (GtkWindow *window); |
392 | |
393 | GtkWindowType gtk_window_get_window_type (GtkWindow *window); |
394 | |
395 | /* Window groups |
396 | */ |
397 | GType gtk_window_group_get_type (void) G_GNUC_CONST; |
398 | |
399 | GtkWindowGroup * gtk_window_group_new (void); |
400 | void gtk_window_group_add_window (GtkWindowGroup *window_group, |
401 | GtkWindow *window); |
402 | void gtk_window_group_remove_window (GtkWindowGroup *window_group, |
403 | GtkWindow *window); |
404 | GList * gtk_window_group_list_windows (GtkWindowGroup *window_group); |
405 | |
406 | |
407 | /* --- internal functions --- */ |
408 | void _gtk_window_internal_set_focus (GtkWindow *window, |
409 | GtkWidget *focus); |
410 | void gtk_window_remove_embedded_xid (GtkWindow *window, |
411 | GdkNativeWindow xid); |
412 | void gtk_window_add_embedded_xid (GtkWindow *window, |
413 | GdkNativeWindow xid); |
414 | void _gtk_window_reposition (GtkWindow *window, |
415 | gint x, |
416 | gint y); |
417 | void _gtk_window_constrain_size (GtkWindow *window, |
418 | gint width, |
419 | gint height, |
420 | gint *new_width, |
421 | gint *new_height); |
422 | GtkWidget *gtk_window_group_get_current_grab (GtkWindowGroup *window_group); |
423 | |
424 | void _gtk_window_set_has_toplevel_focus (GtkWindow *window, |
425 | gboolean has_toplevel_focus); |
426 | void _gtk_window_unset_focus_and_default (GtkWindow *window, |
427 | GtkWidget *widget); |
428 | |
429 | void _gtk_window_set_is_active (GtkWindow *window, |
430 | gboolean is_active); |
431 | |
432 | void _gtk_window_set_is_toplevel (GtkWindow *window, |
433 | gboolean is_toplevel); |
434 | |
435 | typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window, |
436 | guint keyval, |
437 | GdkModifierType modifiers, |
438 | gboolean is_mnemonic, |
439 | gpointer data); |
440 | |
441 | void _gtk_window_keys_foreach (GtkWindow *window, |
442 | GtkWindowKeysForeachFunc func, |
443 | gpointer func_data); |
444 | |
445 | /* --- internal (GtkAcceleratable) --- */ |
446 | gboolean _gtk_window_query_nonaccels (GtkWindow *window, |
447 | guint accel_key, |
448 | GdkModifierType accel_mods); |
449 | |
450 | G_END_DECLS |
451 | |
452 | #endif /* __GTK_WINDOW_H__ */ |
453 | |