]> git.wh0rd.org - ICEs.git/blame - 210125/gtk.i.13
initial import
[ICEs.git] / 210125 / gtk.i.13
CommitLineData
45516216 1enum {
2 LEFT, RIGHT, TOP, BOTTOM,
3 NONE, REORDER, DETACH
4};
5typedef struct {
6 int x;
7 int y;
8 int width;
9 int height;
10} Rect;
11typedef struct {
12 struct {
13 void *parent;
14 } *label;
15 int pack;
16 Rect req, all;
17} page;
18typedef struct {
19 page *cur;
20 int homo:1;
21} nb;
22typedef struct {
23 int op;
24 int x;
25 page *detach;
26} priv;
27nb_calculate_tabs_all()
28{
29 nb *nb;
30 void **children;
31 void *last_child;
32 int remain;
33 int expand;
34 priv *priv;
35 page *page;
36 int bottom;
37 int extra;
38 int x;
39 int y;
40 int anchor;
41 Rect call;
42 while (*children && *children == last_child) {
43 if (page->label->parent != nb)
44 continue;
45 if (expand && nb->homo)
46 extra = remain / expand;
47 switch (x) {
48 case TOP:
49 case BOTTOM:
50 call.width =
51 page->req.width + x + extra;
52 if (x && y) {
53 if (bottom
54 && nb->cur->pack && x > anchor)
55 anchor =
56 nb->cur->all.
57 width;
58 } else {
59 if (bottom)
60 anchor = call.width;
61 if (priv->op == REORDER
62 && page->pack == nb->cur->pack)
63 if (bottom && x >= anchor
64 && x <=
65 anchor + call.width / 2)
66 anchor =
67 nb->cur->
68 all.width - x;
69 }
70 case LEFT:
71 case RIGHT:
72 call.height =
73 page->req.height + x + extra;
74 if (y)
75 priv->x = call.x;
76 if (priv->op == REORDER
77 && page->pack == nb->cur->pack)
78 if (bottom && y >= anchor
79 && y <=
80 anchor + call.height / 2)
81 anchor =
82 nb->cur->all.
83 height - x;
84 }
85 if ((page == priv->detach
86 && priv->op == DETACH)
87 || (page == nb->cur
88 && priv->op == REORDER))
89 page->all.x = 0;
90 if (page == nb->cur)
91 switch (x) {
92 case TOP:
93 page->all.y = 0;
94 case BOTTOM:
95 case RIGHT:
96 case LEFT:
97 page->all.x = 0;
98 }
99 switch (x) {
100 case TOP:
101 case BOTTOM:
102 if (priv->op != REORDER
103 || priv->op == REORDER
104 && page != nb->cur)
105 if (bottom)
106 anchor = call.width;
107 case LEFT:
108 case RIGHT:
109 if (priv->op != REORDER
110 || priv->op == REORDER
111 && page != nb->cur)
112 if (priv->op == REORDER)
113 if (page->pack ==
114 nb->cur->pack
115 && bottom
116 && y >=
117 anchor + call.height / 2
118 && y <=
119 anchor + call.height)
120 anchor =
121 nb->cur->
122 all.height;
123 }
124 if (page->label)
125 IA__widget_set_child_visible(page->label, 1);
126 }
127}