Rev 6690 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6690 | Rev 8581 | ||
---|---|---|---|
Line 20... | Line 20... | ||
20 | #include "kolibri_gui.h" |
20 | #include "kolibri_gui.h" |
21 | #include "kolibri_libimg.h" |
21 | #include "kolibri_libimg.h" |
22 | #include "kolibri_msgbox.h" |
22 | #include "kolibri_msgbox.h" |
23 | 23 | ||
Line -... | Line 24... | ||
- | 24 | /*extern inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, |
|
- | 25 | uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color); |
|
- | 26 | ||
- | 27 | extern inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, |
|
- | 28 | uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color); |
|
- | 29 | ||
- | 30 | extern inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position); |
|
- | 31 | */ |
|
24 | char run_path[4096]; |
32 | char run_path[4096]; |
25 | char fname[4096]; |
33 | char fname[4096]; |
Line 26... | Line 34... | ||
26 | 34 | ||
27 | char* load_file_inmem(char* fname, int32_t* read_sz); // see below |
35 | char* load_file_inmem(char* fname, int32_t* read_sz); // see below |
Line 81... | Line 89... | ||
81 | // treelist as tree |
89 | // treelist as tree |
82 | treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, /*TL_KEY_NO_EDIT |*/ TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
90 | treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, /*TL_KEY_NO_EDIT |*/ TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
83 | (*tl_data_init)(tl); |
91 | (*tl_data_init)(tl); |
Line 84... | Line 92... | ||
84 | 92 | ||
85 | // ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè |
93 | // ������ ���� � ��������� � ������� |
86 | strcpy(fname, run_path); |
94 | strcpy(fname, run_path); |
87 | strcat(fname, "tl_sys_16.png"); |
95 | strcat(fname, "tl_sys_16.png"); |
Line 88... | Line 96... | ||
88 | tl->data_img_sys = load_image_file(fname); |
96 | tl->data_img_sys = load_image_file(fname); |
89 | 97 | ||
90 | // ÷èòàåì ôàéë ñ èêîíêàìè óçëîâ |
98 | // ������ ���� � �������� ����� |
91 | strcpy(fname, run_path); |
99 | strcpy(fname, run_path); |
Line 92... | Line 100... | ||
92 | strcat(fname, "tl_nod_16.png"); |
100 | strcat(fname, "tl_nod_16.png"); |
93 | tl->data_img = load_image_file(fname); |
101 | tl->data_img = load_image_file(fname); |
94 | 102 | ||
95 | treelist_node_add(tl, "node1", 1, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé |
103 | treelist_node_add(tl, "node1", 1, 0, 0); // ��� 1 ����� ������ � ������ |
96 | (*tl_cur_next)(tl); |
104 | (*tl_cur_next)(tl); |
97 | treelist_node_add(tl, "node1.1", 1, 0, 1); |
105 | treelist_node_add(tl, "node1.1", 1, 0, 1); |
Line 108... | Line 116... | ||
108 | 116 | ||
Line 109... | Line 117... | ||
109 | treelist_node_add(tl, "node3", 1, 0, 0); |
117 | treelist_node_add(tl, "node3", 1, 0, 0); |
110 | (*tl_cur_next)(tl); |
118 | (*tl_cur_next)(tl); |
Line 111... | Line 119... | ||
111 | 119 | ||
112 | (*tl_cur_beg)(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà |
120 | (*tl_cur_beg)(tl); //;������ ������ �� ������ ������ |
Line 113... | Line 121... | ||
113 | gui_add_treelist(main_window, tl); |
121 | gui_add_treelist(main_window, tl); |
114 | 122 | ||
115 | // treelist as listbox, no caption, no icons |
123 | // treelist as listbox, no caption, no icons |
116 | treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 0, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
124 | treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 0, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
Line 117... | Line 125... | ||
117 | (*tl_data_init)(tl2); |
125 | (*tl_data_init)(tl2); |
118 | // tl->col_zag |= 0x10000000; // 0x10 in txt color must give font 9x16, but this not work, only 6x8 font ( |
126 | // tl->col_zag |= 0x10000000; // 0x10 in txt color must give font 9x16, but this not work, only 6x8 font ( |
Line 119... | Line 127... | ||
119 | 127 | ||
120 | tl2->data_img_sys = tl->data_img_sys; |
128 | tl2->data_img_sys = tl->data_img_sys; |
Line 121... | Line 129... | ||
121 | //tl2->data_img = tl->data_img; - no icons will be drawed |
129 | //tl2->data_img = tl->data_img; - no icons will be drawed |
122 | 130 | ||
Line 123... | Line 131... | ||
123 | treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé |
131 | treelist_node_add(tl2, "list1", 0, 0, 0); // ��� 1 ����� ������ � ������ |
124 | (*tl_cur_next)(tl2); |
132 | (*tl_cur_next)(tl2); |
Line 125... | Line 133... | ||
125 | 133 | ||
126 | treelist_node_add(tl2, "list2", 0, 0, 0); |
134 | treelist_node_add(tl2, "list2", 0, 0, 0); |
Line 127... | Line 135... | ||
127 | (*tl_cur_next)(tl2); |
135 | (*tl_cur_next)(tl2); |
Line 128... | Line 136... | ||
128 | 136 | ||
Line 228... | Line 236... | ||
228 | int32_t read_bytes = -1, w, h; |
236 | int32_t read_bytes = -1, w, h; |
229 | char *image_data = 0, *image_data_rgb = 0, *filedata = 0; |
237 | char *image_data = 0, *image_data_rgb = 0, *filedata = 0; |
230 | 238 | ||
Line 231... | Line 239... | ||
231 | filedata = load_file_inmem(fname, &read_bytes); |
239 | filedata = load_file_inmem(fname, &read_bytes); |
232 | // îïðåäåëÿåì âèä èçîáðàæåíèÿ è ïåðåâîäèì åãî âî âðåìåííûé áóôåð image_data |
240 | // ���������� ��� ����������� � ��������� ��� �� ��������� ����� image_data |
233 | image_data = (*img_decode)(filedata, read_bytes, 0); |
241 | image_data = (*img_decode)(filedata, read_bytes, 0); |
234 | w = *(int*)(image_data +4); |
242 | w = *(int*)(image_data +4); |
235 | h = *(int*)(image_data +8); |
243 | h = *(int*)(image_data +8); |
236 | image_data_rgb = malloc(w * h * 3); |
244 | image_data_rgb = malloc(w * h * 3); |
237 | // ïðåîáðàçóåì èçîáðàæåíèå ê ôîðìàòó rgb |
245 | // ����������� ����������� � ������� rgb |
238 | (*img_to_rgb2)(image_data, image_data_rgb); |
246 | (*img_to_rgb2)(image_data, image_data_rgb); |
239 | // óäàëÿåì âðåìåííûé áóôåð image_data |
247 | // ������� ��������� ����� image_data |
240 | (*img_destroy)(image_data); |
248 | (*img_destroy)(image_data); |
241 | free(filedata); |
249 | free(filedata); |
Line 242... | Line 250... | ||
242 | 250 | ||
243 | return image_data_rgb; |
251 | return image_data_rgb; |