Subversion Repositories Kolibri OS

Rev

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