Mercurial > pidgin
annotate console/libgnt/gntbox.c @ 13953:8b2306c64efa
[gaim-migrate @ 16501]
Minor adjustments to the packing of child widgets in a box.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 17 Jul 2006 04:30:50 +0000 |
parents | 25be562aaca8 |
children | c9509bd42d7a |
rev | line source |
---|---|
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntbox.h" |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
3 #include <string.h> |
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
4 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 enum |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 SIGS = 1, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 static GntWidgetClass *parent_class = NULL; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 static guint signals[SIGS] = { 0 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
13 static GntWidget * find_focusable_widget(GntBox *box); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
14 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 static void |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
16 add_to_focus(gpointer value, gpointer data) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
17 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
18 GntBox *box = GNT_BOX(data); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
19 GntWidget *w = GNT_WIDGET(value); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
20 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
21 if (GNT_IS_BOX(w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
22 g_list_foreach(GNT_BOX(w)->list, add_to_focus, box); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
23 else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_CAN_TAKE_FOCUS)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
24 box->focus = g_list_append(box->focus, w); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
25 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
26 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
27 static void |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 gnt_box_draw(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
32 if (box->focus == NULL && widget->parent == NULL) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
33 g_list_foreach(box->list, add_to_focus, box); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
34 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
35 g_list_foreach(box->list, (GFunc)gnt_widget_draw, NULL); |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
36 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
37 gnt_box_sync_children(box); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 if (box->title) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 gchar *title = g_strdup(box->title); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
42 int pos = g_utf8_strlen(title, -1), right; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
44 if (pos >= widget->priv.width - 4) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 { |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
46 g_utf8_strncpy(title, box->title, widget->priv.width - 4); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
47 pos = 2; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
48 right = pos + g_utf8_strlen(title, -1); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 else |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 { |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
52 /* XXX: Position of the title might be configurable */ |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
53 right = pos; |
13864
c7d84d4c5afa
[gaim-migrate @ 16328]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
54 pos = (widget->priv.width - pos) / 2; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
55 right += pos; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
57 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
58 if (gnt_widget_has_focus(widget)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
59 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE)); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
60 else |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
61 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE_D)); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
62 mvwaddch(widget->window, 0, pos-1, ACS_RTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 mvwprintw(widget->window, 0, pos, title); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
64 mvwaddch(widget->window, 0, right, ACS_LTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 g_free(title); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 DEBUG; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 reposition_children(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 GList *iter; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 int w, h, curx, cury, max; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 gboolean has_border = FALSE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 w = h = 0; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
80 max = 0; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
81 curx = widget->priv.x; |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
82 cury = widget->priv.y; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 has_border = TRUE; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
86 curx += 1; |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
87 cury += 1; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 for (iter = box->list; iter; iter = iter->next) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 gnt_widget_set_position(GNT_WIDGET(iter->data), curx, cury); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 if (box->vertical) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
96 if (h) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
97 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
98 cury += h + box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
99 if (max < w) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
100 max = w; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
101 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 else |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
105 if (w) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
106 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
107 curx += w + box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
108 if (max < h) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
109 max = h; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
110 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 if (has_border) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 { |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
116 curx += 1; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 cury += 1; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 max += 2; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
121 if (box->list) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
122 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
123 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
124 cury -= box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
125 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
126 curx -= box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
127 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
128 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 if (box->vertical) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 widget->priv.width = max; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 widget->priv.height = cury - widget->priv.y; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 else |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 widget->priv.width = curx - widget->priv.x; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 widget->priv.height = max; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 gnt_box_set_position(GntWidget *widget, int x, int y) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
144 GList *iter; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
145 int changex, changey; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
146 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
147 changex = widget->priv.x - x; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
148 changey = widget->priv.y - y; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
149 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
150 for (iter = GNT_BOX(widget)->list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
151 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
152 GntWidget *w = GNT_WIDGET(iter->data); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
153 gnt_widget_set_position(w, w->priv.x - changex, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
154 w->priv.y - changey); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
155 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 gnt_box_size_request(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 GList *iter; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
163 int maxw = 0, maxh = 0; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 g_list_foreach(box->list, (GFunc)gnt_widget_size_request, NULL); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
167 for (iter = box->list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
168 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
169 int w, h; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
170 gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
171 if (maxh < h) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
172 maxh = h; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
173 if (maxw < w) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
174 maxw = w; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
175 } |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
176 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
177 for (iter = box->list; iter; iter = iter->next) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 { |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
179 int w, h; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
180 GntWidget *wid = GNT_WIDGET(iter->data); |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
181 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
182 gnt_widget_get_size(wid, &w, &h); |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
183 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
184 if (box->homogeneous) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
186 if (box->vertical) |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
187 h = maxh; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
188 else |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
189 w = maxw; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 } |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
191 if (box->fill) |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
192 { |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
193 if (box->vertical) |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
194 w = maxw; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
195 else |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
196 h = maxh; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
197 } |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
198 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
199 gnt_widget_set_size(wid, w, h); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 reposition_children(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 gnt_box_map(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 if (widget->priv.width == 0 || widget->priv.height == 0) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
209 { |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 gnt_widget_size_request(widget); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
211 find_focusable_widget(GNT_BOX(widget)); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
212 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 DEBUG; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
216 /* Ensures that the current widget can take focus */ |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
217 static GntWidget * |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
218 find_focusable_widget(GntBox *box) |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
219 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
220 if (box->focus == NULL && GNT_WIDGET(box)->parent == NULL) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
221 g_list_foreach(box->list, add_to_focus, box); |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
222 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
223 if (box->active == NULL && box->focus) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
224 box->active = box->focus->data; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
225 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
226 return box->active; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
227 } |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
228 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
229 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
230 find_next_focus(GntBox *box) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
231 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
232 GList *iter = g_list_find(box->focus, box->active); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
233 if (iter && iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
234 box->active = iter->next->data; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
235 else if (box->focus) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
236 box->active = box->focus->data; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
237 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
238 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
239 static gboolean |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
240 gnt_box_key_pressed(GntWidget *widget, const char *text) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 GntBox *box = GNT_BOX(widget); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
243 GntWidget *now; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
244 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
245 if (box->active == NULL && !find_focusable_widget(box)) |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
246 return FALSE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
248 if (gnt_widget_key_pressed(box->active, text)) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
249 return TRUE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
250 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
251 now = box->active; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
252 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
253 if (text[0] == 27) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
254 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 if (strcmp(text+1, GNT_KEY_LEFT) == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
257 GList *iter = g_list_find(box->focus, box->active); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
258 if ((!iter || !iter->prev) && box->focus) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
259 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
260 box->active = box->focus->data; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
261 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
262 else |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
263 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
264 box->active = iter->prev->data; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
265 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 else if (strcmp(text+1, GNT_KEY_RIGHT) == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
269 find_next_focus(box); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 } |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
271 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
272 else if (text[0] == '\t') |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
273 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
274 find_next_focus(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
275 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
277 if (now && now != box->active) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
278 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
279 gnt_widget_set_focus(now, FALSE); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
280 gnt_widget_set_focus(box->active, TRUE); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
281 return TRUE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 return FALSE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
287 static void |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
288 gnt_box_lost_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
289 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
290 GntWidget *w = GNT_BOX(widget)->active; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
291 if (w) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
292 gnt_widget_set_focus(w, FALSE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
293 gnt_widget_draw(widget); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 static void |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
297 gnt_box_gained_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
298 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
299 GntWidget *w = GNT_BOX(widget)->active; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
300 if (w) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
301 gnt_widget_set_focus(w, TRUE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
302 gnt_widget_draw(widget); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
303 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
304 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
305 static void |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 gnt_box_destroy(GntWidget *w) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 GntBox *box = GNT_BOX(w); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
310 gnt_box_remove_all(box); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
311 gnt_screen_release(w); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 static void |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
315 gnt_box_expose(GntWidget *widget, int x, int y, int width, int height) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
316 { |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
317 WINDOW *win = newwin(height, width, widget->priv.y + y, widget->priv.x + x); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
318 copywin(widget->window, win, y, x, 0, 0, height - 1, width - 1, FALSE); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
319 wrefresh(win); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
320 delwin(win); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
321 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
322 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
323 static gboolean |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
324 gnt_box_confirm_size(GntWidget *widget, int width, int height) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
325 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
326 GList *iter; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
327 GntBox *box = GNT_BOX(widget); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
328 int wchange, hchange; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
329 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
330 if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
331 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
332 if (widget->priv.height != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
333 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
334 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
335 if (!box->list) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
336 return TRUE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
337 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
338 wchange = widget->priv.width - width; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
339 hchange = widget->priv.height - height; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
340 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
341 if (wchange == 0 && hchange == 0) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
342 return TRUE; /* Quit playing games */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
343 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
344 /* XXX: Right now, I am trying to just apply all the changes to |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
345 * just one widget. It should be possible to distribute the |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
346 * changes to all the widgets in the box. */ |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
347 for (iter = box->list; iter; iter = iter->next) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
348 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
349 GntWidget *wid = iter->data; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
350 int w, h; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
351 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
352 gnt_widget_get_size(wid, &w, &h); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
353 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
354 if (gnt_widget_confirm_size(wid, w - wchange, h - hchange)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
355 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
356 GList *i; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
357 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
358 for (i = box->list; i; i = i->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
359 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
360 int tw, th; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
361 if (i == iter) continue; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
362 gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
363 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
364 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
365 if (!gnt_widget_confirm_size(i->data, tw - wchange, th)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
366 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
367 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
368 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
369 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
370 if (!gnt_widget_confirm_size(i->data, tw, th - hchange)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
371 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
372 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
373 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
374 #if 0 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
375 gnt_widget_set_size(wid, w - wchange, h - hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
376 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
377 hchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
378 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
379 wchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
380 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
381 for (i = box->list; i; i = i->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
382 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
383 int tw, th; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
384 if (i == iter) continue; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
385 gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
386 gnt_widget_set_size(i->data, tw - wchange, th - hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
387 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
388 #endif |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
389 g_object_set_data(G_OBJECT(box), "size-queued", wid); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
390 return TRUE; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
391 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
392 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
393 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
394 return FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
395 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
396 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
397 static void |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
398 gnt_box_size_changed(GntWidget *widget, int oldw, int oldh) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
399 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
400 int wchange, hchange; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
401 GList *i; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
402 GntBox *box = GNT_BOX(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
403 GntWidget *wid; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
404 int tw, th; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
405 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
406 wchange = widget->priv.width - oldw; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
407 hchange = widget->priv.height - oldh; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
408 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
409 wid = g_object_get_data(G_OBJECT(box), "size-queued"); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
410 if (wid) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
411 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
412 gnt_widget_get_size(wid, &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
413 gnt_widget_set_size(wid, tw + wchange, th + hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
414 g_object_set_data(G_OBJECT(box), "size-queued", NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
415 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
416 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
417 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
418 hchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
419 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
420 wchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
421 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
422 for (i = box->list; i; i = i->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
423 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
424 gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
425 gnt_widget_set_size(i->data, tw + wchange, th + hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
426 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
427 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
428 reposition_children(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
429 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
430 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
431 static void |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
432 gnt_box_class_init(GntBoxClass *klass) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
433 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
434 parent_class = GNT_WIDGET_CLASS(klass); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
435 parent_class->destroy = gnt_box_destroy; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
436 parent_class->draw = gnt_box_draw; |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
437 parent_class->expose = gnt_box_expose; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
438 parent_class->map = gnt_box_map; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 parent_class->size_request = gnt_box_size_request; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
440 parent_class->set_position = gnt_box_set_position; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
441 parent_class->key_pressed = gnt_box_key_pressed; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 parent_class->lost_focus = gnt_box_lost_focus; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
443 parent_class->gained_focus = gnt_box_gained_focus; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
444 parent_class->confirm_size = gnt_box_confirm_size; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
445 parent_class->size_changed = gnt_box_size_changed; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
446 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
447 DEBUG; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
448 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 gnt_box_init(GTypeInstance *instance, gpointer class) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
452 { |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
453 /* Initially make both the height and width resizable. |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
454 * Update the flags as necessary when widgets are added to it. */ |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
455 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 DEBUG; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
457 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
458 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
459 /****************************************************************************** |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
460 * GntBox API |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
461 *****************************************************************************/ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
462 GType |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
463 gnt_box_get_gtype(void) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
464 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
465 static GType type = 0; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
466 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
467 if(type == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
468 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
469 static const GTypeInfo info = { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
470 sizeof(GntBoxClass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
471 NULL, /* base_init */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
472 NULL, /* base_finalize */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
473 (GClassInitFunc)gnt_box_class_init, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
474 NULL, /* class_finalize */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
475 NULL, /* class_data */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
476 sizeof(GntBox), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
477 0, /* n_preallocs */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
478 gnt_box_init, /* instance_init */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
479 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
480 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
481 type = g_type_register_static(GNT_TYPE_WIDGET, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
482 "GntBox", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
483 &info, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
484 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
485 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
486 return type; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
487 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
488 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
489 GntWidget *gnt_box_new(gboolean homo, gboolean vert) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
490 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
491 GntWidget *widget = g_object_new(GNT_TYPE_BOX, NULL); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
492 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
493 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
494 box->homogeneous = homo; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
495 box->vertical = vert; |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
496 box->pad = 1; |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
497 box->fill = TRUE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
498 gnt_widget_set_take_focus(widget, TRUE); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
499 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
500 if (vert) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
501 box->alignment = GNT_ALIGN_LEFT; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
502 else |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
503 box->alignment = GNT_ALIGN_MID; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 return widget; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 void gnt_box_add_widget(GntBox *b, GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
509 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
510 b->list = g_list_append(b->list, widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
511 widget->parent = GNT_WIDGET(b); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
512 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
513 if (b->vertical) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
514 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
515 if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
516 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(b), GNT_WIDGET_GROW_X); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
517 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
518 else |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
519 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
520 if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
521 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(b), GNT_WIDGET_GROW_Y); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
522 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 void gnt_box_set_title(GntBox *b, const char *title) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 g_free(b->title); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 b->title = g_strdup(title); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
531 void gnt_box_set_pad(GntBox *box, int pad) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
532 { |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
533 box->pad = pad; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
534 /* XXX: Perhaps redraw if already showing? */ |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
535 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
536 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
537 void gnt_box_set_toplevel(GntBox *box, gboolean set) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
538 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
539 GntWidget *widget = GNT_WIDGET(box); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
540 if (set) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
541 { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
542 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
543 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
544 } |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
545 else |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
546 { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
547 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
548 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
549 } |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
550 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
551 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
552 void gnt_box_sync_children(GntBox *box) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
553 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
554 GList *iter; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
555 GntWidget *widget = GNT_WIDGET(box); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
556 int pos = 1; |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
557 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
558 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
559 pos = 0; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
560 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
561 for (iter = box->list; iter; iter = iter->next) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
562 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
563 GntWidget *w = GNT_WIDGET(iter->data); |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
564 int height, width; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
565 int x, y; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
566 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
567 if (GNT_IS_BOX(w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
568 gnt_box_sync_children(GNT_BOX(w)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
569 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
570 gnt_widget_get_size(w, &width, &height); |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
571 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
572 x = w->priv.x - widget->priv.x; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
573 y = w->priv.y - widget->priv.y; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
574 |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
575 if (box->vertical) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
576 { |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
577 if (box->alignment == GNT_ALIGN_RIGHT) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
578 x += widget->priv.width - width; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
579 else if (box->alignment == GNT_ALIGN_MID) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
580 x += (widget->priv.width - width)/2; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
581 if (x + width > widget->priv.width - pos) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
582 x -= x + width - (widget->priv.width - pos); |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
583 } |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
584 else |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
585 { |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
586 if (box->alignment == GNT_ALIGN_BOTTOM) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
587 y += widget->priv.height - height; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
588 else if (box->alignment == GNT_ALIGN_MID) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
589 y += (widget->priv.height - height)/2; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
590 if (y + height >= widget->priv.height - pos) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
591 y = widget->priv.height - height - pos; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
592 } |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
593 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
594 copywin(w->window, widget->window, 0, 0, |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
595 y, x, y + height - 1, x + width - 1, FALSE); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
596 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
597 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
598 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
599 void gnt_box_set_alignment(GntBox *box, GntAlignment alignment) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
600 { |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
601 box->alignment = alignment; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
602 } |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
603 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
604 void gnt_box_remove(GntBox *box, GntWidget *widget) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
605 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
606 box->list = g_list_remove(box->list, widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
607 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
608 && GNT_WIDGET(box)->parent == NULL && box->focus) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
609 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
610 if (widget == box->active) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
611 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
612 find_next_focus(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
613 if (box->active == widget) /* There's only one widget */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
614 box->active = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
615 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
616 box->focus = g_list_remove(box->focus, widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
617 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
618 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
619 if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(box), GNT_WIDGET_MAPPED)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
620 gnt_widget_draw(GNT_WIDGET(box)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
621 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
622 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
623 void gnt_box_remove_all(GntBox *box) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
624 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
625 g_list_foreach(box->list, (GFunc)gnt_widget_destroy, NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
626 g_list_free(box->list); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
627 g_list_free(box->focus); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
628 box->list = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
629 box->focus = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
630 GNT_WIDGET(box)->priv.width = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
631 GNT_WIDGET(box)->priv.height = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
632 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
633 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
634 void gnt_box_readjust(GntBox *box) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
635 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
636 GList *iter; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
637 GntWidget *wid; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
638 int width, height; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
639 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
640 g_return_if_fail(GNT_WIDGET(box)->parent == NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
641 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
642 for (iter = box->list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
643 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
644 GntWidget *w = iter->data; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
645 if (GNT_IS_BOX(w)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
646 gnt_box_readjust(GNT_BOX(w)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
647 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
648 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
649 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_MAPPED); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
650 w->priv.width = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
651 w->priv.height = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
652 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
653 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
654 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
655 wid = GNT_WIDGET(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
656 GNT_WIDGET_UNSET_FLAGS(wid, GNT_WIDGET_MAPPED); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
657 wid->priv.width = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
658 wid->priv.height = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
659 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
660 if (wid->parent == NULL) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
661 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
662 g_list_free(box->focus); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
663 box->focus = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
664 box->active = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
665 gnt_widget_size_request(wid); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
666 gnt_widget_get_size(wid, &width, &height); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
667 gnt_screen_resize_widget(wid, width, height); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
668 find_focusable_widget(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
669 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
670 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
671 |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
672 void gnt_box_set_fill(GntBox *box, gboolean fill) |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
673 { |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
674 box->fill = fill; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
675 } |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
676 |