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