Rev 9620 | Rev 9810 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8796 | turbocat | 1 | // writed by maxcodehack and superturbocat2001 |
2 | // adaptation of clayer for ktcc |
||
3 | #ifndef KOLIBRI_BOXLIB_H |
||
4 | #define KOLIBRI_BOXLIB_H |
||
5 | |||
9766 | turbocat | 6 | #include |
7 | #include |
||
9620 | turbocat | 8 | #include |
9 | |||
8796 | turbocat | 10 | typedef unsigned color_t; |
9620 | turbocat | 11 | int kolibri_boxlib_init(void); |
8796 | turbocat | 12 | |
13 | /* flags meaning */ |
||
9766 | turbocat | 14 | #define ed_figure_only 0b1000000000000000 // одни символы |
15 | #define ed_always_focus 0b100000000000000 // всегда с курсором (фокусом) |
||
16 | #define ed_focus 0b10 // фокус ввода приложения, мышится самостоятельно |
||
17 | #define ed_pass 0b1 // поле с паролем |
||
18 | #define ed_shift_on 0b1000 // если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая //shift |
||
8796 | turbocat | 19 | #define ed_shift_on_off 0b1111111111110111 |
9766 | turbocat | 20 | #define ed_shift 0b100 //включается при нажатии на shift т.е. если нажимаю |
8796 | turbocat | 21 | #define ed_shift_off 0b1111111111111011 |
9766 | turbocat | 22 | #define ed_shift_bac 0b10000 //бит для очистки выделеного shift т.е. при установке говорит что есть выделение |
23 | #define ed_shift_bac_cl 0b1111111111101111 //очистка при удалении выделения |
||
8796 | turbocat | 24 | #define ed_shift_cl 0b1111111111100011 |
25 | #define ed_shift_mcl 0b1111111111111011 |
||
9766 | turbocat | 26 | #define ed_left_fl 0b100000 |
8796 | turbocat | 27 | #define ed_right_fl 0b1111111111011111 |
9766 | turbocat | 28 | #define ed_offset_fl 0b1000000 |
8796 | turbocat | 29 | #define ed_offset_cl 0b1111111110111111 |
9766 | turbocat | 30 | #define ed_insert 0b10000000 |
8796 | turbocat | 31 | #define ed_insert_cl 0b1111111101111111 |
9766 | turbocat | 32 | #define ed_mouse_on 0b100000000 |
33 | #define ed_mous_adn_b 0b100011000 |
||
34 | #define ed_mouse_off ~ed_mouse_on |
||
35 | #define ed_ctrl_on 0b1000000000 |
||
36 | #define ed_ctrl_off ~ed_ctrl_on |
||
37 | #define ed_alt_on 0b10000000000 |
||
38 | #define ed_alt_off ~ed_alt_on |
||
39 | #define ed_disabled 0b100000000000 |
||
8796 | turbocat | 40 | |
41 | // SCROLLBAR |
||
42 | typedef struct { |
||
9766 | turbocat | 43 | uint16_t xsize; |
8796 | turbocat | 44 | uint16_t xpos; |
45 | uint16_t ysize; |
||
46 | uint16_t ypos; |
||
47 | uint32_t btn_height; |
||
9766 | turbocat | 48 | uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ? |
8796 | turbocat | 49 | uint32_t max_area; |
50 | uint32_t cur_area; |
||
51 | uint32_t position; |
||
52 | uint32_t back_color; |
||
53 | uint32_t front_color; |
||
54 | uint32_t line_color; |
||
55 | uint32_t redraw; |
||
56 | uint16_t delta; |
||
57 | uint16_t delta2; |
||
58 | uint16_t r_size_x; |
||
59 | uint16_t r_start_x; |
||
60 | uint16_t r_size_y; |
||
61 | uint16_t r_start_y; |
||
62 | uint32_t m_pos; |
||
63 | uint32_t m_pos2; |
||
64 | uint32_t m_keys; |
||
65 | uint32_t run_size; |
||
66 | uint32_t position2; |
||
67 | uint32_t work_size; |
||
9766 | turbocat | 68 | uint32_t all_redraw; // need to be set =1 before each redraw |
8796 | turbocat | 69 | uint32_t ar_offset; |
9766 | turbocat | 70 | } __attribute__((__packed__)) scrollbar; |
8796 | turbocat | 71 | |
9620 | turbocat | 72 | extern void __stdcall (*scrollbar_h_draw)(scrollbar*); |
73 | extern void __stdcall (*scrollbar_h_mouse)(scrollbar*); |
||
74 | extern void __stdcall (*scrollbar_v_draw)(scrollbar*); |
||
75 | extern void __stdcall (*scrollbar_v_mouse)(scrollbar*); |
||
8796 | turbocat | 76 | |
77 | // CHECKBOX |
||
78 | typedef struct { |
||
79 | unsigned int left_s; |
||
80 | unsigned int top_s; |
||
81 | unsigned int ch_text_margin; |
||
82 | unsigned int color; |
||
83 | unsigned int border_color; |
||
84 | unsigned int text_color; |
||
9766 | turbocat | 85 | char* text; |
8796 | turbocat | 86 | unsigned int flags; |
87 | |||
88 | /* Users can use members above this */ |
||
89 | unsigned int size_of_str; |
||
9766 | turbocat | 90 | } check_box; |
8796 | turbocat | 91 | |
9766 | turbocat | 92 | extern void __stdcall (*check_box_draw2)(check_box*); |
93 | extern void __stdcall (*check_box_mouse2)(check_box*); |
||
94 | extern void __stdcall (*init_checkbox2)(check_box*); |
||
8796 | turbocat | 95 | |
96 | // DBUTTON |
||
97 | typedef struct { |
||
9766 | turbocat | 98 | uint32_t type; |
99 | uint32_t x_w; |
||
100 | uint32_t y_h; |
||
101 | uint32_t mouse_pos; |
||
8796 | turbocat | 102 | uint32_t mouse_keys; |
103 | uint32_t mouse_keys_old; |
||
9766 | turbocat | 104 | void* active_raw; //active bitmap |
105 | void* passive_raw; //passive bitmap |
||
106 | void* click_raw; //pressed bitmap |
||
8796 | turbocat | 107 | uint32_t resolution_raw; // bpp, as esi fn65 |
9766 | turbocat | 108 | void* palette_raw; // palette, as edi fn65 |
8796 | turbocat | 109 | uint32_t offset_raw; // width as ebp fn65 |
110 | uint32_t select; // internal state: 0 - passive, 2 - pressed, 1 - clicked |
||
111 | uint32_t click; // clicked - 1, zero it after tested |
||
112 | } pict_button; |
||
113 | |||
9766 | turbocat | 114 | extern void __stdcall (*dynamic_button_draw)(pict_button*); |
115 | extern void __stdcall (*dynamic_button_mouse)(pict_button*); |
||
8796 | turbocat | 116 | |
117 | // EDITBOX |
||
118 | |||
9766 | turbocat | 119 | #pragma pack(push, 1) |
8796 | turbocat | 120 | typedef struct edit_box_t { |
121 | unsigned int width; |
||
122 | unsigned int left; |
||
123 | unsigned int top; |
||
124 | unsigned int color; |
||
9766 | turbocat | 125 | unsigned int shift_color; // selected text color |
8796 | turbocat | 126 | unsigned int focus_border_color; |
127 | unsigned int blur_border_color; |
||
128 | unsigned int text_color; |
||
129 | unsigned int max; |
||
9766 | turbocat | 130 | char* text; |
131 | void* mouse_variable; // must be pointer edit_box** to save focused editbox |
||
8796 | turbocat | 132 | unsigned int flags; |
133 | |||
9766 | turbocat | 134 | unsigned int size; // used symbols in buffer without trailing zero |
8796 | turbocat | 135 | unsigned int pos; // cursor position |
9766 | turbocat | 136 | /* The following struct members are not used by the users of API */ |
8796 | turbocat | 137 | unsigned int offset; |
138 | unsigned int cl_curs_x; |
||
139 | unsigned int cl_curs_y; |
||
140 | unsigned int shift; |
||
141 | unsigned int shift_old; |
||
142 | unsigned int height; |
||
143 | unsigned int char_width; |
||
9766 | turbocat | 144 | } edit_box; |
8796 | turbocat | 145 | #pragma pack(pop) |
146 | |||
9766 | turbocat | 147 | extern void __stdcall (*edit_box_draw)(edit_box*); |
148 | extern void __stdcall (*edit_box_key)(edit_box*, unsigned int key_val); |
||
149 | extern void __stdcall (*edit_box_mouse)(edit_box*); |
||
150 | extern void __stdcall (*edit_box_set_text)(edit_box*, char*); |
||
8796 | turbocat | 151 | |
9766 | turbocat | 152 | extern void __stdcall (*edit_box_key_safe)(edit_box* e, ksys_oskey_t ch); |
9620 | turbocat | 153 | |
8796 | turbocat | 154 | // FRAME |
155 | typedef struct { |
||
9766 | turbocat | 156 | uint32_t type; |
157 | uint32_t x_w; |
||
158 | uint32_t y_h; |
||
159 | color_t ext_col; |
||
160 | color_t int_col; |
||
161 | uint32_t flags; |
||
162 | char* text_pointer; |
||
163 | uint32_t text_position; |
||
164 | uint32_t font_number; |
||
165 | uint32_t font_size_y; |
||
166 | color_t font_color; |
||
167 | color_t font_bg_color; |
||
168 | } frame; |
||
8796 | turbocat | 169 | |
9766 | turbocat | 170 | extern void __stdcall (*frame_draw)(frame*); |
8796 | turbocat | 171 | |
172 | // MENUBAR |
||
173 | typedef struct |
||
174 | { |
||
9766 | turbocat | 175 | uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò |
8796 | turbocat | 176 | |
9766 | turbocat | 177 | uint32_t x_w; // âåðõíèé ïóíêò |
178 | uint32_t y_h; |
||
8796 | turbocat | 179 | |
9766 | turbocat | 180 | char* text_pointer; |
181 | char* pos_pointer; |
||
182 | char* text_end; |
||
183 | uint32_t mouse_pos; |
||
184 | uint32_t mouse_keys; |
||
8796 | turbocat | 185 | |
9766 | turbocat | 186 | uint32_t x_w1; // ïîäìåíþ |
187 | uint32_t y_h1; |
||
8796 | turbocat | 188 | |
9766 | turbocat | 189 | color_t bckg_col; // ôîí âåðõíåãî ïóêòà |
190 | color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà |
||
191 | color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû) |
||
192 | uint32_t select; |
||
193 | uint32_t out_select; |
||
194 | char* buf_adress; |
||
195 | char* procinfo; |
||
196 | uint32_t click; |
||
197 | uint32_t cursor; |
||
198 | uint32_t cursor_old; |
||
199 | uint32_t interval; |
||
200 | uint32_t cursor_max; |
||
201 | uint32_t extended_key; |
||
202 | color_t menu_sel_col; // öâåò ôîíà âûáðàííîãî ïîäïóíêòà |
||
203 | color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà |
||
204 | color_t frnt_text_col; // öâåò øðèôòà âûáðàííîãî ïóíêòà |
||
205 | uint32_t mouse_keys_old; |
||
206 | uint32_t font_height; |
||
207 | uint32_t cursor_out; |
||
208 | uint32_t get_mouse_flag; |
||
8796 | turbocat | 209 | } menubar; |
210 | |||
9766 | turbocat | 211 | extern void __stdcall (*menu_bar_draw)(menubar*); |
212 | extern void __stdcall (*menu_bar_mouse)(menubar*); |
||
213 | extern void __stdcall (*menu_bar_activate)(menubar*); |
||
8796 | turbocat | 214 | |
215 | // OPTIONBOX |
||
216 | typedef struct option_box_t { |
||
9766 | turbocat | 217 | struct option_box_t** selected; |
8796 | turbocat | 218 | uint16_t posx; |
219 | uint16_t posy; |
||
220 | uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè |
||
9766 | turbocat | 221 | uint32_t size; // 12 ðàçìåð êâàäðàòà ÷åê áîêñà |
8796 | turbocat | 222 | color_t color; |
223 | color_t border_color; // individual border |
||
224 | color_t text_color; |
||
9766 | turbocat | 225 | char* text; |
8796 | turbocat | 226 | uint32_t text_len; |
227 | uint32_t flags; |
||
9766 | turbocat | 228 | } __attribute__((__packed__)) option_box; |
8796 | turbocat | 229 | |
9766 | turbocat | 230 | extern void __stdcall (*option_box_draw)(option_box**); |
231 | extern void __stdcall (*option_box_mouse)(option_box**); |
||
8796 | turbocat | 232 | |
233 | // PATHSHOW |
||
234 | typedef struct { |
||
9766 | turbocat | 235 | uint32_t type; |
236 | uint32_t x_y; |
||
237 | uint16_t font_size_x; // 6 - for font 0, 8 - for font 1 |
||
238 | uint16_t area_size_x; |
||
239 | uint32_t font_number; // 0 - monospace, 1 - variable, as fn4 (2bit only 0-3) |
||
8796 | turbocat | 240 | uint32_t background_flag; // as fn4, if 0, bk_color unneeded |
9766 | turbocat | 241 | color_t font_color; // as fn4 |
242 | color_t background_color; // as fn4 |
||
8796 | turbocat | 243 | char* text_pointer; // 4096 ? |
244 | char* work_area_pointer; // 4096 ? |
||
245 | uint32_t temp_text_length; |
||
9766 | turbocat | 246 | } __attribute__((__packed__)) pathview; |
8796 | turbocat | 247 | |
9766 | turbocat | 248 | extern void __stdcall (*path_show_prepare)(pathview*); |
249 | extern void __stdcall (*path_show_draw)(pathview*); |
||
8796 | turbocat | 250 | |
251 | // PROGRESSBAR |
||
252 | typedef struct { |
||
9766 | turbocat | 253 | unsigned int value; |
8796 | turbocat | 254 | unsigned int left; |
255 | unsigned int top; |
||
256 | unsigned int width; |
||
257 | unsigned int height; |
||
258 | unsigned int style; |
||
259 | unsigned int min; |
||
260 | unsigned int max; |
||
261 | unsigned int back_color; |
||
262 | unsigned int progress_color; |
||
263 | unsigned int frame_color; |
||
264 | } progressbar; |
||
265 | |||
9766 | turbocat | 266 | extern void __stdcall (*progressbar_draw)(progressbar*); |
267 | extern void __stdcall (*progressbar_progress)(progressbar*); |
||
8796 | turbocat | 268 | |
269 | #endif /* KOLIBRI_BOXLIB_H */ |