]> Pileus Git - ~andy/gtk/blob - gtk/gtkwindow.h
create some stock buttons with the default accel group (create_image):
[~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
53 struct _GtkWindow
54 {
55   GtkBin bin;
56
57   gchar *title;
58   gchar *wmclass_name;
59   gchar *wmclass_class;
60   GtkWindowType type;
61
62   GtkWidget *focus_widget;
63   GtkWidget *default_widget;
64   GtkWindow *transient_parent;
65
66   gushort resize_count;
67   guint has_user_ref_count : 1;
68   guint allow_shrink : 1;
69   guint allow_grow : 1;
70   guint auto_shrink : 1;
71   guint handling_resize : 1;
72   guint position : 2;
73
74   /* The following flag is initially TRUE when a window is mapped.
75    * and will be set to FALSE after it is first positioned.
76    * It is also temporarily reset when the window's size changes.
77    * 
78    * When TRUE, we move the window to the position the app set.
79    */
80   guint use_uposition : 1;
81   guint modal : 1;
82   guint destroy_with_parent : 1;
83 };
84
85 struct _GtkWindowClass
86 {
87   GtkBinClass parent_class;
88
89   void (* set_focus)   (GtkWindow *window,
90                         GtkWidget *focus);
91 };
92
93
94 GtkType    gtk_window_get_type                 (void) G_GNUC_CONST;
95 GtkWidget* gtk_window_new                      (GtkWindowType        type);
96 void       gtk_window_set_title                (GtkWindow           *window,
97                                                 const gchar         *title);
98 void       gtk_window_set_wmclass              (GtkWindow           *window,
99                                                 const gchar         *wmclass_name,
100                                                 const gchar         *wmclass_class);
101 void       gtk_window_set_policy               (GtkWindow           *window,
102                                                 gint                 allow_shrink,
103                                                 gint                 allow_grow,
104                                                 gint                 auto_shrink);
105 void       gtk_window_add_accel_group          (GtkWindow           *window,
106                                                 GtkAccelGroup       *accel_group);
107 void       gtk_window_remove_accel_group       (GtkWindow           *window,
108                                                 GtkAccelGroup       *accel_group);
109 void       gtk_window_set_position             (GtkWindow           *window,
110                                                 GtkWindowPosition    position);
111 gint       gtk_window_activate_focus           (GtkWindow           *window);
112 gint       gtk_window_activate_default         (GtkWindow           *window);
113
114 void       gtk_window_set_transient_for        (GtkWindow           *window, 
115                                                 GtkWindow           *parent);
116 void       gtk_window_set_destroy_with_parent  (GtkWindow           *window,
117                                                 gboolean             setting);
118 void       gtk_window_set_geometry_hints       (GtkWindow           *window,
119                                                 GtkWidget           *geometry_widget,
120                                                 GdkGeometry         *geometry,
121                                                 GdkWindowHints       geom_mask);
122 /* The following differs from gtk_widget_set_usize, in that
123  * gtk_widget_set_usize() overrides the requisition, so sets a minimum
124  * size, while this only sets the size requested from the WM.
125  */
126 void       gtk_window_set_default_size         (GtkWindow           *window,
127                                                 gint                 width,
128                                                 gint                 height);
129
130 /* If window is set modal, input will be grabbed when show and released when hide */
131 void       gtk_window_set_modal                (GtkWindow           *window,
132                                                 gboolean             modal);
133 GList*     gtk_window_list_toplevels           (void);
134
135 /* Get the "built-in" accel group (convenience thing) */
136 GtkAccelGroup* gtk_window_get_default_accel_group (GtkWindow *window);
137
138 /* --- internal functions --- */
139 void       gtk_window_set_focus                (GtkWindow           *window,
140                                                 GtkWidget           *focus);
141 void       gtk_window_set_default              (GtkWindow           *window,
142                                                 GtkWidget           *defaultw);
143 void       gtk_window_remove_embedded_xid      (GtkWindow           *window,
144                                                 guint                xid);
145 void       gtk_window_add_embedded_xid         (GtkWindow           *window,
146                                                 guint                xid);
147 void       gtk_window_reposition               (GtkWindow           *window,
148                                                 gint                 x,
149                                                 gint                 y);
150
151 #ifdef __cplusplus
152 }
153 #endif /* __cplusplus */
154
155
156 #endif /* __GTK_WINDOW_H__ */