33 #include <ucx/buffer.h> |
33 #include <ucx/buffer.h> |
34 #include <ucx/utils.h> |
34 #include <ucx/utils.h> |
35 |
35 |
36 void action_menu(UiEvent *event, void *data) { |
36 void action_menu(UiEvent *event, void *data) { |
37 printf("action_menu\n"); |
37 printf("action_menu\n"); |
|
38 fflush(stdout); |
38 } |
39 } |
39 |
40 |
40 void action_button(UiEvent *event, void *data) { |
41 void action_button(UiEvent *event, void *data) { |
41 printf("action_button\n"); |
42 printf("action_button\n"); |
|
43 fflush(stdout); |
42 } |
44 } |
43 |
45 |
|
46 void draw(UiEvent *event, UiGraphics *g, void *data) { |
|
47 printf("draw: %d, %d\n", g->width, g->height); |
|
48 fflush(stdout); |
|
49 |
|
50 ui_graphics_color(g, 200, 240, 240); |
|
51 ui_draw_rect(g, 0, 0, 50, g->height, TRUE); |
|
52 |
|
53 ui_graphics_color(g, 150, 150, 200); |
|
54 ui_draw_rect(g, 50, 0, g->width - 50, g->height, TRUE); |
|
55 |
|
56 ui_graphics_color(g, 0, 0, 0); |
|
57 ui_draw_line(g, 0, 10, 100, 10); |
|
58 ui_draw_line(g, 0, 10, 10, 50); |
|
59 ui_draw_line(g, 10, 50, 50, 50); |
|
60 ui_draw_line(g, 50, 50, 100, 100); |
|
61 |
|
62 ui_draw_rect(g, 15, 15, 80, 80, FALSE); |
|
63 } |
44 |
64 |
45 void application_startup(UiEvent *event, void *data) { |
65 void application_startup(UiEvent *event, void *data) { |
46 UiObject *obj = ui_window("Test", NULL); |
66 UiObject *obj = ui_window("Test", NULL); |
47 |
67 |
48 ui_grid_sp(obj, 10, 10, 10); |
68 ui_grid_sp(obj, 10, 10, 10); |
55 |
75 |
56 ui_label(obj, "Test2"); |
76 ui_label(obj, "Test2"); |
57 ui_layout_hexpand(obj, TRUE); |
77 ui_layout_hexpand(obj, TRUE); |
58 ui_layout_vexpand(obj, TRUE); |
78 ui_layout_vexpand(obj, TRUE); |
59 ui_layout_gridwidth(obj, 2); |
79 ui_layout_gridwidth(obj, 2); |
60 ui_textarea(obj, NULL); |
80 |
|
81 ui_drawingarea(obj, draw, NULL); |
61 |
82 |
62 ui_newline(obj); |
83 ui_newline(obj); |
63 |
84 |
64 ui_end(obj); |
85 ui_end(obj); |
65 |
86 |
82 ui_menuitem("item4", action_menu, NULL); |
103 ui_menuitem("item4", action_menu, NULL); |
83 |
104 |
84 // toolbar |
105 // toolbar |
85 ui_toolitem("button1", "Test1", action_button, NULL); |
106 ui_toolitem("button1", "Test1", action_button, NULL); |
86 ui_toolitem("button2", "Test2", action_button, NULL); |
107 ui_toolitem("button2", "Test2", action_button, NULL); |
|
108 ui_toolitem("button3", "Test3", action_button, NULL); |
|
109 ui_toolitem("button4", "Test4", action_button, NULL); |
|
110 ui_toolitem("button5", "Test5", action_button, NULL); |
|
111 ui_toolitem("button6", "Test6", action_button, NULL); |
|
112 ui_toolitem("button7", "Test7", action_button, NULL); |
87 ui_toolbar_add_default("button1"); |
113 ui_toolbar_add_default("button1"); |
88 ui_toolbar_add_default("button2"); |
114 ui_toolbar_add_default("button2"); |
|
115 ui_toolbar_add_default("button3"); |
|
116 ui_toolbar_add_default("button4"); |
|
117 ui_toolbar_add_default("button5"); |
|
118 ui_toolbar_add_default("button6"); |
|
119 ui_toolbar_add_default("button7"); |
89 |
120 |
90 ui_main(); |
121 ui_main(); |
91 |
122 |
92 return (EXIT_SUCCESS); |
123 return (EXIT_SUCCESS); |
93 } |
124 } |