Mercurial > pidgin.yaz
annotate console/libgnt/gntbox.c @ 14454:22cb019456bd
[gaim-migrate @ 17168]
Use NSIS' built-in language registry key stuff. This fixes the installer forgetting which language you've selected.
Fill the installer file versioning information - Unfortunately, there doesn't appear to be a way to manipulate the value to use for the ProductVersion inside the NSIS script, so the Makefile needs to massage the data.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 05 Sep 2006 15:40:24 +0000 |
parents | 3ac156db9cb6 |
children | 62bb53609a36 |
rev | line source |
---|---|
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntbox.h" |
14417
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
2 #include "gntutils.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
4 #include <string.h> |
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
5 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 enum |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 SIGS = 1, |
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 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 static GntWidgetClass *parent_class = NULL; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 static guint signals[SIGS] = { 0 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
14 static GntWidget * find_focusable_widget(GntBox *box); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
15 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 static void |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
17 add_to_focus(gpointer value, gpointer data) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
18 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
19 GntBox *box = GNT_BOX(data); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
20 GntWidget *w = GNT_WIDGET(value); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
21 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
22 if (GNT_IS_BOX(w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
23 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
|
24 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
|
25 box->focus = g_list_append(box->focus, w); |
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 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
28 static void |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
29 get_title_thingies(GntBox *box, char *title, int *p, int *r) |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
30 { |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
31 GntWidget *widget = GNT_WIDGET(box); |
14417
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
32 int len; |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14417
diff
changeset
|
33 char *end = (char*)gnt_util_onscreen_width_to_pointer(title, widget->priv.width - 4, &len); |
14417
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
34 |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
35 if (p) |
14417
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
36 *p = (widget->priv.width - len) / 2; |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
37 if (r) |
14417
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
38 *r = (widget->priv.width + len) / 2; |
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14396
diff
changeset
|
39 *end = '\0'; |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
40 } |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
41 |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
42 static void |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 gnt_box_draw(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
47 if (box->focus == NULL && widget->parent == NULL) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
48 g_list_foreach(box->list, add_to_focus, box); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
49 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
50 g_list_foreach(box->list, (GFunc)gnt_widget_draw, NULL); |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
51 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
52 gnt_box_sync_children(box); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 |
14337
1a500db56415
[gaim-migrate @ 17033]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14041
diff
changeset
|
54 if (box->title && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 { |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
56 int pos, right; |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
57 char *title = g_strdup(box->title); |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
58 |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
59 get_title_thingies(box, title, &pos, &right); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
60 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
61 if (gnt_widget_has_focus(widget)) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
62 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE)); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
63 else |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
64 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
|
65 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
|
66 mvwprintw(widget->window, 0, pos, title); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
67 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
|
68 g_free(title); |
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 |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
71 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 } |
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 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 reposition_children(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 GList *iter; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 int w, h, curx, cury, max; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 gboolean has_border = FALSE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 w = h = 0; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
83 max = 0; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
84 curx = widget->priv.x; |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
85 cury = widget->priv.y; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 has_border = TRUE; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
89 curx += 1; |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
90 cury += 1; |
13850
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 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 for (iter = box->list; iter; iter = iter->next) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 { |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
95 if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(iter->data), GNT_WIDGET_INVISIBLE)) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
96 continue; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 gnt_widget_set_position(GNT_WIDGET(iter->data), curx, cury); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 if (box->vertical) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
101 if (h) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
102 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
103 cury += h + box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
104 if (max < w) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
105 max = w; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
106 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 else |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
110 if (w) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
111 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
112 curx += w + box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
113 if (max < h) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
114 max = h; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
115 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 if (has_border) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 { |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
121 curx += 1; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 cury += 1; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 max += 2; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
126 if (box->list) |
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 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
129 cury -= box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
130 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
131 curx -= box->pad; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
132 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
133 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 if (box->vertical) |
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 = max; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 widget->priv.height = cury - widget->priv.y; |
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 else |
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 widget->priv.width = curx - widget->priv.x; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 widget->priv.height = max; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 gnt_box_set_position(GntWidget *widget, int x, int y) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
149 GList *iter; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
150 int changex, changey; |
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 changex = widget->priv.x - x; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
153 changey = widget->priv.y - y; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
154 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
155 for (iter = GNT_BOX(widget)->list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
156 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
157 GntWidget *w = GNT_WIDGET(iter->data); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
158 gnt_widget_set_position(w, w->priv.x - changex, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
159 w->priv.y - changey); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
160 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 gnt_box_size_request(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 GList *iter; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
168 int maxw = 0, maxh = 0; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 g_list_foreach(box->list, (GFunc)gnt_widget_size_request, NULL); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
172 for (iter = box->list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
173 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
174 int w, h; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
175 gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
176 if (maxh < h) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
177 maxh = h; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
178 if (maxw < w) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
179 maxw = w; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
180 } |
13953
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 for (iter = box->list; iter; iter = iter->next) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 { |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
184 int w, h; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
185 GntWidget *wid = GNT_WIDGET(iter->data); |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
186 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
187 gnt_widget_get_size(wid, &w, &h); |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
188 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
189 if (box->homogeneous) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
191 if (box->vertical) |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
192 h = maxh; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
193 else |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
194 w = maxw; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 } |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
196 if (box->fill) |
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 if (box->vertical) |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
199 w = maxw; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
200 else |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
201 h = maxh; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
202 } |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
203 |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
204 gnt_widget_set_size(wid, w, h); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 reposition_children(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 gnt_box_map(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 if (widget->priv.width == 0 || widget->priv.height == 0) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
214 { |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 gnt_widget_size_request(widget); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
216 find_focusable_widget(GNT_BOX(widget)); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
217 } |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
218 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
221 /* Ensures that the current widget can take focus */ |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
222 static GntWidget * |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
223 find_focusable_widget(GntBox *box) |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
224 { |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
225 /* XXX: Make sure the widget is visible? */ |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
226 if (box->focus == NULL && GNT_WIDGET(box)->parent == NULL) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
227 g_list_foreach(box->list, add_to_focus, box); |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
228 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
229 if (box->active == NULL && box->focus) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
230 box->active = box->focus->data; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
231 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
232 return box->active; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
233 } |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
234 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
235 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
236 find_next_focus(GntBox *box) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
237 { |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
238 gpointer last = box->active; |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
239 do |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
240 { |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
241 GList *iter = g_list_find(box->focus, box->active); |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
242 if (iter && iter->next) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
243 box->active = iter->next->data; |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
244 else if (box->focus) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
245 box->active = box->focus->data; |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
246 if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
247 break; |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
248 } while (box->active != last); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
249 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
250 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
251 static void |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
252 find_prev_focus(GntBox *box) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
253 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
254 gpointer last = box->active; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
255 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
256 if (!box->focus) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
257 return; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
258 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
259 do |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
260 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
261 GList *iter = g_list_find(box->focus, box->active); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
262 if (!iter) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
263 box->active = box->focus->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
264 else if (!iter->prev) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
265 box->active = g_list_last(box->focus)->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
266 else |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
267 box->active = iter->prev->data; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
268 if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
269 break; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
270 } while (box->active != last); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
271 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
272 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 static gboolean |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 gnt_box_key_pressed(GntWidget *widget, const char *text) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 GntBox *box = GNT_BOX(widget); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
277 GntWidget *now; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
279 if (box->active == NULL && !find_focusable_widget(box)) |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13854
diff
changeset
|
280 return FALSE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
282 if (gnt_widget_key_pressed(box->active, text)) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 return TRUE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
285 now = box->active; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
286 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 if (text[0] == 27) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 if (strcmp(text+1, GNT_KEY_LEFT) == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 { |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
291 find_prev_focus(box); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 else if (strcmp(text+1, GNT_KEY_RIGHT) == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
295 find_next_focus(box); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 } |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
297 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
298 else if (text[0] == '\t') |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
299 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
300 find_next_focus(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
301 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
303 if (now && now != box->active) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
304 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
305 gnt_widget_set_focus(now, FALSE); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
306 gnt_widget_set_focus(box->active, TRUE); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
307 return TRUE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 return FALSE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
313 static void |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
314 gnt_box_lost_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
315 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
316 GntWidget *w = GNT_BOX(widget)->active; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
317 if (w) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
318 gnt_widget_set_focus(w, FALSE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
319 gnt_widget_draw(widget); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 static void |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
323 gnt_box_gained_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
324 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
325 GntWidget *w = GNT_BOX(widget)->active; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
326 if (w) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
327 gnt_widget_set_focus(w, TRUE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
328 gnt_widget_draw(widget); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
329 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
330 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
331 static void |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 gnt_box_destroy(GntWidget *w) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 GntBox *box = GNT_BOX(w); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
336 gnt_box_remove_all(box); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
337 gnt_screen_release(w); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 static void |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
341 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
|
342 { |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
343 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
|
344 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
|
345 wrefresh(win); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
346 delwin(win); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
347 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
348 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
349 static gboolean |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
350 gnt_box_confirm_size(GntWidget *widget, int width, int height) |
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 GList *iter; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
353 GntBox *box = GNT_BOX(widget); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
354 int wchange, hchange; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
355 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
356 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
|
357 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
358 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
|
359 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
360 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
361 if (!box->list) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
362 return TRUE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
363 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
364 wchange = widget->priv.width - width; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
365 hchange = widget->priv.height - height; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
366 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
367 if (wchange == 0 && hchange == 0) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
368 return TRUE; /* Quit playing games */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
369 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
370 /* 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
|
371 * just one widget. It should be possible to distribute the |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
372 * changes to all the widgets in the box. */ |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
373 for (iter = box->list; iter; iter = iter->next) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
374 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
375 GntWidget *wid = iter->data; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
376 int w, h; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
377 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
378 gnt_widget_get_size(wid, &w, &h); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
379 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
380 if (gnt_widget_confirm_size(wid, w - wchange, h - hchange)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
381 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
382 GList *i; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
383 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
384 for (i = box->list; i; i = i->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
385 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
386 int tw, th; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
387 if (i == iter) continue; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
388 gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
389 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
390 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
391 if (!gnt_widget_confirm_size(i->data, tw - wchange, th)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
392 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
393 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
394 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
395 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
396 if (!gnt_widget_confirm_size(i->data, tw, th - hchange)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
397 return FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
398 } |
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 #if 0 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
401 gnt_widget_set_size(wid, w - wchange, h - hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
402 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
403 hchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
404 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
405 wchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
406 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
407 for (i = box->list; i; i = i->next) |
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 int tw, th; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
410 if (i == iter) continue; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
411 gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
412 gnt_widget_set_size(i->data, tw - wchange, th - hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
413 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
414 #endif |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
415 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
|
416 return TRUE; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
417 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
418 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
419 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
420 return FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
421 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
422 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
423 static void |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
424 gnt_box_size_changed(GntWidget *widget, int oldw, int oldh) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
425 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
426 int wchange, hchange; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
427 GList *i; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
428 GntBox *box = GNT_BOX(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
429 GntWidget *wid; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
430 int tw, th; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
431 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
432 wchange = widget->priv.width - oldw; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
433 hchange = widget->priv.height - oldh; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
434 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
435 wid = g_object_get_data(G_OBJECT(box), "size-queued"); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
436 if (wid) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
437 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
438 gnt_widget_get_size(wid, &tw, &th); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
439 gnt_widget_set_size(wid, tw + wchange, th + hchange); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
440 g_object_set_data(G_OBJECT(box), "size-queued", NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
441 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
442 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
443 if (box->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
444 hchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
445 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
446 wchange = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
447 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
448 for (i = box->list; i; i = i->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
449 { |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
450 if (wid != i->data) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
451 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
452 gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
453 gnt_widget_set_size(i->data, tw + wchange, th + hchange); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
454 } |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
455 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
456 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
457 reposition_children(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
458 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
459 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
460 static gboolean |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
461 gnt_box_clicked(GntWidget *widget, GntMouseEvent event, int cx, int cy) |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
462 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
463 GList *iter; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
464 for (iter = GNT_BOX(widget)->list; iter; iter = iter->next) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
465 int x, y, w, h; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
466 GntWidget *wid = iter->data; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
467 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
468 gnt_widget_get_position(wid, &x, &y); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
469 gnt_widget_get_size(wid, &w, &h); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
470 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
471 if (cx >= x && cx < x + w && cy >= y && cy < y + h) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
472 if (event <= GNT_MIDDLE_MOUSE_DOWN && |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
473 GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_CAN_TAKE_FOCUS)) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
474 while (widget->parent) |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
475 widget = widget->parent; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
476 gnt_box_give_focus_to_child(GNT_BOX(widget), wid); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
477 } |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
478 return gnt_widget_clicked(wid, event, cx, cy); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
479 } |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
480 } |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
481 return FALSE; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
482 } |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
483 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
484 static void |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
485 gnt_box_class_init(GntBoxClass *klass) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
486 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
487 parent_class = GNT_WIDGET_CLASS(klass); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
488 parent_class->destroy = gnt_box_destroy; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
489 parent_class->draw = gnt_box_draw; |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13866
diff
changeset
|
490 parent_class->expose = gnt_box_expose; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
491 parent_class->map = gnt_box_map; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
492 parent_class->size_request = gnt_box_size_request; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
493 parent_class->set_position = gnt_box_set_position; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
494 parent_class->key_pressed = gnt_box_key_pressed; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
495 parent_class->clicked = gnt_box_clicked; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
496 parent_class->lost_focus = gnt_box_lost_focus; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13888
diff
changeset
|
497 parent_class->gained_focus = gnt_box_gained_focus; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
498 parent_class->confirm_size = gnt_box_confirm_size; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
499 parent_class->size_changed = gnt_box_size_changed; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
500 |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
501 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
502 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
503 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 gnt_box_init(GTypeInstance *instance, gpointer class) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 { |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
507 /* Initially make both the height and width resizable. |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
508 * 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
|
509 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y); |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
510 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
511 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
512 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
513 /****************************************************************************** |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
514 * GntBox API |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
515 *****************************************************************************/ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 GType |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 gnt_box_get_gtype(void) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
519 static GType type = 0; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
520 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 if(type == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
522 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 static const GTypeInfo info = { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 sizeof(GntBoxClass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 NULL, /* base_init */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 NULL, /* base_finalize */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 (GClassInitFunc)gnt_box_class_init, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 NULL, /* class_finalize */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 NULL, /* class_data */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 sizeof(GntBox), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 0, /* n_preallocs */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 gnt_box_init, /* instance_init */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 type = g_type_register_static(GNT_TYPE_WIDGET, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
536 "GntBox", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 &info, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
538 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
539 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
540 return type; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
541 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
542 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
543 GntWidget *gnt_box_new(gboolean homo, gboolean vert) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
544 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
545 GntWidget *widget = g_object_new(GNT_TYPE_BOX, NULL); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
546 GntBox *box = GNT_BOX(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 box->homogeneous = homo; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
549 box->vertical = vert; |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
550 box->pad = 1; |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
551 box->fill = TRUE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
552 gnt_widget_set_take_focus(widget, TRUE); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
553 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
|
554 if (vert) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
555 box->alignment = GNT_ALIGN_LEFT; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
556 else |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
557 box->alignment = GNT_ALIGN_MID; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
559 return widget; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 void gnt_box_add_widget(GntBox *b, GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
563 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 b->list = g_list_append(b->list, widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
565 widget->parent = GNT_WIDGET(b); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
566 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
567 if (b->vertical) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
568 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
569 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
|
570 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
|
571 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
572 else |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
573 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
574 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
|
575 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
|
576 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
577 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
578 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
579 void gnt_box_set_title(GntBox *b, const char *title) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
580 { |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
581 char *prev = b->title; |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
582 GntWidget *w = GNT_WIDGET(b); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
583 b->title = g_strdup(title); |
14389
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
584 if (w->window && !GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_NO_BORDER)) { |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
585 /* Erase the old title */ |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
586 int pos, right; |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
587 get_title_thingies(b, prev, &pos, &right); |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
588 mvwhline(w->window, 0, pos - 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
589 right - pos + 2); |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
590 g_free(prev); |
746d535e9053
[gaim-migrate @ 17095]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
591 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
593 |
13853
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
594 void gnt_box_set_pad(GntBox *box, int pad) |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
595 { |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
596 box->pad = pad; |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
597 /* XXX: Perhaps redraw if already showing? */ |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
598 } |
bbf0470cb348
[gaim-migrate @ 16312]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
599 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
600 void gnt_box_set_toplevel(GntBox *box, gboolean set) |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
601 { |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
602 GntWidget *widget = GNT_WIDGET(box); |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
603 if (set) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
604 { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
605 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
|
606 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
607 } |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
608 else |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
609 { |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
610 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
|
611 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
612 } |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
613 } |
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13855
diff
changeset
|
614 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
615 void gnt_box_sync_children(GntBox *box) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
616 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
617 GList *iter; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
618 GntWidget *widget = GNT_WIDGET(box); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
619 int pos = 1; |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
620 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
621 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
|
622 pos = 0; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
623 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
624 for (iter = box->list; iter; iter = iter->next) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
625 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
626 GntWidget *w = GNT_WIDGET(iter->data); |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
627 int height, width; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
628 int x, y; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
629 |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
630 if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_INVISIBLE)) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
631 continue; |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
632 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
633 if (GNT_IS_BOX(w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
634 gnt_box_sync_children(GNT_BOX(w)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
635 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
636 gnt_widget_get_size(w, &width, &height); |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
637 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
638 x = w->priv.x - widget->priv.x; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
639 y = w->priv.y - widget->priv.y; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
640 |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
641 if (box->vertical) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
642 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
643 x = pos; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
644 if (box->alignment == GNT_ALIGN_RIGHT) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
645 x += widget->priv.width - width; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
646 else if (box->alignment == GNT_ALIGN_MID) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
647 x += (widget->priv.width - width)/2; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
648 if (x + width > widget->priv.width - pos) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
649 x -= x + width - (widget->priv.width - pos); |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
650 } |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
651 else |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
652 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
653 y = pos; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
654 if (box->alignment == GNT_ALIGN_BOTTOM) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
655 y += widget->priv.height - height; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
656 else if (box->alignment == GNT_ALIGN_MID) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
657 y += (widget->priv.height - height)/2; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
658 if (y + height >= widget->priv.height - pos) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
659 y = widget->priv.height - height - pos; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
660 } |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
661 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
662 copywin(w->window, widget->window, 0, 0, |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
663 y, x, y + height - 1, x + width - 1, FALSE); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14337
diff
changeset
|
664 gnt_widget_set_position(w, x + widget->priv.x, y + widget->priv.y); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
665 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
666 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
667 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
668 void gnt_box_set_alignment(GntBox *box, GntAlignment alignment) |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
669 { |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
670 box->alignment = alignment; |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
671 } |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
672 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
673 void gnt_box_remove(GntBox *box, GntWidget *widget) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
674 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
675 box->list = g_list_remove(box->list, widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
676 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
|
677 && GNT_WIDGET(box)->parent == NULL && box->focus) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
678 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
679 if (widget == box->active) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
680 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
681 find_next_focus(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
682 if (box->active == widget) /* There's only one widget */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
683 box->active = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
684 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
685 box->focus = g_list_remove(box->focus, widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
686 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
687 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
688 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
|
689 gnt_widget_draw(GNT_WIDGET(box)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
690 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
691 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
692 void gnt_box_remove_all(GntBox *box) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
693 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
694 g_list_foreach(box->list, (GFunc)gnt_widget_destroy, NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
695 g_list_free(box->list); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
696 g_list_free(box->focus); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
697 box->list = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
698 box->focus = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
699 GNT_WIDGET(box)->priv.width = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
700 GNT_WIDGET(box)->priv.height = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
701 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
702 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
703 void gnt_box_readjust(GntBox *box) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
704 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
705 GList *iter; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
706 GntWidget *wid; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
707 int width, height; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
708 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
709 g_return_if_fail(GNT_WIDGET(box)->parent == NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
710 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
711 for (iter = box->list; iter; iter = iter->next) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
712 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
713 GntWidget *w = iter->data; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
714 if (GNT_IS_BOX(w)) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
715 gnt_box_readjust(GNT_BOX(w)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
716 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
717 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
718 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_MAPPED); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
719 w->priv.width = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
720 w->priv.height = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
721 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
722 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
723 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
724 wid = GNT_WIDGET(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
725 GNT_WIDGET_UNSET_FLAGS(wid, GNT_WIDGET_MAPPED); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
726 wid->priv.width = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
727 wid->priv.height = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
728 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
729 if (wid->parent == NULL) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
730 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
731 g_list_free(box->focus); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
732 box->focus = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
733 box->active = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
734 gnt_widget_size_request(wid); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
735 gnt_widget_get_size(wid, &width, &height); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
736 gnt_screen_resize_widget(wid, width, height); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
737 find_focusable_widget(box); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
738 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
739 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
740 |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
741 void gnt_box_set_fill(GntBox *box, gboolean fill) |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
742 { |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
743 box->fill = fill; |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
744 } |
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
745 |
14041
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
746 void gnt_box_move_focus(GntBox *box, int dir) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
747 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
748 GntWidget *now; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
749 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
750 if (box->active == NULL) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
751 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
752 find_focusable_widget(box); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
753 return; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
754 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
755 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
756 now = box->active; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
757 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
758 if (dir == 1) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
759 find_next_focus(box); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
760 else if (dir == -1) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
761 find_prev_focus(box); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
762 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
763 if (now && now != box->active) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
764 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
765 gnt_widget_set_focus(now, FALSE); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
766 gnt_widget_set_focus(box->active, TRUE); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
767 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
768 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
769 if (GNT_WIDGET(box)->window) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
770 gnt_widget_draw(GNT_WIDGET(box)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
771 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
772 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
773 void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
774 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
775 GList *find = g_list_find(box->focus, widget); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
776 gpointer now = box->active; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
777 if (find) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
778 box->active = widget; |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
779 if (now && now != box->active) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
780 { |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
781 gnt_widget_set_focus(now, FALSE); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
782 gnt_widget_set_focus(box->active, TRUE); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
783 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
784 |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
785 if (GNT_WIDGET(box)->window) |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
786 gnt_widget_draw(GNT_WIDGET(box)); |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
787 } |
27182f83b79b
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
788 |