]> git.wh0rd.org - ICEs.git/blame - 210125/gtk.i.5
initial import
[ICEs.git] / 210125 / gtk.i.5
CommitLineData
45516216 1typedef void *gpointer;
2typedef struct _GList GList;
3typedef struct _FOO FOO;
4typedef void (*GClassInitFunc) (gpointer g_class, gpointer class_data);
5typedef void (*GInstanceInitFunc) (FOO * instance, gpointer g_class);
6typedef enum { FFFFFFF } MOO;
7typedef struct _GdkRectangle GdkRectangle;
8struct _GdkRectangle {
9 int x;
10 int y;
11 int width;
12 int height;
13};
14typedef enum {
15 GTK_PACK_START,
16GTK_PACK_END
17} GtkPathType;
18typedef enum {
19 GTK_POS_LEFT,
20GTK_POS_RIGHT, GTK_POS_TOP, GTK_POS_BOTTOM
21} GtkPreviewType;
22typedef struct _GtkObject GtkObject;
23struct _GtkObject {
24 unsigned int flags;
25};
26typedef struct _GtkWidget GtkWidget;
27typedef enum {
28 GTK_TOPLEVEL = 1 << 4, GTK_NO_WINDOW = 1 << 5, GTK_REALIZED =
29 1 << 6, GTK_MAPPED = 1 << 7, GTK_VISIBLE = 1 << 8, GTK_SENSITIVE =
30 1 << 9, GTK_PARENT_SENSITIVE = 1 << 10, GTK_CAN_FOCUS =
31 1 << 11, GTK_HAS_FOCUS = 1 << 12, GTK_CAN_DEFAULT =
32 1 << 13, GTK_HAS_DEFAULT = 1 << 14, GTK_HAS_GRAB =
33 1 << 15, GTK_RC_STYLE = 1 << 16, GTK_COMPOSITE_CHILD =
34 1 << 17, GTK_NO_REPARENT = 1 << 18, GTK_APP_PAINTABLE =
35 1 << 19, GTK_RECEIVES_DEFAULT = 1 << 20, GTK_DOUBLE_BUFFERED =
36 1 << 21, GTK_NO_SHOW_ALL = 1 << 22
37} GtkWidgetFlags;
38typedef struct _GtkRequisition GtkRequisition;
39typedef GdkRectangle GtkAllocation;
40struct _GtkRequisition {
41 int width;
42 int height;
43};
44struct _GtkWidget {
45 GtkWidget *parent;
46};
47typedef enum {
48 GTK_NOTEBOOK_TAB_FIRST, GTK_NOTEBOOK_TAB_LAST
49} GtkNotebookTab;
50typedef struct _GtkNotebook GtkNotebook;
51typedef struct _GtkNotebookClass GtkNotebookClass;
52typedef struct _GtkNotebookPage GtkNotebookPage;
53struct _GtkNotebook {
54 GtkNotebookPage *cur_page;
55 unsigned int show_tabs:1;
56 unsigned int homogeneous:1;
57};
58struct _GtkNotebookClass {
59 int(*focus_tab) (GtkNotebook * notebook, GtkNotebookTab type);
60};
61enum {
62 STEP_PREV, STEP_NEXT
63};
64typedef enum {
65 DRAG_OPERATION_NONE, DRAG_OPERATION_REORDER, DRAG_OPERATION_DETACH
66} GtkNotebookDragOperation;
67struct _GtkNotebookPage {
68 GtkWidget *tab_label;
69 unsigned int expand:1;
70 unsigned int pack:1;
71 GtkRequisition requisition;
72 GtkAllocation allocation;
73};
74typedef struct _GtkNotebookPrivate GtkNotebookPrivate;
75struct _GtkNotebookPrivate {
76 GtkNotebookDragOperation operation;
77 int drag_window_x;
78 int drag_window_y;
79 GtkNotebookPage *detached_tab;
80};
81 int gtk_notebook_focus_tab(GtkNotebook * notebook,
82 GtkNotebookTab type);
83 void gtk_notebook_switch_focus_tab(GtkNotebook * notebook,
84 GList * new_child);
85 void gtk_notebook_init(GtkNotebook * self);
86 void gtk_notebook_class_init(GtkNotebookClass * klass);
87 void gtk_notebook_class_intern_init(gpointer klass)
88{
89 gtk_notebook_class_init((GtkNotebookClass *) klass);
90}
91unsigned int IA__gtk_notebook_get_type(void)
92{
93 unsigned int g_define_type_id;
94 unsigned int g_define_type_id__volatile;
95 if (g_once_init_enter(&g_define_type_id__volatile))
96g_define_type_id =
97 g_type_register_static_simple((IA__gtk_container_get_type
98 ()),
99 g_intern_static_string
100 ("GtkNotebook"),
101 sizeof(GtkNotebookClass),
102 (GClassInitFunc)
103 gtk_notebook_class_intern_init,
104 sizeof(GtkNotebook),
105 (GInstanceInitFunc)
106 gtk_notebook_init,
107 (MOO) 0);
108}
109 void gtk_notebook_class_init(GtkNotebookClass * class)
110{
111}
112 int gtk_notebook_focus_tab(GtkNotebook * notebook,
113 GtkNotebookTab type)
114{
115}
116 int gtk_notebook_calculate_tabs_allocation(GtkNotebook * notebook,
117 GList ** children,
118 GList * last_child,
119 int showarrow,
120 int direction,
121 int * remaining_space,
122 int * expanded_tabs,
123 int min, int max)
124{
125 GtkNotebookPrivate *priv;
126 GtkNotebookPage *page;
127 int allocate_at_bottom;
128 int tab_overlap;
129 int tab_pos;
130 int tab_extra_space;
131 int left_x;
132 int right_x;
133 int top_y;
134 int anchor;
135 int xthickness;
136 int ythickness;
137 int gap_left;
138 int packing_changed;
139 GtkAllocation child_allocation;
140 while (*children && *children != last_child) {
141 if (!
142 (((GtkNotebookPage *) (page))->tab_label->parent ==
143 ((GtkWidget *) (notebook))))
144 continue;
145 if (
146*expanded_tabs &&
147(
148notebook->homogeneous)
149) {
150 tab_extra_space = *remaining_space / *expanded_tabs;
151 *remaining_space -= tab_extra_space;
152 }
153 switch (tab_pos) {
154 case GTK_POS_TOP:
155 case GTK_POS_BOTTOM:
156 child_allocation.width =
157 page->requisition.width + tab_overlap +
158 tab_extra_space;
159 if (
160!gap_left
161&&
162packing_changed
163) {
164 if (!allocate_at_bottom) {
165 if (
1661
167) {
168 left_x = priv->drag_window_x =
169 anchor;
170 anchor +=
171 notebook->cur_page->
172 allocation.width -
173 tab_overlap;
174 }
175 if (
176(
177notebook->cur_page->pack ==
178 GTK_PACK_END
179 &&
180right_x > anchor
181)) {
182 anchor -=
183 notebook->cur_page->
184 allocation.width;
185 left_x = priv->drag_window_x =
186 anchor;
187 anchor += tab_overlap;
188 }
189 }
190 } else {
191 if (allocate_at_bottom)
192 anchor -= child_allocation.width;
193 if (
194priv->operation == DRAG_OPERATION_REORDER
195 &&
196page->pack == notebook->cur_page->pack
197) {
198 if (!allocate_at_bottom
199 && left_x >= anchor
200 && left_x <=
201 anchor + child_allocation.width / 2)
202 anchor +=
203 notebook->cur_page->
204 allocation.width -
205 tab_overlap;
206 else if (
207allocate_at_bottom
208 &&
209right_x >= anchor + child_allocation.width / 2
210 &&
211right_x <= anchor + child_allocation.width
212)
213 anchor -=
214 notebook->cur_page->
215 allocation.width -
216 tab_overlap;
217 }
218 child_allocation.x = anchor;
219 }
220 break;
221 case GTK_POS_LEFT:
222 case GTK_POS_RIGHT:
223 child_allocation.height =
224 page->requisition.height + tab_overlap +
225 tab_extra_space;
226 if (
227packing_changed
228) {
229 priv->drag_window_x = child_allocation.x;
230 priv->drag_window_y = top_y;
231 if (
232priv->operation == DRAG_OPERATION_REORDER
233 &&
234page->pack == notebook->cur_page->pack
235) {
236 if (
237!allocate_at_bottom
238 &&
239top_y >= anchor
240 &&
241top_y <=
242 anchor +
243 child_allocation.height / 2
244)
245 anchor +=
246 notebook->cur_page->
247 allocation.height -
248 tab_overlap;
249 }
250 }
251 }
252 if (
253(page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH)
254 ||
255(page == notebook->cur_page
256 && priv->operation == DRAG_OPERATION_REORDER)
257) {
258 page->allocation.x = 0;
259 }
260 if (page != notebook->cur_page) {
261 switch (tab_pos) {
262 case GTK_POS_TOP:
263 page->allocation.y += ythickness;
264 case GTK_POS_BOTTOM:
265 page->allocation.height =
266 (((1) >
267 (page->allocation.height -
268 ythickness)) ? (1) : (page->allocation.
269 height -
270 ythickness));
271 break;
272 case GTK_POS_LEFT:
273 page->allocation.x += xthickness;
274 case GTK_POS_RIGHT:
275 page->allocation.width =
276 (((1) >
277 (page->allocation.width -
278 xthickness)) ? (1) : (page->allocation.
279 width -
280 xthickness));
281 }
282 }
283 switch (tab_pos) {
284 case GTK_POS_TOP:
285 case GTK_POS_BOTTOM:
286 if (priv->operation != DRAG_OPERATION_REORDER
287 || (priv->operation == DRAG_OPERATION_REORDER
288 && page != notebook->cur_page))
289 if (!allocate_at_bottom)
290 anchor +=
291 child_allocation.width -
292 tab_overlap;
293 case GTK_POS_LEFT:
294 case GTK_POS_RIGHT:
295 if (priv->operation != DRAG_OPERATION_REORDER
296 || (priv->operation == DRAG_OPERATION_REORDER
297 && page != notebook->cur_page))
298 if (priv->operation == DRAG_OPERATION_REORDER)
299 if (page->pack ==
300 notebook->cur_page->pack
301 && !allocate_at_bottom
302 && top_y >=
303 anchor + child_allocation.height / 2
304 && top_y <=
305 anchor + child_allocation.height)
306 anchor +=
307 notebook->cur_page->
308 allocation.height -
309 tab_overlap;
310 }
311 if (page->tab_label)
312 IA__gtk_widget_set_child_visible(page->tab_label,
313 (!(0)));
314 }
315}
316 void gtk_notebook_pages_allocate(GtkNotebook * notebook)
317{
318}
319 void gtk_notebook_switch_focus_tab(GtkNotebook * notebook,
320 GList * new_child)
321{
322}