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, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GTK_WINDOW_H__
26#define __GTK_WINDOW_H__
27
28
29#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
30#error "Only <gtk/gtk.h> can be included directly."
31#endif
32
33#include <gtk/gtkapplication.h>
34#include <gtk/gtkaccelgroup.h>
35#include <gtk/gtkbin.h>
36
37G_BEGIN_DECLS
38
39#define GTK_TYPE_WINDOW (gtk_window_get_type ())
40#define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow))
41#define GTK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW, GtkWindowClass))
42#define GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW))
43#define GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW))
44#define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
45
46typedef struct _GtkWindowPrivate GtkWindowPrivate;
47typedef struct _GtkWindowClass GtkWindowClass;
48typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
49typedef struct _GtkWindowGroup GtkWindowGroup;
50typedef struct _GtkWindowGroupClass GtkWindowGroupClass;
51typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate;
52
53struct _GtkWindow
54{
55 GtkBin bin;
56
57 GtkWindowPrivate *priv;
58};
59
60/**
61 * GtkWindowClass:
62 * @parent_class: The parent class.
63 * @set_focus: Sets child as the focus widget for the window.
64 * @activate_focus: Activates the current focused widget within the window.
65 * @activate_default: Activates the default widget for the window.
66 * @keys_changed: Signal gets emitted when the set of accelerators or
67 * mnemonics that are associated with window changes.
68 * @enable_debugging: Class handler for the #GtkWindow::enable-debugging
69 * keybinding signal. Since: 3.14
70 */
71struct _GtkWindowClass
72{
73 GtkBinClass parent_class;
74
75 /*< public >*/
76
77 void (* set_focus) (GtkWindow *window,
78 GtkWidget *focus);
79
80 /* G_SIGNAL_ACTION signals for keybindings */
81
82 void (* activate_focus) (GtkWindow *window);
83 void (* activate_default) (GtkWindow *window);
84 void (* keys_changed) (GtkWindow *window);
85 gboolean (* enable_debugging) (GtkWindow *window,
86 gboolean toggle);
87
88 /*< private >*/
89
90 /* Padding for future expansion */
91 void (*_gtk_reserved1) (void);
92 void (*_gtk_reserved2) (void);
93 void (*_gtk_reserved3) (void);
94};
95
96/**
97 * GtkWindowType:
98 * @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
99 * @GTK_WINDOW_POPUP: A special window such as a tooltip.
100 *
101 * A #GtkWindow can be one of these types. Most things you’d consider a
102 * “window” should have type #GTK_WINDOW_TOPLEVEL; windows with this type
103 * are managed by the window manager and have a frame by default (call
104 * gtk_window_set_decorated() to toggle the frame). Windows with type
105 * #GTK_WINDOW_POPUP are ignored by the window manager; window manager
106 * keybindings won’t work on them, the window manager won’t decorate the
107 * window with a frame, many GTK+ features that rely on the window
108 * manager will not work (e.g. resize grips and
109 * maximization/minimization). #GTK_WINDOW_POPUP is used to implement
110 * widgets such as #GtkMenu or tooltips that you normally don’t think of
111 * as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL.
112 * In particular, do not use #GTK_WINDOW_POPUP just to turn off
113 * the window borders; use gtk_window_set_decorated() for that.
114 */
115typedef enum
116{
117 GTK_WINDOW_TOPLEVEL,
118 GTK_WINDOW_POPUP
119} GtkWindowType;
120
121/**
122 * GtkWindowPosition:
123 * @GTK_WIN_POS_NONE: No influence is made on placement.
124 * @GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
125 * @GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
126 * @GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc.
127 * @GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient
128 * parent (see gtk_window_set_transient_for()).
129 *
130 * Window placement can be influenced using this enumeration. Note that
131 * using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea.
132 * It won’t necessarily work well with all window managers or on all windowing systems.
133 */
134typedef enum
135{
136 GTK_WIN_POS_NONE,
137 GTK_WIN_POS_CENTER,
138 GTK_WIN_POS_MOUSE,
139 GTK_WIN_POS_CENTER_ALWAYS,
140 GTK_WIN_POS_CENTER_ON_PARENT
141} GtkWindowPosition;
142
143
144GDK_AVAILABLE_IN_ALL
145GType gtk_window_get_type (void) G_GNUC_CONST;
146GDK_AVAILABLE_IN_ALL
147GtkWidget* gtk_window_new (GtkWindowType type);
148GDK_AVAILABLE_IN_ALL
149void gtk_window_set_title (GtkWindow *window,
150 const gchar *title);
151GDK_AVAILABLE_IN_ALL
152const gchar * gtk_window_get_title (GtkWindow *window);
153GDK_DEPRECATED_IN_3_22
154void gtk_window_set_wmclass (GtkWindow *window,
155 const gchar *wmclass_name,
156 const gchar *wmclass_class);
157GDK_AVAILABLE_IN_ALL
158void gtk_window_set_role (GtkWindow *window,
159 const gchar *role);
160GDK_AVAILABLE_IN_ALL
161void gtk_window_set_startup_id (GtkWindow *window,
162 const gchar *startup_id);
163GDK_AVAILABLE_IN_ALL
164const gchar * gtk_window_get_role (GtkWindow *window);
165GDK_AVAILABLE_IN_ALL
166void gtk_window_add_accel_group (GtkWindow *window,
167 GtkAccelGroup *accel_group);
168GDK_AVAILABLE_IN_ALL
169void gtk_window_remove_accel_group (GtkWindow *window,
170 GtkAccelGroup *accel_group);
171GDK_AVAILABLE_IN_ALL
172void gtk_window_set_position (GtkWindow *window,
173 GtkWindowPosition position);
174GDK_AVAILABLE_IN_ALL
175gboolean gtk_window_activate_focus (GtkWindow *window);
176GDK_AVAILABLE_IN_ALL
177void gtk_window_set_focus (GtkWindow *window,
178 GtkWidget *focus);
179GDK_AVAILABLE_IN_ALL
180GtkWidget *gtk_window_get_focus (GtkWindow *window);
181GDK_AVAILABLE_IN_ALL
182void gtk_window_set_default (GtkWindow *window,
183 GtkWidget *default_widget);
184GDK_AVAILABLE_IN_ALL
185GtkWidget *gtk_window_get_default_widget (GtkWindow *window);
186GDK_AVAILABLE_IN_ALL
187gboolean gtk_window_activate_default (GtkWindow *window);
188
189GDK_AVAILABLE_IN_ALL
190void gtk_window_set_transient_for (GtkWindow *window,
191 GtkWindow *parent);
192GDK_AVAILABLE_IN_ALL
193GtkWindow *gtk_window_get_transient_for (GtkWindow *window);
194GDK_AVAILABLE_IN_3_4
195void gtk_window_set_attached_to (GtkWindow *window,
196 GtkWidget *attach_widget);
197GDK_AVAILABLE_IN_3_4
198GtkWidget *gtk_window_get_attached_to (GtkWindow *window);
199GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_set_opacity)
200void gtk_window_set_opacity (GtkWindow *window,
201 gdouble opacity);
202GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_get_opacity)
203gdouble gtk_window_get_opacity (GtkWindow *window);
204GDK_AVAILABLE_IN_ALL
205void gtk_window_set_type_hint (GtkWindow *window,
206 GdkWindowTypeHint hint);
207GDK_AVAILABLE_IN_ALL
208GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window);
209GDK_AVAILABLE_IN_ALL
210void gtk_window_set_skip_taskbar_hint (GtkWindow *window,
211 gboolean setting);
212GDK_AVAILABLE_IN_ALL
213gboolean gtk_window_get_skip_taskbar_hint (GtkWindow *window);
214GDK_AVAILABLE_IN_ALL
215void gtk_window_set_skip_pager_hint (GtkWindow *window,
216 gboolean setting);
217GDK_AVAILABLE_IN_ALL
218gboolean gtk_window_get_skip_pager_hint (GtkWindow *window);
219GDK_AVAILABLE_IN_ALL
220void gtk_window_set_urgency_hint (GtkWindow *window,
221 gboolean setting);
222GDK_AVAILABLE_IN_ALL
223gboolean gtk_window_get_urgency_hint (GtkWindow *window);
224GDK_AVAILABLE_IN_ALL
225void gtk_window_set_accept_focus (GtkWindow *window,
226 gboolean setting);
227GDK_AVAILABLE_IN_ALL
228gboolean gtk_window_get_accept_focus (GtkWindow *window);
229GDK_AVAILABLE_IN_ALL
230void gtk_window_set_focus_on_map (GtkWindow *window,
231 gboolean setting);
232GDK_AVAILABLE_IN_ALL
233gboolean gtk_window_get_focus_on_map (GtkWindow *window);
234GDK_AVAILABLE_IN_ALL
235void gtk_window_set_destroy_with_parent (GtkWindow *window,
236 gboolean setting);
237GDK_AVAILABLE_IN_ALL
238gboolean gtk_window_get_destroy_with_parent (GtkWindow *window);
239GDK_AVAILABLE_IN_3_4
240void gtk_window_set_hide_titlebar_when_maximized (GtkWindow *window,
241 gboolean setting);
242GDK_AVAILABLE_IN_3_4
243gboolean gtk_window_get_hide_titlebar_when_maximized (GtkWindow *window);
244GDK_AVAILABLE_IN_ALL
245void gtk_window_set_mnemonics_visible (GtkWindow *window,
246 gboolean setting);
247GDK_AVAILABLE_IN_ALL
248gboolean gtk_window_get_mnemonics_visible (GtkWindow *window);
249GDK_AVAILABLE_IN_3_2
250void gtk_window_set_focus_visible (GtkWindow *window,
251 gboolean setting);
252GDK_AVAILABLE_IN_3_2
253gboolean gtk_window_get_focus_visible (GtkWindow *window);
254
255GDK_AVAILABLE_IN_ALL
256void gtk_window_set_resizable (GtkWindow *window,
257 gboolean resizable);
258GDK_AVAILABLE_IN_ALL
259gboolean gtk_window_get_resizable (GtkWindow *window);
260
261GDK_AVAILABLE_IN_ALL
262void gtk_window_set_gravity (GtkWindow *window,
263 GdkGravity gravity);
264GDK_AVAILABLE_IN_ALL
265GdkGravity gtk_window_get_gravity (GtkWindow *window);
266
267
268GDK_AVAILABLE_IN_ALL
269void gtk_window_set_geometry_hints (GtkWindow *window,
270 GtkWidget *geometry_widget,
271 GdkGeometry *geometry,
272 GdkWindowHints geom_mask);
273
274GDK_AVAILABLE_IN_ALL
275void gtk_window_set_screen (GtkWindow *window,
276 GdkScreen *screen);
277GDK_AVAILABLE_IN_ALL
278GdkScreen* gtk_window_get_screen (GtkWindow *window);
279
280GDK_AVAILABLE_IN_ALL
281gboolean gtk_window_is_active (GtkWindow *window);
282GDK_AVAILABLE_IN_ALL
283gboolean gtk_window_has_toplevel_focus (GtkWindow *window);
284
285GDK_AVAILABLE_IN_ALL
286void gtk_window_set_decorated (GtkWindow *window,
287 gboolean setting);
288GDK_AVAILABLE_IN_ALL
289gboolean gtk_window_get_decorated (GtkWindow *window);
290GDK_AVAILABLE_IN_ALL
291void gtk_window_set_deletable (GtkWindow *window,
292 gboolean setting);
293GDK_AVAILABLE_IN_ALL
294gboolean gtk_window_get_deletable (GtkWindow *window);
295
296GDK_AVAILABLE_IN_ALL
297void gtk_window_set_icon_list (GtkWindow *window,
298 GList *list);
299GDK_AVAILABLE_IN_ALL
300GList* gtk_window_get_icon_list (GtkWindow *window);
301GDK_AVAILABLE_IN_ALL
302void gtk_window_set_icon (GtkWindow *window,
303 GdkPixbuf *icon);
304GDK_AVAILABLE_IN_ALL
305void gtk_window_set_icon_name (GtkWindow *window,
306 const gchar *name);
307GDK_AVAILABLE_IN_ALL
308gboolean gtk_window_set_icon_from_file (GtkWindow *window,
309 const gchar *filename,
310 GError **err);
311GDK_AVAILABLE_IN_ALL
312GdkPixbuf* gtk_window_get_icon (GtkWindow *window);
313GDK_AVAILABLE_IN_ALL
314const gchar * gtk_window_get_icon_name (GtkWindow *window);
315GDK_AVAILABLE_IN_ALL
316void gtk_window_set_default_icon_list (GList *list);
317GDK_AVAILABLE_IN_ALL
318GList* gtk_window_get_default_icon_list (void);
319GDK_AVAILABLE_IN_ALL
320void gtk_window_set_default_icon (GdkPixbuf *icon);
321GDK_AVAILABLE_IN_ALL
322void gtk_window_set_default_icon_name (const gchar *name);
323GDK_AVAILABLE_IN_ALL
324const gchar * gtk_window_get_default_icon_name (void);
325GDK_AVAILABLE_IN_ALL
326gboolean gtk_window_set_default_icon_from_file (const gchar *filename,
327 GError **err);
328
329GDK_AVAILABLE_IN_ALL
330void gtk_window_set_auto_startup_notification (gboolean setting);
331
332/* If window is set modal, input will be grabbed when show and released when hide */
333GDK_AVAILABLE_IN_ALL
334void gtk_window_set_modal (GtkWindow *window,
335 gboolean modal);
336GDK_AVAILABLE_IN_ALL
337gboolean gtk_window_get_modal (GtkWindow *window);
338GDK_AVAILABLE_IN_ALL
339GList* gtk_window_list_toplevels (void);
340GDK_AVAILABLE_IN_ALL
341void gtk_window_set_has_user_ref_count (GtkWindow *window,
342 gboolean setting);
343
344GDK_AVAILABLE_IN_ALL
345void gtk_window_add_mnemonic (GtkWindow *window,
346 guint keyval,
347 GtkWidget *target);
348GDK_AVAILABLE_IN_ALL
349void gtk_window_remove_mnemonic (GtkWindow *window,
350 guint keyval,
351 GtkWidget *target);
352GDK_AVAILABLE_IN_ALL
353gboolean gtk_window_mnemonic_activate (GtkWindow *window,
354 guint keyval,
355 GdkModifierType modifier);
356GDK_AVAILABLE_IN_ALL
357void gtk_window_set_mnemonic_modifier (GtkWindow *window,
358 GdkModifierType modifier);
359GDK_AVAILABLE_IN_ALL
360GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window);
361
362GDK_AVAILABLE_IN_ALL
363gboolean gtk_window_activate_key (GtkWindow *window,
364 GdkEventKey *event);
365GDK_AVAILABLE_IN_ALL
366gboolean gtk_window_propagate_key_event (GtkWindow *window,
367 GdkEventKey *event);
368
369GDK_AVAILABLE_IN_ALL
370void gtk_window_present (GtkWindow *window);
371GDK_AVAILABLE_IN_ALL
372void gtk_window_present_with_time (GtkWindow *window,
373 guint32 timestamp);
374GDK_AVAILABLE_IN_ALL
375void gtk_window_iconify (GtkWindow *window);
376GDK_AVAILABLE_IN_ALL
377void gtk_window_deiconify (GtkWindow *window);
378GDK_AVAILABLE_IN_ALL
379void gtk_window_stick (GtkWindow *window);
380GDK_AVAILABLE_IN_ALL
381void gtk_window_unstick (GtkWindow *window);
382GDK_AVAILABLE_IN_ALL
383void gtk_window_maximize (GtkWindow *window);
384GDK_AVAILABLE_IN_ALL
385void gtk_window_unmaximize (GtkWindow *window);
386GDK_AVAILABLE_IN_ALL
387void gtk_window_fullscreen (GtkWindow *window);
388GDK_AVAILABLE_IN_ALL
389void gtk_window_unfullscreen (GtkWindow *window);
390GDK_AVAILABLE_IN_3_18
391void gtk_window_fullscreen_on_monitor(GtkWindow *window,
392 GdkScreen *screen,
393 gint monitor);
394GDK_AVAILABLE_IN_3_10
395void gtk_window_close (GtkWindow *window);
396GDK_AVAILABLE_IN_ALL
397void gtk_window_set_keep_above (GtkWindow *window, gboolean setting);
398GDK_AVAILABLE_IN_ALL
399void gtk_window_set_keep_below (GtkWindow *window, gboolean setting);
400
401GDK_AVAILABLE_IN_ALL
402void gtk_window_begin_resize_drag (GtkWindow *window,
403 GdkWindowEdge edge,
404 gint button,
405 gint root_x,
406 gint root_y,
407 guint32 timestamp);
408GDK_AVAILABLE_IN_ALL
409void gtk_window_begin_move_drag (GtkWindow *window,
410 gint button,
411 gint root_x,
412 gint root_y,
413 guint32 timestamp);
414
415/* Set initial default size of the window (does not constrain user
416 * resize operations)
417 */
418GDK_AVAILABLE_IN_ALL
419void gtk_window_set_default_size (GtkWindow *window,
420 gint width,
421 gint height);
422GDK_AVAILABLE_IN_ALL
423void gtk_window_get_default_size (GtkWindow *window,
424 gint *width,
425 gint *height);
426GDK_AVAILABLE_IN_ALL
427void gtk_window_resize (GtkWindow *window,
428 gint width,
429 gint height);
430GDK_AVAILABLE_IN_ALL
431void gtk_window_get_size (GtkWindow *window,
432 gint *width,
433 gint *height);
434GDK_AVAILABLE_IN_ALL
435void gtk_window_move (GtkWindow *window,
436 gint x,
437 gint y);
438GDK_AVAILABLE_IN_ALL
439void gtk_window_get_position (GtkWindow *window,
440 gint *root_x,
441 gint *root_y);
442GDK_DEPRECATED_IN_3_20
443gboolean gtk_window_parse_geometry (GtkWindow *window,
444 const gchar *geometry);
445
446GDK_DEPRECATED_IN_3_20_FOR(gtk_window_set_default_size)
447void gtk_window_set_default_geometry (GtkWindow *window,
448 gint width,
449 gint height);
450GDK_DEPRECATED_IN_3_20_FOR(gtk_window_resize)
451void gtk_window_resize_to_geometry (GtkWindow *window,
452 gint width,
453 gint height);
454
455GDK_AVAILABLE_IN_ALL
456GtkWindowGroup *gtk_window_get_group (GtkWindow *window);
457GDK_AVAILABLE_IN_ALL
458gboolean gtk_window_has_group (GtkWindow *window);
459
460/* Ignore this unless you are writing a GUI builder */
461GDK_DEPRECATED_IN_3_10
462void gtk_window_reshow_with_initial_size (GtkWindow *window);
463
464GDK_AVAILABLE_IN_ALL
465GtkWindowType gtk_window_get_window_type (GtkWindow *window);
466
467
468GDK_AVAILABLE_IN_ALL
469GtkApplication *gtk_window_get_application (GtkWindow *window);
470GDK_AVAILABLE_IN_ALL
471void gtk_window_set_application (GtkWindow *window,
472 GtkApplication *application);
473
474
475/* Window grips
476 */
477GDK_DEPRECATED_IN_3_14
478void gtk_window_set_has_resize_grip (GtkWindow *window,
479 gboolean value);
480GDK_DEPRECATED_IN_3_14
481gboolean gtk_window_get_has_resize_grip (GtkWindow *window);
482GDK_DEPRECATED_IN_3_14
483gboolean gtk_window_resize_grip_is_visible (GtkWindow *window);
484GDK_DEPRECATED_IN_3_14
485gboolean gtk_window_get_resize_grip_area (GtkWindow *window,
486 GdkRectangle *rect);
487
488GDK_AVAILABLE_IN_3_10
489void gtk_window_set_titlebar (GtkWindow *window,
490 GtkWidget *titlebar);
491GDK_AVAILABLE_IN_3_16
492GtkWidget *gtk_window_get_titlebar (GtkWindow *window);
493
494GDK_AVAILABLE_IN_3_12
495gboolean gtk_window_is_maximized (GtkWindow *window);
496
497GDK_AVAILABLE_IN_3_14
498void gtk_window_set_interactive_debugging (gboolean enable);
499
500G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWindow, g_object_unref)
501G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWindowGroup, g_object_unref)
502
503G_END_DECLS
504
505#endif /* __GTK_WINDOW_H__ */
506

source code of include/gtk-3.0/gtk/gtkwindow.h