Merge commit 'origin/stable'
[pspp-builds.git] / lib / gtk-contrib / gtkxpaned.h
1 /*******************************************************************************
2 **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 
3 **      10        20        30        40        50        60        70        80
4 **
5 **  library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+
6 **  Copyright (C) 2005-2006 Mirco "MacSlow" Müller <macslow@bangang.de>
7 **
8 **  This library is free software; you can redistribute it and/or
9 **  modify it under the terms of the GNU Lesser General Public
10 **  License as published by the Free Software Foundation; either
11 **  version 2.1 of the License, or (at your option) any later version.
12 **
13 **  This library is distributed in the hope that it will be useful,
14 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 **  Lesser General Public License for more details.
17 **
18 **  You should have received a copy of the GNU Lesser General Public
19 **  License along with this library; if not, write to the Free Software
20 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 **
22 **  GtkXPaned is based on GtkPaned which was done by...
23 **
24 **  "Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald"
25 **
26 **  and later modified by...
27 **
28 **  "the GTK+ Team and others 1997-2000"
29 **
30 *******************************************************************************/
31
32 #ifndef GTK_XPANED_H
33 #define GTK_XPANED_H
34
35 #include <gtk/gtkcontainer.h>
36
37 G_BEGIN_DECLS
38
39 #define GTK_TYPE_XPANED                  (gtk_xpaned_get_type ())
40 #define GTK_XPANED(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_XPANED, GtkXPaned))
41 #define GTK_XPANED_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_XPANED, GtkXPanedClass))
42 #define GTK_IS_XPANED(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_XPANED))
43 #define GTK_IS_XPANED_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_XPANED))
44 #define GTK_XPANED_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_XPANED, GtkXPanedClass))
45
46 typedef struct _GtkXPaned        GtkXPaned;
47 typedef struct _GtkXPanedClass   GtkXPanedClass;
48 typedef struct _GtkXPanedPrivate GtkXPanedPrivate;
49
50 typedef enum _GtkXPanedChild
51 {
52         GTK_XPANED_TOP_LEFT = 0,
53         GTK_XPANED_TOP_RIGHT,
54         GTK_XPANED_BOTTOM_LEFT,
55         GTK_XPANED_BOTTOM_RIGHT
56 } GtkXPanedChild;
57         
58 struct _GtkXPaned
59 {
60         GtkContainer container;
61   
62         GtkWidget* top_left_child;
63         GtkWidget* top_right_child;
64         GtkWidget* bottom_left_child;
65         GtkWidget* bottom_right_child;
66
67         GdkWindow* handle_east;
68         GdkWindow* handle_west;
69         GdkWindow* handle_north;
70         GdkWindow* handle_south;
71         GdkWindow* handle_middle;
72         GdkGC* xor_gc;
73         GdkCursorType cursor_type_east;
74         GdkCursorType cursor_type_west;
75         GdkCursorType cursor_type_north;
76         GdkCursorType cursor_type_south;
77         GdkCursorType cursor_type_middle;
78
79         /*< private >*/
80         GdkRectangle handle_pos_east;
81         GdkRectangle handle_pos_west;
82         GdkRectangle handle_pos_north;
83         GdkRectangle handle_pos_south;
84         GdkRectangle handle_pos_middle;
85         GtkRequisition top_left_child_size;
86         GtkRequisition top_right_child_size;
87         GtkRequisition bottom_left_child_size;
88         GtkRequisition bottom_right_child_size;
89
90         GtkRequisition last_allocation;
91         GdkPoint min_position;
92         GdkPoint max_position;
93         gboolean maximized[4];
94
95         guint position_set : 1;
96         guint in_drag_vert : 1;
97         guint in_drag_horiz : 1;
98         guint in_drag_vert_and_horiz : 1;
99         guint top_left_child_shrink : 1;
100         guint top_left_child_resize : 1;
101         guint top_right_child_shrink : 1;
102         guint top_right_child_resize : 1;
103         guint bottom_left_child_shrink : 1;
104         guint bottom_left_child_resize : 1;
105         guint bottom_right_child_shrink : 1;
106         guint bottom_right_child_resize : 1;
107         guint in_recursion : 1;
108         guint handle_prelit : 1;
109
110         GtkWidget* last_top_left_child_focus;
111         GtkWidget* last_top_right_child_focus;
112         GtkWidget* last_bottom_left_child_focus;
113         GtkWidget* last_bottom_right_child_focus;
114         GtkXPanedPrivate* priv;
115
116         GdkPoint drag_pos;
117         GdkPoint original_position;
118         GdkPoint unmaximized_position;
119 };
120
121 struct _GtkXPanedClass
122 {
123         GtkContainerClass parent_class;
124         gboolean (*cycle_child_focus)   (GtkXPaned* xpaned, gboolean reverse); 
125         gboolean (*toggle_handle_focus) (GtkXPaned* xpaned);
126         gboolean (*move_handle)                 (GtkXPaned* xpaned, GtkScrollType scroll);
127         gboolean (*cycle_handle_focus)  (GtkXPaned* xpaned, gboolean reverse);
128         gboolean (*accept_position)             (GtkXPaned* xpaned);
129         gboolean (*cancel_position)     (GtkXPaned* xpaned);
130 };
131
132 GType gtk_xpaned_get_type (void) G_GNUC_CONST;
133 GtkWidget* gtk_xpaned_new (void);
134 void gtk_xpaned_add_top_left (GtkXPaned* xpaned, GtkWidget* child);
135 void gtk_xpaned_add_top_right (GtkXPaned* xpaned, GtkWidget* child);
136 void gtk_xpaned_add_bottom_left (GtkXPaned* xpaned, GtkWidget* child);
137 void gtk_xpaned_add_bottom_right (GtkXPaned* xpaned, GtkWidget* child);
138 void gtk_xpaned_pack_top_left (GtkXPaned* xpaned, GtkWidget* child, gboolean resize, gboolean shrink);
139 void gtk_xpaned_pack_top_right (GtkXPaned* xpaned, GtkWidget* child, gboolean resize, gboolean shrink);
140 void gtk_xpaned_pack_bottom_left (GtkXPaned* xpaned, GtkWidget* child, gboolean resize, gboolean shrink);
141 void gtk_xpaned_pack_bottom_right (GtkXPaned* xpaned, GtkWidget* child, gboolean resize, gboolean shrink);
142 gint gtk_xpaned_get_position_x (GtkXPaned* xpaned);
143 gint gtk_xpaned_get_position_y (GtkXPaned* xpaned);
144 void gtk_xpaned_set_position_x (GtkXPaned* xpaned, gint xposition);
145 void gtk_xpaned_set_position_y (GtkXPaned* xpaned, gint yposition);
146 void gtk_xpaned_save_unmaximized_x (GtkXPaned* xpaned);
147 void gtk_xpaned_save_unmaximized_y (GtkXPaned* xpaned);
148 gint gtk_xpaned_fetch_unmaximized_x (GtkXPaned* xpaned);
149 gint gtk_xpaned_fetch_unmaximized_y (GtkXPaned* xpaned);
150 GtkWidget* gtk_xpaned_get_top_left_child (GtkXPaned* xpaned);
151 GtkWidget* gtk_xpaned_get_top_right_child (GtkXPaned* xpaned);
152 GtkWidget* gtk_xpaned_get_bottom_right_child (GtkXPaned* xpaned);
153 GtkWidget* gtk_xpaned_get_bottom_left_child (GtkXPaned* xpaned);
154 gboolean gtk_xpaned_maximize_top_left (GtkXPaned* xpaned, gboolean maximize);
155 gboolean gtk_xpaned_maximize_top_right (GtkXPaned* xpaned, gboolean maximize);
156 gboolean gtk_xpaned_maximize_bottom_left (GtkXPaned* xpaned, gboolean maximize);
157 gboolean gtk_xpaned_maximize_bottom_right (GtkXPaned* xpaned, gboolean maximize);
158
159 /* Internal function */
160 #if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
161 void gtk_xpaned_compute_position (GtkXPaned* xpaned,
162                                   const GtkAllocation* allocation,
163                                   GtkRequisition* top_left_child_req,
164                                   GtkRequisition* top_right_child_req,
165                                   GtkRequisition* bottom_left_child_req,
166                                   GtkRequisition* bottom_right_child_req);
167 #endif /* !GTK_DISABLE_DEPRECATED || GTK_COMPILATION */
168 #ifndef GTK_DISABLE_DEPRECATED
169 #define gtk_xpaned_gutter_size(p,s) (void) 0
170 #define gtk_xpaned_set_gutter_size(p,s) (void) 0
171 #endif /* GTK_DISABLE_DEPRECATED */
172
173 G_END_DECLS
174
175 #endif /* GTK_XPANED_H */