Mercurial > pidgin
annotate console/libgnt/test/focus.c @ 13953:8b2306c64efa
[gaim-migrate @ 16501]
Minor adjustments to the packing of child widgets in a box.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 17 Jul 2006 04:30:50 +0000 |
parents | 25be562aaca8 |
children | a06f7495af6f |
rev | line source |
---|---|
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntbutton.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include "gnt.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #include "gntkeys.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include "gnttree.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include "gntbox.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include "gntentry.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include "gntlabel.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
9 static void |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
10 toggled(GntWidget *tree, gpointer key, gpointer null) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
11 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
12 GntWidget *w = gnt_box_new(FALSE, FALSE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
13 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
14 gnt_box_set_toplevel(GNT_BOX(w), TRUE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
15 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
16 gnt_box_add_widget(GNT_BOX(w), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
17 gnt_label_new(gnt_tree_get_choice(GNT_TREE(tree), key) ? "Selected" : "NOT")); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
18 gnt_widget_show(w); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
19 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
20 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 int main() |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
23 freopen(".error", "w", stderr); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 gnt_init(); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 GntWidget *label = gnt_label_new("So wassup dudes and dudettes!!\nSo this is, like,\nthe third line!! \\o/"); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
27 GntWidget *vbox, *hbox, *tree, *box, *button; |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 WINDOW *test; |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 box(stdscr, 0, 0); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 wrefresh(stdscr); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 vbox = gnt_box_new(FALSE, FALSE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
34 hbox = gnt_box_new(FALSE, TRUE); |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
35 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 gnt_widget_set_name(vbox, "vbox"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 gnt_widget_set_name(hbox, "hbox"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 gnt_box_add_widget(GNT_BOX(hbox), label); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
41 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
42 GntWidget *entry = gnt_entry_new("a"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
43 gnt_widget_set_name(entry, "entry"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
44 gnt_box_add_widget(GNT_BOX(hbox), entry); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
46 box = gnt_box_new(FALSE, FALSE); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 tree = gnt_tree_new(); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
48 gnt_widget_set_name(tree, "tree"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
49 gnt_box_add_widget(GNT_BOX(box), tree); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
50 gnt_box_add_widget(GNT_BOX(hbox), box); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 gnt_tree_add_row_after(GNT_TREE(tree), "a", "a", NULL, NULL); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 gnt_tree_add_row_after(GNT_TREE(tree), "c", "c", NULL, NULL); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 gnt_tree_add_row_after(GNT_TREE(tree), "d", "d", NULL, NULL); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 gnt_tree_add_row_after(GNT_TREE(tree), "e", "e", "a", NULL); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
56 gnt_tree_add_choice(GNT_TREE(tree), "b", "b", "d", NULL); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 GNT_WIDGET_UNSET_FLAGS(hbox, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 gnt_box_set_title(GNT_BOX(hbox), "This is the title …"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
61 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
62 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(toggled), NULL); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
63 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
64 button = gnt_button_new("one"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
65 gnt_widget_set_name(button, "one"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
66 gnt_box_add_widget(GNT_BOX(vbox), button); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
67 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
68 button = gnt_button_new("two"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
69 gnt_widget_set_name(button, "two"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
70 gnt_box_add_widget(GNT_BOX(vbox), button); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
71 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
72 button = gnt_button_new("three"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
73 gnt_widget_set_name(button, "three"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
74 gnt_box_add_widget(GNT_BOX(vbox), button); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
75 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
76 gnt_box_add_widget(GNT_BOX(hbox), vbox); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
77 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 gnt_widget_show(hbox); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 gnt_main(); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
82 gnt_quit(); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
83 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 return 0; |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 } |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |