Subversion Repositories Kolibri OS

Rev

Rev 9576 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9576 Rev 9602
1
#ifndef INCLUDE_GUI_H
1
#ifndef INCLUDE_GUI_H
2
#define INCLUDE_GUI_H
2
#define INCLUDE_GUI_H
3
 
3
 
4
#ifndef INCLUDE_KOLIBRI_H
4
#ifndef INCLUDE_KOLIBRI_H
5
#include "../lib/kolibri.h"
5
#include "../lib/kolibri.h"
6
#endif
6
#endif
7
 
7
 
8
#ifndef INCLUDE_STRING_H
8
#ifndef INCLUDE_STRING_H
9
#include "../lib/strings.h"
9
#include "../lib/strings.h"
10
#endif
10
#endif
11
 
11
 
12
#ifndef INCLUDE_RGB_H
12
#ifndef INCLUDE_RGB_H
13
#include "../lib/patterns/rgb.h"
13
#include "../lib/patterns/rgb.h"
14
#endif
14
#endif
15
 
15
 
16
#ifndef INCLUDE_MATH_H
16
#ifndef INCLUDE_MATH_H
17
#include "../lib/math.h"
17
#include "../lib/math.h"
18
#endif
18
#endif
19
 
19
 
20
#include "../lib/gui/tabs.h"
20
#include "../lib/gui/tabs.h"
21
#include "../lib/gui/sensor.h"
21
#include "../lib/gui/sensor.h"
22
#include "../lib/gui/more_less_box.h"
22
#include "../lib/gui/more_less_box.h"
23
 
23
 
24
#ifndef INCLUDE_CHECKBOX
24
#ifndef INCLUDE_CHECKBOX
25
#include "../lib/gui/checkbox.h"
25
#include "../lib/gui/checkbox.h"
26
#endif
26
#endif
27
 
27
 
28
#include "../lib/gui/child_window.h"
28
#include "../lib/gui/child_window.h"
29
#include "../lib/gui/text_view_area.h"
29
#include "../lib/gui/text_view_area.h"
30
#include "../lib/gui/reshare.h"
30
#include "../lib/gui/reshare.h"
31
 
31
 
32
#ifndef INCLUDE_MENU_H
32
#ifndef INCLUDE_MENU_H
33
#include "../lib/gui/menu.h"
33
#include "../lib/gui/menu.h"
34
#endif
34
#endif
35
 
35
 
36
:int last_free_button_id = 1000;
36
:int last_free_button_id = 1000;
37
:int GetFreeButtonId()
37
:int GetFreeButtonId()
38
{
38
{
39
	last_free_button_id++;
39
	last_free_button_id++;
40
	return last_free_button_id;
40
	return last_free_button_id;
41
}
41
}
42
 
42
 
43
:void DrawRectangle(dword x,y,w,h,color1)
43
:void DrawRectangle(dword x,y,w,h,color1)
44
{
44
{
45
	DrawRectangle3D(x,y,w,h,color1,color1);
45
	DrawRectangle3D(x,y,w,h,color1,color1);
46
	/*
46
	/*
47
	DrawBar(x,y,w,1,color1);
47
	DrawBar(x,y,w,1,color1);
48
	DrawBar(x,y+h,w,1,color1);
48
	DrawBar(x,y+h,w,1,color1);
49
	DrawBar(x,y,1,h,color1);
49
	DrawBar(x,y,1,h,color1);
50
	DrawBar(x+w,y,1,h+1,color1);
50
	DrawBar(x+w,y,1,h+1,color1);
51
	*/
51
	*/
52
}
52
}
53
 
53
 
54
:void DrawWideRectangle(dword x,y,w,h,boder,color1)
54
:void DrawWideRectangle(dword x,y,w,h,boder,color1)
55
{
55
{
56
	DrawBar(x, y, w, boder, color1);
56
	DrawBar(x, y, w, boder, color1);
57
	DrawBar(x, y+h-boder, w, boder, EDX);
57
	DrawBar(x, y+h-boder, w, boder, EDX);
58
	DrawBar(x, y+boder, boder, h-boder-boder, EDX);
58
	DrawBar(x, y+boder, boder, h-boder-boder, EDX);
59
	DrawBar(x+w-boder, y+boder, boder, h-boder-boder, EDX);
59
	DrawBar(x+w-boder, y+boder, boder, h-boder-boder, EDX);
60
}
60
}
61
 
61
 
62
:void DrawRectangle3D(dword x,y,w,h,color1,color2)
62
:void DrawRectangle3D(dword x,y,w,h,color1,color2)
63
{
63
{
64
	DrawBar(x,y,w+1,1,color1);
64
	DrawBar(x,y,w+1,1,color1);
65
	DrawBar(x,y+1,1,h-1,EDX);
65
	DrawBar(x,y+1,1,h-1,EDX);
66
	DrawBar(x+w,y+1,1,h,color2);
66
	DrawBar(x+w,y+1,1,h,color2);
67
	DrawBar(x,y+h,w,1,EDX);
67
	DrawBar(x,y+h,w,1,EDX);
68
}
68
}
69
 
69
 
70
:void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
70
:void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
71
{
71
{
72
	dword tx = -strlen(text)*8+w/2+x;
72
	dword tx = -strlen(text)*8+w/2+x;
73
	dword ty = h/2-7+y;
73
	dword ty = h/2-7+y;
74
	DefineButton(x,y,w,h,id,color_b);
74
	DefineButton(x,y,w,h,id,color_b);
75
	WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text);
75
	WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text);
76
	WriteText(tx,ty,0x90,color_t,text);
76
	WriteText(tx,ty,0x90,color_t,text);
77
}
77
}
78
 
78
 
79
:int active_button_id = 0;
79
:int active_button_id = 0;
80
:int DrawStandartCaptButton(dword x, y, id, text)
80
:int DrawStandartCaptButton(dword x, y, id, text)
81
{
81
{
82
	#define padding_v 5
82
	#define padding_v 5
83
	#define padding_h 15
83
	#define padding_h 15
84
	#define right_margin 12
84
	#define right_margin 12
85
	#define h padding_v + padding_v + 16 //16 font height
85
	#define h padding_v + padding_v + 16 //16 font height
86
	int tw = strlen(text)*8;
86
	int tw = strlen(text)*8;
87
	int w = tw + padding_h + padding_h;
87
	int w = tw + padding_h + padding_h;
88
	unsigned darker_color = MixColors(sc.button,0,230);
88
	unsigned darker_color = MixColors(sc.button,0,230);
89
 
89
 
90
	DefineButton(x,y,w,h,id,sc.button);
90
	DefineButton(x,y,w,h,id,sc.button);
91
 
91
 
92
	x += padding_h;
92
	x += padding_h;
93
	y += padding_v+1;
93
	y += padding_v+1;
94
 
94
 
95
	WriteText(x+1,y+1,0x90,darker_color,text);
95
	WriteText(x+1,y+1,0x90,darker_color,text);
96
	WriteText(x,y,0x90,sc.button_text,text);
96
	WriteText(x,y,0x90,sc.button_text,text);
97
 
97
 
98
	if (active_button_id==id) {
98
	if (active_button_id==id) {
99
		
99
		
100
		DrawBar(x,y+15,tw,1, darker_color);
100
		DrawBar(x,y+15,tw,1, darker_color);
101
		DrawBar(x,y+14,tw,1, sc.button_text);
101
		DrawBar(x,y+14,tw,1, sc.button_text);
102
	}
102
	}
103
 
103
 
104
	return w + right_margin;
104
	return w + right_margin;
105
}
105
}
106
 
106
 
107
/* UNSTABLE
107
/* UNSTABLE
108
:unsigned LightenDarkenColor(dword color, amt) {
108
:unsigned LightenDarkenColor(dword color, amt) {
109
	dword r = color >> 16 + amt << 16;
109
	dword r = color >> 16 + amt << 16;
110
	dword b = color >> 8 & 0x00FF + amt << 8;
110
	dword b = color >> 8 & 0x00FF + amt << 8;
111
	dword g = color & 0x0000FF + amt;
111
	dword g = color & 0x0000FF + amt;
112
	return g | b | r ;
112
	return g | b | r ;
113
}
113
}
114
*/
114
*/
115
 
115
 
116
:void ActiveButtonSwitch(int min, max)
116
:void ActiveButtonSwitch(int min, max)
117
{
117
{
118
	active_button_id++;
118
	active_button_id++;
119
	if (active_button_id>max) || (active_button_id
119
	if (active_button_id>max) || (active_button_id
120
}
120
}
121
 
121
 
122
:void WriteTextCenter(dword x,y,w,color_t,text)
122
:void WriteTextCenter(dword x,y,w,color_t,text)
123
{
123
{
124
	WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text);
124
	WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text);
125
}
125
}
126
 
126
 
127
:void DrawCircle(int x, y, r, color)
127
:void DrawCircle(int x, y, r, color)
128
{
128
{
129
	int i;
129
	int i;
130
	float px=0, py=r, ii = r * 3.1415926 * 2;
130
	float px=0, py=r, ii = r * 3.1415926 * 2;
131
	FOR (i = 0; i < ii; i++)
131
	FOR (i = 0; i < ii; i++)
132
	{
132
	{
133
        PutPixel(px + x, y - py, color);
133
        PutPixel(px + x, y - py, color);
134
        px = py / r + px;
134
        px = py / r + px;
135
        py = -px / r + py;
135
        py = -px / r + py;
136
	}
136
	}
137
}
137
}
138
 
138
 
139
:void DrawEditBox(dword edit_box_pointer)
139
:void DrawEditBox(dword edit_box_pointer)
140
{
140
{
141
	dword x,y,w,h,bg;
141
	dword x,y,w,h,bg;
142
	ESI = edit_box_pointer;
142
	ESI = edit_box_pointer;
143
	x = ESI.edit_box.left;
143
	x = ESI.edit_box.left;
144
	y = ESI.edit_box.top;
144
	y = ESI.edit_box.top;
145
	w = ESI.edit_box.width+1;
145
	w = ESI.edit_box.width+1;
146
	h = 22;
146
	h = 22;
147
	if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
147
	if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
148
	edit_box_draw  stdcall (edit_box_pointer);
148
	edit_box_draw  stdcall (edit_box_pointer);
149
	DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg);
149
	DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg);
150
	DrawRectangle(x-2, y-2, w+3, h+3, sc.work_graph);
150
	DrawRectangle(x-2, y-2, w+3, h+3, sc.line);
151
	DrawRectangle3D(x-3, y-3, w+5, h+5, sc.work_dark, sc.work_light);
151
	DrawRectangle3D(x-3, y-3, w+5, h+5, sc.dark, sc.light);
152
}
152
}
153
 
153
 
154
#define DOT_W 37 
154
#define DOT_W 37 
155
:void DrawFileBox(dword edit_box_pointer, title, btn)
155
:void DrawFileBox(dword edit_box_pointer, title, btn)
156
{
156
{
157
	dword x,y,w,bg,t;
157
	dword x,y,w,bg,t;
158
	ESI = edit_box_pointer;
158
	ESI = edit_box_pointer;
159
	x = ESI.edit_box.left;
159
	x = ESI.edit_box.left;
160
	y = ESI.edit_box.top;
160
	y = ESI.edit_box.top;
161
	w = ESI.edit_box.width+1;
161
	w = ESI.edit_box.width+1;
162
	#define box_h 22
162
	#define box_h 22
163
 
163
 
164
	if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
164
	if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
165
	edit_box_draw  stdcall (edit_box_pointer);
165
	edit_box_draw  stdcall (edit_box_pointer);
166
	DrawRectangle3D(x-1, y-1, w+1, box_h+1, 0xE7E7E7, bg);
166
	DrawRectangle3D(x-1, y-1, w+1, box_h+1, 0xE7E7E7, bg);
167
	DrawRectangle(x-2, y-2, w+3, box_h+3, sc.work_graph);
167
	DrawRectangle(x-2, y-2, w+3, box_h+3, sc.line);
168
	DrawRectangle3D(x-3, y-3, w+DOT_W+5, box_h+5, sc.work_dark, sc.work_light);
168
	DrawRectangle3D(x-3, y-3, w+DOT_W+5, box_h+5, sc.dark, sc.light);
169
 
169
 
170
	WriteText(x-2, y-19, 0x90, sc.work_text, title);
170
	WriteText(x-2, y-19, 0x90, sc.work_text, title);
171
	DrawCaptButton(x+w+1, y-2, DOT_W, box_h+3, btn, sc.button, sc.button_text, "...");
171
	DrawCaptButton(x+w+1, y-2, DOT_W, box_h+3, btn, sc.button, sc.button_text, "...");
172
}
172
}
173
 
173
 
174
:void DrawEditBoxPos(dword x,y, edit_box_pointer)
174
:void DrawEditBoxPos(dword x,y, edit_box_pointer)
175
{
175
{
176
	ESI = edit_box_pointer;
176
	ESI = edit_box_pointer;
177
	ESI.edit_box.left = x;
177
	ESI.edit_box.left = x;
178
	ESI.edit_box.top = y;
178
	ESI.edit_box.top = y;
179
	DrawEditBox(dword edit_box_pointer);
179
	DrawEditBox(dword edit_box_pointer);
180
}
180
}
181
 
181
 
182
:void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, progress_percent)
182
:void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, progress_percent)
183
{
183
{
184
	int progress_w;
184
	int progress_w;
185
	static int fill_old;
185
	static int fill_old;
186
	    
186
	    
187
	//if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;}
187
	//if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;}
188
	if (progress_percent<=0) || (progress_percent>=100) return;
188
	if (progress_percent<=0) || (progress_percent>=100) return;
189
	
189
	
190
	DrawRectangle(st_x, st_y, st_w,st_h, col_border);
190
	DrawRectangle(st_x, st_y, st_w,st_h, col_border);
191
	DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff);
191
	DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff);
192
 
192
 
193
	if (progress_percent>0) && (progress_percent<=100)
193
	if (progress_percent>0) && (progress_percent<=100)
194
	{
194
	{
195
		progress_w = st_w - 3 * progress_percent / 100;
195
		progress_w = st_w - 3 * progress_percent / 100;
196
		DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill);
196
		DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill);
197
		DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff);
197
		DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff);
198
	}
198
	}
199
}
199
}
200
 
200
 
201
:void DrawLink(dword x,y,font_type,btn_id, inscription)
201
:void DrawLink(dword x,y,font_type,btn_id, inscription)
202
{
202
{
203
	int w;
203
	int w;
204
	WriteText(x,y,font_type,0x4E00E7,inscription);
204
	WriteText(x,y,font_type,0x4E00E7,inscription);
205
	if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*8;
205
	if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*8;
206
	DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0);
206
	DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0);
207
	DrawBar(x,y+8,w,1,0x4E00E7);
207
	DrawBar(x,y+8,w,1,0x4E00E7);
208
}
208
}
209
 
209
 
210
:void PutShadow(dword x,y,w,h,skinned, signed strength)
210
:void PutShadow(dword x,y,w,h,skinned, signed strength)
211
{
211
{
212
	proc_info wForm;
212
	proc_info wForm;
213
	dword shadow_buf = mem_Alloc(w*h*3);
213
	dword shadow_buf = mem_Alloc(w*h*3);
214
 	GetProcessInfo(#wForm, SelfInfo);
214
 	GetProcessInfo(#wForm, SelfInfo);
215
	CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h);
215
	CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h);
216
	ShadowImage(shadow_buf, w, h, strength);
216
	ShadowImage(shadow_buf, w, h, strength);
217
	_PutImage(x,y,w,h,shadow_buf);
217
	PutImage(x,y,w,h,shadow_buf);
218
	mem_Free(shadow_buf);
218
	mem_Free(shadow_buf);
219
}
219
}
220
 
220
 
221
:void DrawPopup(dword x,y,w,h,skinned, col_work,col_border)
221
:void DrawPopup(dword x,y,w,h,skinned, col_work,col_border)
222
{
222
{
223
	DrawRectangle(x,y,w,h,col_border);
223
	DrawRectangle(x,y,w,h,col_border);
224
	DrawBar(x+1,y+1,w-1,1,0xFFFfff);
224
	DrawBar(x+1,y+1,w-1,1,0xFFFfff);
225
	DrawBar(x+1,y+2,1,h-2,EDX);
225
	DrawBar(x+1,y+2,1,h-2,EDX);
226
	if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work);
226
	if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work);
227
	DrawPopupShadow(x,y,w,h-1,skinned);
227
	DrawPopupShadow(x,y,w,h-1,skinned);
228
}
228
}
229
 
229
 
230
:void Draw3DPopup(dword x,y,w,h)
230
:void Draw3DPopup(dword x,y,w,h)
231
{
231
{
232
	DrawRectangle3D(x,y,w,h, sc.work_dark, sc.work_graph);
232
	DrawRectangle3D(x,y,w,h, sc.dark, sc.line);
233
	DrawBar(x+1,y+1,w-1,1,sc.work_light);
233
	DrawBar(x+1,y+1,w-1,1,sc.light);
234
	DrawBar(x+1,y+2,1,h-2,sc.work_light);
234
	DrawBar(x+1,y+2,1,h-2,sc.light);
235
	DrawPopupShadow(x,y,w,h-1,0);
235
	DrawPopupShadow(x,y,w,h-1,0);
236
}
236
}
237
 
237
 
238
:void DrawPopupShadow(dword x,y,w,h,skinned)
238
:void DrawPopupShadow(dword x,y,w,h,skinned)
239
{
239
{
240
	PutShadow(w+x+1,y,1,h+2,skinned,2);
240
	PutShadow(w+x+1,y,1,h+2,skinned,2);
241
	PutShadow(w+x+2,y+1,1,h+2,skinned,1);
241
	PutShadow(w+x+2,y+1,1,h+2,skinned,1);
242
	PutShadow(x,y+h+2,w+2,1,skinned,2);
242
	PutShadow(x,y+h+2,w+2,1,skinned,2);
243
	PutShadow(x+1,y+h+3,w+1,1,skinned,1);
243
	PutShadow(x+1,y+h+3,w+1,1,skinned,1);
244
}
244
}
245
 
245
 
246
:dword GrayScaleImage(dword color_image, w, h)
246
:dword GrayScaleImage(dword color_image, w, h)
247
{
247
{
248
	dword i,gray,to,rr,gg,bb;
248
	dword i,gray,to,rr,gg,bb;
249
	to = w*h*3 + color_image;
249
	to = w*h*3 + color_image;
250
	for (i = color_image; i < to; i+=3)
250
	for (i = color_image; i < to; i+=3)
251
	{
251
	{
252
		rr = DSBYTE[i];
252
		rr = DSBYTE[i];
253
		gg = DSBYTE[i+1];
253
		gg = DSBYTE[i+1];
254
		bb = DSBYTE[i+2];
254
		bb = DSBYTE[i+2];
255
		gray = rr*rr;
255
		gray = rr*rr;
256
		gray += gg*gg;
256
		gray += gg*gg;
257
		gray += bb*bb;
257
		gray += bb*bb;
258
		gray = sqrt(gray) / 3;
258
		gray = sqrt(gray) / 3;
259
		DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray;
259
		DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray;
260
	}
260
	}
261
	return gray;
261
	return gray;
262
}
262
}
263
 
263
 
264
:void ShadowImage(dword color_image, w, h, signed strength)
264
:void ShadowImage(dword color_image, w, h, signed strength)
265
{
265
{
266
	byte col;
266
	byte col;
267
	dword to;
267
	dword to;
268
	strength = 10 - strength;
268
	strength = 10 - strength;
269
	to = w*h*3 + color_image;
269
	to = w*h*3 + color_image;
270
	for ( ; color_image < to; color_image++)
270
	for ( ; color_image < to; color_image++)
271
	{
271
	{
272
		col = math.min(strength * DSBYTE[color_image] / 10, 255);
272
		col = math.min(strength * DSBYTE[color_image] / 10, 255);
273
		DSBYTE[color_image] = col;
273
		DSBYTE[color_image] = col;
274
	}
274
	}
275
}
275
}
276
 
276
 
277
:void WriteTextLines(dword x,y,byte fontType, dword color, text_pointer, line_h)
277
:void WriteTextLines(dword x,y,byte fontType, dword color, text_pointer, line_h)
278
{
278
{
279
	dword next_word_pointer = strchr(text_pointer, '\n');
279
	dword next_word_pointer = strchr(text_pointer, '\n');
280
	if (next_word_pointer) WriteTextLines(dword x, y+line_h, byte fontType, dword color, next_word_pointer+2, line_h);
280
	if (next_word_pointer) WriteTextLines(dword x, y+line_h, byte fontType, dword color, next_word_pointer+2, line_h);
281
	ESBYTE[next_word_pointer] = NULL;
281
	ESBYTE[next_word_pointer] = NULL;
282
	WriteText(dword x, y, byte fontType, dword color, text_pointer);
282
	WriteText(dword x, y, byte fontType, dword color, text_pointer);
283
	ESBYTE[next_word_pointer] = '\n';
283
	ESBYTE[next_word_pointer] = '\n';
284
}
284
}
285
 
285
 
286
:void DrawOvalBorder(dword x,y,w,h, light,dark,right,dots)
286
:void DrawOvalBorder(dword x,y,w,h, light,dark,right,dots)
287
{
287
{
288
	DrawBar(x+1,    y,     w, 1,   light);
288
	DrawBar(x+1,    y,     w, 1,   light);
289
	DrawBar(x+1,    y+h+1, w, 1,   dark);
289
	DrawBar(x+1,    y+h+1, w, 1,   dark);
290
	DrawBar(x,      y+1,   1, h-1, light);
290
	DrawBar(x,      y+1,   1, h-1, light);
291
	DrawBar(x+w+1,  y+2,   1, h-2, right);
291
	DrawBar(x+w+1,  y+2,   1, h-2, right);
292
 
292
 
293
	PutPixel(x,     y,     dots);
293
	PutPixel(x,     y,     dots);
294
	PutPixel(x+w+1, y+h+1, EDX);
294
	PutPixel(x+w+1, y+h+1, EDX);
295
	PutPixel(x,     y+h+1, EDX);
295
	PutPixel(x,     y+h+1, EDX);
296
	PutPixel(x+w+1, y,     EDX);
296
	PutPixel(x+w+1, y,     EDX);
297
	
297
	
298
	PutPixel(x,     y+h, dark);
298
	PutPixel(x,     y+h, dark);
299
	PutPixel(x+w+1, y+1, light);
299
	PutPixel(x+w+1, y+1, light);
300
	PutPixel(x+w+1, y+h, dark);	
300
	PutPixel(x+w+1, y+h, dark);	
301
}
301
}
302
 
302
 
303
:bool skin_is_dark()
303
:bool skin_is_dark()
304
{
304
{
305
	ESI = #sc.work;
305
	ESI = #sc.work;
306
 
306
 
307
	EDI = DSBYTE[ESI]*DSBYTE[ESI];
307
	EDI = DSBYTE[ESI]*DSBYTE[ESI];
308
	EDI += DSBYTE[ESI+1]*DSBYTE[ESI+1];
308
	EDI += DSBYTE[ESI+1]*DSBYTE[ESI+1];
309
	EDI += DSBYTE[ESI+2]*DSBYTE[ESI+2];
309
	EDI += DSBYTE[ESI+2]*DSBYTE[ESI+2];
310
 
310
 
311
	if (sqrt(EDI) / 3 < 65) {
311
	if (sqrt(EDI) / 3 < 65) {
312
		return true; 
312
		return true; 
313
	} else {
313
	} else {
314
		return false;
314
		return false;
315
	}
315
	}
316
}
316
}
317
 
317
 
318
//this function increase falue and return it
318
//this function increase falue and return it
319
//useful for list of controls which goes one after one
319
//useful for list of controls which goes one after one
320
:struct incn
320
:struct incn
321
{
321
{
322
	dword n;
322
	dword n;
323
	dword inc(dword _addition);
323
	dword inc(dword _addition);
324
	dword set(dword _new_val);
324
	dword set(dword _new_val);
325
};
325
};
326
 
326
 
327
:dword incn::inc(dword _addition)
327
:dword incn::inc(dword _addition)
328
{
328
{
329
	n += _addition;
329
	n += _addition;
330
	return n;
330
	return n;
331
}
331
}
332
 
332
 
333
:dword incn::set(dword _new_val)
333
:dword incn::set(dword _new_val)
334
{
334
{
335
	n =_new_val;
335
	n =_new_val;
336
	return n;
336
	return n;
337
}
337
}
338
 
338
 
339
//block with hover
339
//block with hover
340
struct block {
340
struct block {
341
	int x,y,w,h;
341
	int x,y,w,h;
342
	bool hovered();
342
	bool hovered();
343
	void set_size();
343
	void set_size();
344
};
344
};
345
 
345
 
346
:bool block::hovered() {
346
:bool block::hovered() {
347
	if ((mouse.x>=x) && (mouse.y>=y) 
347
	if ((mouse.x>=x) && (mouse.y>=y) 
348
	&& (mouse.y<=y+h) && (mouse.x<=x+w)) 
348
	&& (mouse.y<=y+h) && (mouse.x<=x+w)) 
349
		return true;
349
		return true;
350
	return false;
350
	return false;
351
}
351
}
352
 
352
 
353
:void block::set_size(dword _x, _y, _w, _h)
353
:void block::set_size(dword _x, _y, _w, _h)
354
{
354
{
355
	x=_x; 
355
	x=_x; 
356
	y=_y;
356
	y=_y;
357
	w=_w;
357
	w=_w;
358
	h=_h;
358
	h=_h;
359
}
359
}
360
 
360
 
361
 
361
 
362
#endif
362
#endif
363
>
363
>