]> Pileus Git - ~andy/gtk/blob - gtk/gtkwindow.h
set_decorations_hint and set_functions_hint were still in the header
[~andy/gtk] / gtk / gtkwindow.h
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 #include <gdk/gdk.h>
32 #include <gtk/gtkaccelgroup.h>
33 #include <gtk/gtkbin.h>
34 #include <gtk/gtkenums.h>
35 #include <gtk/gtkwidget.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41
42 #define GTK_TYPE_WINDOW                 (gtk_window_get_type ())
43 #define GTK_WINDOW(obj)                 (GTK_CHECK_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow))
44 #define GTK_WINDOW_CLASS(klass)         (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW, GtkWindowClass))
45 #define GTK_IS_WINDOW(obj)              (GTK_CHECK_TYPE ((obj), GTK_TYPE_WINDOW))
46 #define GTK_IS_WINDOW_CLASS(klass)      (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW))
47 #define GTK_WINDOW_GET_CLASS(obj)       (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
48
49
50 typedef struct _GtkWindow             GtkWindow;
51 typedef struct _GtkWindowClass        GtkWindowClass;
52 typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
53
54 struct _GtkWindow
55 {
56   GtkBin bin;
57
58   gchar *title;
59   gchar *wmclass_name;
60   gchar *wmclass_class;
61   gchar *wm_role;
62
63   GtkWidget *focus_widget;
64   GtkWidget *default_widget;
65   GtkWindow *transient_parent;
66   GtkWindowGeometryInfo *geometry_info;
67   GdkWindow *frame;
68
69   guint16 resize_count;
70
71   GtkWindowType type : 4;
72   guint has_user_ref_count : 1;
73   guint has_focus : 1;
74   guint allow_shrink : 1;
75   guint allow_grow : 1;
76   guint auto_shrink : 1;
77   guint handling_resize : 1;
78   guint position : 2;
79
80   /* The following flag is initially TRUE when a window is mapped.
81    * and will be set to FALSE after it is first positioned.
82    * It is also temporarily reset when the window's size changes.
83    * 
84    * When TRUE, we move the window to the position the app set.
85    */
86   guint use_uposition : 1;
87   guint modal : 1;
88   guint destroy_with_parent : 1;
89   
90   guint has_frame : 1;
91
92   /* gtk_window_iconify() called before realization */
93   guint iconify_initially : 1;
94   guint stick_initially : 1;
95   guint maximize_initially : 1;
96   guint decorated : 1;
97   
98   GdkWindowTypeHint type_hint : 3;
99   GdkGravity gravity : 5;
100   
101   guint frame_left;
102   guint frame_top;
103   guint frame_right;
104   guint frame_bottom;
105   
106   GdkModifierType mnemonic_modifier;
107 };
108
109 struct _GtkWindowClass
110 {
111   GtkBinClass parent_class;
112
113   void     (* set_focus)   (GtkWindow *window,
114                             GtkWidget *focus);
115   gboolean (* frame_event) (GtkWidget *widget,
116                             GdkEvent  *event);
117
118   /* G_SIGNAL_ACTION signals for keybindings */
119
120   void     (* activate_focus)          (GtkWindow       *window);
121   void     (* activate_default)        (GtkWindow       *window);
122   void     (* move_focus)              (GtkWindow       *window,
123                                         GtkDirectionType direction);  
124 };
125
126
127 GtkType    gtk_window_get_type                 (void) G_GNUC_CONST;
128 GtkWidget* gtk_window_new                      (GtkWindowType        type);
129 void       gtk_window_set_title                (GtkWindow           *window,
130                                                 const gchar         *title);
131 void       gtk_window_set_wmclass              (GtkWindow           *window,
132                                                 const gchar         *wmclass_name,
133                                                 const gchar         *wmclass_class);
134 void       gtk_window_set_role                 (GtkWindow           *window,
135                                                 const gchar         *role);
136 void       gtk_window_add_accel_group          (GtkWindow           *window,
137                                                 GtkAccelGroup       *accel_group);
138 void       gtk_window_remove_accel_group       (GtkWindow           *window,
139                                                 GtkAccelGroup       *accel_group);
140 void       gtk_window_set_position             (GtkWindow           *window,
141                                                 GtkWindowPosition    position);
142 gboolean   gtk_window_activate_focus           (GtkWindow           *window);
143 gboolean   gtk_window_activate_default         (GtkWindow           *window);
144
145 void       gtk_window_set_transient_for        (GtkWindow           *window, 
146                                                 GtkWindow           *parent);
147 void       gtk_window_set_type_hint            (GtkWindow           *window, 
148                                                 GdkWindowTypeHint    hint);
149 void       gtk_window_set_destroy_with_parent  (GtkWindow           *window,
150                                                 gboolean             setting);
151
152 void       gtk_window_set_resizeable           (GtkWindow           *window,
153                                                 gboolean             resizeable);
154 gboolean   gtk_window_get_resizeable           (GtkWindow           *window);
155
156 void       gtk_window_set_gravity              (GtkWindow           *window,
157                                                 GdkGravity           gravity);
158 GdkGravity gtk_window_get_gravity              (GtkWindow           *window);
159
160
161 void       gtk_window_set_geometry_hints       (GtkWindow           *window,
162                                                 GtkWidget           *geometry_widget,
163                                                 GdkGeometry         *geometry,
164                                                 GdkWindowHints       geom_mask);
165
166 /* gtk_window_set_has_frame () must be called before realizing the window_*/
167 void       gtk_window_set_has_frame            (GtkWindow *window);
168 void       gtk_window_set_frame_dimensions     (GtkWindow *window, 
169                                                 gint       left,
170                                                 gint       top,
171                                                 gint       right,
172                                                 gint       bottom);
173
174 void       gtk_window_set_decorated           (GtkWindow *window,
175                                                gboolean   setting);
176
177 /* If window is set modal, input will be grabbed when show and released when hide */
178 void       gtk_window_set_modal                (GtkWindow           *window,
179                                                 gboolean             modal);
180 GList*     gtk_window_list_toplevels           (void);
181
182 void     gtk_window_add_mnemonic          (GtkWindow       *window,
183                                            guint            keyval,
184                                            GtkWidget       *target);
185 void     gtk_window_remove_mnemonic       (GtkWindow       *window,
186                                            guint            keyval,
187                                            GtkWidget       *target);
188 gboolean gtk_window_mnemonic_activate     (GtkWindow       *window,
189                                            guint            keyval,
190                                            GdkModifierType  modifier);
191 void     gtk_window_set_mnemonic_modifier (GtkWindow       *window,
192                                            GdkModifierType  modifier);
193
194 void     gtk_window_present       (GtkWindow *window);
195 void     gtk_window_iconify       (GtkWindow *window);
196 void     gtk_window_deiconify     (GtkWindow *window);
197 void     gtk_window_stick         (GtkWindow *window);
198 void     gtk_window_unstick       (GtkWindow *window);
199 void     gtk_window_maximize      (GtkWindow *window);
200 void     gtk_window_unmaximize    (GtkWindow *window);
201
202 void gtk_window_begin_resize_drag (GtkWindow     *window,
203                                    GdkWindowEdge  edge,
204                                    gint           button,
205                                    gint           root_x,
206                                    gint           root_y,
207                                    guint32        timestamp);
208 void gtk_window_begin_move_drag   (GtkWindow     *window,
209                                    gint           button,
210                                    gint           root_x,
211                                    gint           root_y,
212                                    guint32        timestamp);
213
214 #ifndef GTK_DISABLE_DEPRECATED
215 void       gtk_window_set_policy               (GtkWindow           *window,
216                                                 gint                 allow_shrink,
217                                                 gint                 allow_grow,
218                                                 gint                 auto_shrink);
219 /* The following differs from gtk_widget_set_usize, in that
220  * gtk_widget_set_usize() overrides the requisition, so sets a minimum
221  * size, while this only sets the size requested from the WM.
222  */
223 void       gtk_window_set_default_size         (GtkWindow           *window,
224                                                 gint                 width,
225                                                 gint                 height);
226 #endif
227
228 /* --- internal functions --- */
229 void       gtk_window_set_focus                (GtkWindow           *window,
230                                                 GtkWidget           *focus);
231 void       gtk_window_set_default              (GtkWindow           *window,
232                                                 GtkWidget           *defaultw);
233 void       gtk_window_remove_embedded_xid      (GtkWindow           *window,
234                                                 guint                xid);
235 void       gtk_window_add_embedded_xid         (GtkWindow           *window,
236                                                 guint                xid);
237 void       _gtk_window_reposition              (GtkWindow           *window,
238                                                 gint                 x,
239                                                 gint                 y);
240 void       _gtk_window_constrain_size          (GtkWindow           *window,
241                                                 gint                 width,
242                                                 gint                 height,
243                                                 gint                *new_width,
244                                                 gint                *new_height);
245
246 #ifdef __cplusplus
247 }
248 #endif /* __cplusplus */
249
250
251 #endif /* __GTK_WINDOW_H__ */