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