Subversion Repositories Kolibri OS

Rev

Rev 8281 | Rev 9362 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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