Rev 8895 | Rev 9396 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3107 | leency | 1 | //BOX_LIB - Asper |
5598 | pavelyakov | 2 | #ifndef INCLUDE_BOX_LIB_H |
3 | #define INCLUDE_BOX_LIB_H |
||
4 | |||
5 | #ifndef INCLUDE_KOLIBRI_H |
||
6 | #include "../lib/kolibri.h" |
||
7 | #endif |
||
8 | |||
9 | #ifndef INCLUDE_DLL_H |
||
10 | #include "../lib/dll.h" |
||
11 | #endif |
||
12 | |||
3107 | leency | 13 | dword boxlib = #aEdit_box_lib; |
5503 | leency | 14 | char aEdit_box_lib[]="/sys/lib/box_lib.obj"; |
3107 | leency | 15 | |
16 | dword box_lib_init = #aboxlib_init; |
||
17 | |||
7086 | leency | 18 | dword edit_box_draw = #aEdit_box_draw; |
19 | dword edit_box_key = #aEdit_box_key; |
||
20 | dword edit_box_mouse = #aEdit_box_mouse; |
||
21 | dword edit_box_set_text = #aEdit_box_set_text; |
||
3107 | leency | 22 | |
23 | dword scrollbar_v_draw = #aScrollbar_v_draw; |
||
24 | dword scrollbar_v_mouse = #aScrollbar_v_mouse; |
||
25 | dword scrollbar_h_draw = #aScrollbar_h_draw; |
||
26 | dword scrollbar_h_mouse = #aScrollbar_h_mouse; |
||
27 | |||
7086 | leency | 28 | dword PathShow_prepare = #aPathShow_prepare; |
29 | dword PathShow_draw = #aPathShow_draw; |
||
4674 | leency | 30 | |
31 | dword progressbar_draw = #aProgressbar_draw; |
||
32 | dword progressbar_progress = #aProgressbar_progress; |
||
33 | |||
5444 | leency | 34 | dword frame_draw = #aFrame_draw; |
35 | |||
3839 | Asper | 36 | $DD 2 dup 0 |
3363 | leency | 37 | |
5520 | leency | 38 | char aEdit_box_draw [] = "edit_box"; |
5444 | leency | 39 | char aEdit_box_key [] = "edit_box_key"; |
40 | char aEdit_box_mouse[] = "edit_box_mouse"; |
||
7086 | leency | 41 | char aEdit_box_set_text[] = "edit_box_set_text"; |
3107 | leency | 42 | |
8281 | leency | 43 | char aboxlib_init[] = "lib_init"; |
5444 | leency | 44 | char aScrollbar_v_draw [] = "scrollbar_v_draw"; |
45 | char aScrollbar_v_mouse[] = "scrollbar_v_mouse"; |
||
46 | char aScrollbar_h_draw [] = "scrollbar_h_draw"; |
||
47 | char aScrollbar_h_mouse[] = "scrollbar_h_mouse"; |
||
3107 | leency | 48 | |
5444 | leency | 49 | char aPathShow_prepare [] = "PathShow_prepare"; |
50 | char aPathShow_draw [] = "PathShow_draw"; |
||
3107 | leency | 51 | |
8281 | leency | 52 | char aProgressbar_draw [] = "progressbar_draw"; |
5444 | leency | 53 | char aProgressbar_progress[] = "progressbar_progress"; |
3363 | leency | 54 | |
5444 | leency | 55 | char aFrame_draw[] = "frame_draw"; |
4674 | leency | 56 | |
5444 | leency | 57 | |
3363 | leency | 58 | struct PathShow_data |
59 | { |
||
5444 | leency | 60 | dword type; |
8895 | leency | 61 | word start_y; |
62 | word start_x; |
||
63 | word font_w; // 6 - for font 0, 8 - for font 1 |
||
64 | word area_size_x; |
||
65 | dword font_number; // 0 - monospace, 1 - variable |
||
66 | dword background_flag; |
||
67 | dword font_color; |
||
68 | dword background_color; |
||
69 | dword text_pointer; |
||
70 | dword work_area_pointer; |
||
71 | dword temp_text_length; |
||
3363 | leency | 72 | }; |
73 | /* |
||
74 | char temp[128]; |
||
75 | PathShow_data PathShow = {0, 100,20, 6, 200, 0, 1, 0x0, 0xFFFfff, #email_text, #temp, 0}; |
||
76 | PathShow_prepare stdcall(#PathShow); |
||
77 | PathShow_draw stdcall(#PathShow); |
||
78 | */ |
||
79 | |||
7422 | leency | 80 | //editbox flags |
81 | #define ed_pass 1b |
||
82 | #define ed_focus 10b //focused |
||
83 | #define ed_shift 100b //flag is set when Shift is pressed |
||
84 | #define ed_shift_on 1000b |
||
7506 | leency | 85 | #define ed_shift_bac 10000b //bit for Shift reset, if set the smth is selected |
7422 | leency | 86 | #define ed_left_fl 100000b |
87 | #define ed_offset_fl 1000000b |
||
88 | #define ed_insert 10000000b |
||
89 | #define ed_mouse_on 100000000b |
||
7506 | leency | 90 | #define ed_mouse_adn_b 100011000b |
91 | #define ed_disabled 100000000000b |
||
7422 | leency | 92 | #define ed_always_focus 100000000000000b |
7447 | leency | 93 | #define ed_figure_only 1000000000000000b //numbers only |
7422 | leency | 94 | #define ed_shift_cl 1111111111100011b |
95 | #define ed_shift_mcl 1111111111111011b |
||
96 | #define ed_shift_off 1111111111111011b |
||
97 | #define ed_shift_on_off 1111111111110111b |
||
98 | #define ed_shift_bac_cl 1111111111101111b |
||
99 | #define ed_right_fl 1111111111011111b |
||
100 | #define ed_offset_cl 1111111110111111b |
||
101 | #define ed_insert_cl 1111111101111111b |
||
102 | #define ed_mouse_on_off 1111111011111111b |
||
103 | |||
3107 | leency | 104 | struct edit_box{ |
5685 | leency | 105 | dword width, |
106 | left, |
||
107 | top, |
||
108 | color, |
||
109 | shift_color, |
||
110 | focus_border_color, |
||
111 | blur_border_color, |
||
112 | text_color, |
||
113 | max, |
||
114 | text, |
||
115 | mouse_variable, |
||
116 | flags, |
||
117 | size, |
||
118 | pos, |
||
119 | offset, |
||
120 | cl_curs_x, |
||
121 | cl_curs_y, |
||
122 | shift, |
||
6678 | leency | 123 | shift_old, |
7506 | leency | 124 | height, |
125 | char_width; |
||
3107 | leency | 126 | }; |
127 | |||
7506 | leency | 128 | :void EditBox_UpdateText(dword ed, _flags) |
129 | { |
||
130 | dword ed_text; |
||
131 | ESI = ed; |
||
7904 | leency | 132 | //ESI.edit_box.offset = ESI.edit_box.shift = ESI.edit_box.shift_old = 0; //no need because of 7904 |
7506 | leency | 133 | ESI.edit_box.flags = _flags; |
134 | ed_text = ESI.edit_box.text; |
||
7904 | leency | 135 | //ESI.edit_box.pos = //no need because of 7904 |
136 | ESI.edit_box.size = strlen(ed_text); |
||
7506 | leency | 137 | } |
138 | |||
9362 | leency | 139 | :dword EditBox_CreateStandart(dword width, left, top, maxlen, text, flags) |
140 | { |
||
141 | dword eb, i; |
||
142 | eb = malloc(sizeof(edit_box)); |
||
143 | for (i = 0; i < sizeof(edit_box); i++) ESBYTE[eb + i] = 0; |
||
144 | ESDWORD[eb] = width; |
||
145 | ESDWORD[eb + 4] = left; |
||
146 | ESDWORD[eb + 8] = top; |
||
147 | ESDWORD[eb + 12] = 0xffffff; |
||
148 | ESDWORD[eb + 16] = 0x94AECE; |
||
149 | ESDWORD[eb + 20] = 0xffffff; |
||
150 | ESDWORD[eb + 24] = 0xffffff; |
||
151 | ESDWORD[eb + 28] = 0x10000000; |
||
152 | ESDWORD[eb + 32] = maxlen; |
||
153 | ESDWORD[eb + 36] = text; |
||
154 | ESDWORD[eb + 40] = 0; |
||
155 | ESDWORD[eb + 44] = flags; |
||
156 | ESDWORD[eb + 48] = 0; |
||
157 | ESDWORD[eb + 52] = 0; |
||
158 | return eb; |
||
159 | } |
||
160 | |||
3107 | leency | 161 | struct scroll_bar |
162 | { |
||
5444 | leency | 163 | word size_x, |
164 | start_x, |
||
165 | size_y, |
||
166 | start_y; |
||
167 | dword btn_height, |
||
168 | type, |
||
169 | max_area, |
||
170 | cur_area, |
||
171 | position, |
||
172 | bckg_col, |
||
173 | frnt_col, |
||
174 | line_col, |
||
175 | redraw; |
||
176 | word delta, |
||
177 | delta2, |
||
178 | r_size_x, |
||
179 | r_start_x, |
||
180 | r_size_y, |
||
181 | r_start_y; |
||
182 | dword m_pos, |
||
183 | m_pos_2, |
||
184 | m_keys, |
||
185 | run_size, |
||
186 | position2, |
||
187 | work_size, |
||
188 | all_redraw, |
||
189 | ar_offset; |
||
4674 | leency | 190 | }; |
191 | |||
5444 | leency | 192 | struct progress_bar |
4674 | leency | 193 | { |
5444 | leency | 194 | dword |
195 | value, |
||
196 | left, |
||
197 | top, |
||
198 | width, |
||
199 | height, |
||
200 | style, |
||
201 | min, |
||
202 | max, |
||
203 | back_color, |
||
204 | progress_color, |
||
205 | frame_color; |
||
206 | }; |
||
207 | |||
208 | struct frame |
||
209 | { |
||
210 | dword type; |
||
7227 | leency | 211 | word size_x; //start_x, size_x => Mario, WTF? Is this so complex to use x/y/w/h ? |
5444 | leency | 212 | word start_x; |
213 | word size_y; |
||
214 | word start_y; |
||
215 | dword ext_col; |
||
216 | dword int_col; |
||
7254 | leency | 217 | dword flags; // see FR_FLAGS |
5444 | leency | 218 | dword text_pointer; |
219 | dword text_position; // 0-up,1-bottom |
||
220 | dword font_number; // 0-monospace,1-variable |
||
221 | dword font_size_y; |
||
222 | dword font_color; |
||
223 | dword font_backgr_color; |
||
7227 | leency | 224 | }; |
5598 | pavelyakov | 225 | |
7254 | leency | 226 | // FR_FLAGS = [x][yyy][z] |
227 | // z - Caption |
||
228 | // yyy - BorderStyle |
||
229 | // x - BackStyle |
||
230 | #define FR_CAPTION 00001b // [z] |
||
231 | #define FR_DOUBLE 00000b // [yyy] |
||
232 | #define FR_RAISED 00010b // [yyy] |
||
233 | #define FR_SUNKEN 00100b // [yyy] |
||
234 | #define FR_ETCHED 00110b // [yyy] |
||
235 | #define FR_RIDGED 01000b // [yyy] |
||
236 | #define FR_FILLED 10000b // [x] |
||
237 | |||
7227 | leency | 238 | :frame frame123 = { 0, 260, 10, 60, 16, NULL, 0xFFFfff, 1, NULL, 0, 1, 12, 0x000111, 0xCCCccc }; |
239 | :void DrawFrame(dword x,y,w,h,text) |
||
240 | { |
||
7806 | leency | 241 | frame123.font_color = sc.work_text; |
242 | frame123.ext_col = sc.work_graph; |
||
243 | frame123.int_col = sc.work_light; |
||
244 | frame123.font_backgr_color = sc.work; |
||
7227 | leency | 245 | |
246 | frame123.start_x = x; |
||
247 | frame123.start_y = y; |
||
248 | frame123.size_x = w; |
||
249 | frame123.size_y = h; |
||
250 | frame123.text_pointer = text; |
||
7254 | leency | 251 | if (!text) frame123.flags=0; else frame123.flags=FR_CAPTION; |
7227 | leency | 252 | frame_draw stdcall (#frame123); |
253 | } |
||
254 | |||
255 | |||
5598 | pavelyakov | 256 | #endif> |