15817
|
1 #include "gntbutton.h"
|
|
2 #include "gnt.h"
|
|
3 #include "gntkeys.h"
|
|
4 #include "gnttree.h"
|
|
5 #include "gntbox.h"
|
|
6 #include "gntentry.h"
|
|
7 #include "gntlabel.h"
|
|
8
|
|
9 static void
|
|
10 toggled(GntWidget *tree, gpointer key, gpointer null)
|
|
11 {
|
|
12 GntWidget *w = gnt_box_new(FALSE, FALSE);
|
|
13
|
|
14 gnt_box_set_toplevel(GNT_BOX(w), TRUE);
|
|
15
|
|
16 gnt_box_add_widget(GNT_BOX(w),
|
|
17 gnt_label_new(gnt_tree_get_choice(GNT_TREE(tree), key) ? "Selected" : "NOT"));
|
|
18 gnt_widget_show(w);
|
|
19 }
|
|
20
|
|
21 int main()
|
|
22 {
|
|
23 #ifdef STANDALONE
|
|
24 freopen(".error", "w", stderr);
|
|
25 gnt_init();
|
|
26 #endif
|
|
27
|
|
28 GntWidget *label = gnt_label_new("So wassup dudes and dudettes!!\u4e0a1\u6d772\u67003\u4f4e4\u67085\nSo this is, like,\nthe third line!! \\o/");
|
|
29 GntWidget *vbox, *hbox, *tree, *box, *button;
|
|
30 WINDOW *test;
|
|
31
|
|
32 vbox = gnt_box_new(FALSE, FALSE);
|
|
33 hbox = gnt_box_new(FALSE, TRUE);
|
|
34 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID);
|
|
35
|
|
36 gnt_widget_set_name(vbox, "vbox");
|
|
37 gnt_widget_set_name(hbox, "hbox");
|
|
38
|
|
39 gnt_box_add_widget(GNT_BOX(hbox), label);
|
|
40
|
|
41 GntWidget *entry = gnt_entry_new("a");
|
|
42 gnt_widget_set_name(entry, "entry");
|
|
43 gnt_box_add_widget(GNT_BOX(hbox), entry);
|
|
44
|
|
45 box = gnt_box_new(FALSE, FALSE);
|
|
46 tree = gnt_tree_new();
|
|
47 gnt_tree_set_compare_func(GNT_TREE(tree), g_utf8_collate);
|
|
48 gnt_widget_set_name(tree, "tree");
|
|
49 gnt_box_add_widget(GNT_BOX(box), tree);
|
|
50 gnt_box_add_widget(GNT_BOX(hbox), box);
|
|
51
|
|
52 gnt_tree_add_row_after(GNT_TREE(tree), "c", gnt_tree_create_row(GNT_TREE(tree), "c"), NULL, NULL);
|
|
53 gnt_tree_add_row_after(GNT_TREE(tree), "a", gnt_tree_create_row(GNT_TREE(tree), "a"), NULL, NULL);
|
|
54 gnt_tree_add_row_after(GNT_TREE(tree), "z", gnt_tree_create_row(GNT_TREE(tree), "z"), "a", NULL);
|
|
55 gnt_tree_add_row_after(GNT_TREE(tree), "y", gnt_tree_create_row(GNT_TREE(tree), "y"), "a", NULL);
|
|
56 gnt_tree_add_row_after(GNT_TREE(tree), "g", gnt_tree_create_row(GNT_TREE(tree), "g"), "a", NULL);
|
|
57 gnt_tree_add_row_after(GNT_TREE(tree), "d", gnt_tree_create_row(GNT_TREE(tree), "d"), NULL, NULL);
|
|
58 gnt_tree_add_row_after(GNT_TREE(tree), "x", gnt_tree_create_row(GNT_TREE(tree), "x"), "a", NULL);
|
|
59 gnt_tree_add_row_after(GNT_TREE(tree), "k", gnt_tree_create_row(GNT_TREE(tree), "k"), "a", NULL);
|
|
60 gnt_tree_add_row_after(GNT_TREE(tree), "e", gnt_tree_create_row(GNT_TREE(tree), "e"), "a", NULL);
|
|
61 gnt_tree_add_choice(GNT_TREE(tree), "b", gnt_tree_create_row(GNT_TREE(tree), "b"), "d", NULL);
|
|
62
|
|
63 GNT_WIDGET_UNSET_FLAGS(hbox, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
|
|
64 gnt_box_set_title(GNT_BOX(hbox), "\u4e0a\u6d77\u6700\u4f4e\u6708\u5de5 \u4e0a\u6d77\u6700\u4f4e\u6708\u5de5 ……\u4e0a\u6d77\u6700\u4f4e\u6708\u5de5 …");
|
|
65
|
|
66 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(toggled), NULL);
|
|
67
|
|
68 button = gnt_button_new("one");
|
|
69 gnt_widget_set_name(button, "one");
|
|
70 gnt_box_add_widget(GNT_BOX(vbox), button);
|
|
71
|
|
72 button = gnt_button_new("two");
|
|
73 gnt_widget_set_name(button, "two");
|
|
74 gnt_box_add_widget(GNT_BOX(vbox), button);
|
|
75
|
|
76 button = gnt_button_new("three");
|
|
77 gnt_widget_set_name(button, "three");
|
|
78 gnt_box_add_widget(GNT_BOX(vbox), button);
|
|
79
|
|
80 gnt_box_add_widget(GNT_BOX(hbox), vbox);
|
|
81
|
|
82 gnt_widget_show(hbox);
|
|
83
|
|
84 #ifdef STANDALONE
|
|
85 gnt_main();
|
|
86
|
|
87 gnt_quit();
|
|
88 #endif
|
|
89
|
|
90 return 0;
|
|
91 }
|
|
92
|