15817
|
1 #include "gnt.h"
|
|
2 #include "gntbutton.h"
|
|
3 #include "gntentry.h"
|
|
4 #include "gntkeys.h"
|
|
5 #include "gntlabel.h"
|
|
6 #include "gnttree.h"
|
|
7 #include "gntbox.h"
|
|
8
|
|
9 gboolean show(GntWidget *w)
|
|
10 {
|
|
11 return FALSE;
|
|
12 }
|
|
13
|
|
14 int main()
|
|
15 {
|
|
16 #ifdef STANDALONE
|
|
17 freopen(".error", "w", stderr);
|
|
18 gnt_init();
|
|
19 #endif
|
|
20
|
|
21 GntWidget *hbox, *tree, *box2;
|
|
22
|
|
23 hbox = gnt_box_new(FALSE, TRUE);
|
|
24 box2 = gnt_box_new(FALSE, TRUE);
|
|
25
|
|
26 gnt_widget_set_name(hbox, "hbox");
|
|
27 gnt_widget_set_name(box2, "box2");
|
|
28
|
|
29 tree = gnt_tree_new_with_columns(3);
|
|
30 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER);
|
|
31 gnt_tree_set_column_titles(GNT_TREE(tree), "12345678901234567890", "column 2", "column3");
|
|
32 gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
|
|
33 gnt_widget_set_name(tree, "tree");
|
|
34 gnt_box_add_widget(GNT_BOX(hbox), tree);
|
|
35
|
|
36 gnt_box_set_toplevel(GNT_BOX(hbox), TRUE);
|
|
37 gnt_box_set_title(GNT_BOX(hbox), "Testing the tree widget");
|
|
38
|
|
39 gnt_box_set_toplevel(GNT_BOX(box2), TRUE);
|
|
40 gnt_box_set_title(GNT_BOX(box2), "On top");
|
|
41
|
|
42 gnt_box_add_widget(GNT_BOX(box2), gnt_label_new("asdasd"));
|
|
43 gnt_box_add_widget(GNT_BOX(box2), gnt_entry_new(NULL));
|
|
44
|
|
45 gnt_widget_show(hbox);
|
|
46 gnt_widget_set_position(box2, 80, 40);
|
|
47 gnt_widget_show(box2);
|
|
48
|
|
49 gnt_tree_add_row_after(GNT_TREE(tree), "a",
|
|
50 gnt_tree_create_row(GNT_TREE(tree), "alaskdjfkashfashfah kfalkdhflsiafhlasf", " long text", "a2"), NULL, NULL);
|
|
51 gnt_tree_add_row_after(GNT_TREE(tree), "c",
|
|
52 gnt_tree_create_row(GNT_TREE(tree), "casdgertqhyeqgasfeytwfga fg arf agfwa ", " long text", "a2"), NULL, NULL);
|
|
53 gnt_tree_add_row_after(GNT_TREE(tree), "d", gnt_tree_create_row(GNT_TREE(tree), "d", " long text", "a2"), NULL, NULL);
|
|
54 gnt_tree_add_row_after(GNT_TREE(tree), "e", gnt_tree_create_row(GNT_TREE(tree), "e", " long text", "a2"), "a", NULL);
|
|
55 gnt_tree_add_row_after(GNT_TREE(tree), "b", gnt_tree_create_row(GNT_TREE(tree), "b", "this is", "a2"), "d", NULL);
|
|
56
|
|
57 gnt_tree_add_choice(GNT_TREE(tree), "1", gnt_tree_create_row(GNT_TREE(tree), "1", " long text", "a2"), NULL, NULL);
|
|
58 gnt_tree_add_row_after(GNT_TREE(tree), "2", gnt_tree_create_row(GNT_TREE(tree), "2", " long text", "a2"), NULL, NULL);
|
|
59 gnt_tree_add_row_after(GNT_TREE(tree), "3", gnt_tree_create_row(GNT_TREE(tree), "3", " long text", "a2"), NULL, NULL);
|
|
60 gnt_tree_add_row_after(GNT_TREE(tree), "4", gnt_tree_create_row(GNT_TREE(tree), "4", " long text", "a2"), "a", NULL);
|
|
61 gnt_tree_add_row_after(GNT_TREE(tree), "5", gnt_tree_create_row(GNT_TREE(tree), "5", " long text", "a2"), "d", NULL);
|
|
62
|
|
63 gnt_tree_add_row_after(GNT_TREE(tree), "6", gnt_tree_create_row(GNT_TREE(tree), "6", " long text", "a2"), "4", NULL);
|
|
64
|
|
65 int i;
|
|
66 for (i = 110; i < 430; i++)
|
|
67 {
|
|
68 char *s;
|
|
69 s = g_strdup_printf("%d", i); /* XXX: yes, leaking */
|
|
70 gnt_tree_add_row_after(GNT_TREE(tree), s, gnt_tree_create_row(GNT_TREE(tree), s, " long text", "a2"), "4", NULL);
|
|
71 }
|
|
72
|
|
73 gnt_tree_set_row_flags(GNT_TREE(tree), "e", GNT_TEXT_FLAG_DIM);
|
|
74
|
|
75 gnt_tree_set_selected(GNT_TREE(tree), "2");
|
|
76
|
|
77 g_timeout_add(5000, (GSourceFunc)show, box2);
|
|
78
|
|
79 #ifdef STANDALONE
|
|
80 gnt_main();
|
|
81
|
|
82 gnt_quit();
|
|
83 #endif
|
|
84
|
|
85 return 0;
|
|
86 }
|
|
87
|