Subversion Repositories Kolibri OS

Rev

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