Subversion Repositories Kolibri OS

Rev

Rev 9594 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9594 leency 1
//<= imgsrc, imgsize, color_old_1, color_new_1, color_old_2, color_new_2
9481 leency 2
inline fastcall replace_2cols(EDI, EDX, ESI, ECX, EBX, EAX)
3
{
4
    EDX += EDI; //imgsrc + imgsize;
5
    WHILE (EDI < EDX) {
6
        IF (DSDWORD[EDI]==ESI) DSDWORD[EDI] = ECX;
7
        ELSE IF (DSDWORD[EDI]==EBX) DSDWORD[EDI] = EAX;
8
        EDI += 4;
9
    }
10
}
7759 leency 11
 
8952 leency 12
:unsigned int DrawTopPanelButton(dword _button_id, _x, _y, signed int _icon_n, bool pressed)
7759 leency 13
{
14
	#define TSZE 25
9481 leency 15
	static dword lightest, i16_mem, old_work_light;
16
	dword i16_size;
9602 leency 17
	if (!lightest) || (old_work_light != sc.light) {
18
		old_work_light = sc.light;
19
		lightest = MixColors(sc.light, 0xFFFfff, skin_is_dark()*155 + 20);
9481 leency 20
		if (ESI = memopen("ICONS18", NULL, SHM_READ)) {
21
			i16_size = EDX;
22
			i16_mem = malloc(i16_size);
23
			memmov(i16_mem, ESI, i16_size);
9602 leency 24
			replace_2cols(i16_mem, i16_size, 0xffFFFfff, sc.light, 0xffCACBD6, sc.dark);
9481 leency 25
		}
7759 leency 26
	}
9602 leency 27
	DrawWideRectangle(_x+1, _y+1, TSZE, TSZE, 5, sc.light);
7759 leency 28
	DefineHiddenButton(_x, _y, TSZE+1, TSZE+1, _button_id);
29
	if (_icon_n==-1) {
9602 leency 30
		DrawBar(_x+6, _y+5, 16, 16, sc.light);
31
		DrawBar(_x+6, _y+7, 15, 3, sc.line);
9481 leency 32
		$add ecx,5*65536
33
		$int 64
34
		$add ecx,5*65536
35
		$int 64
7759 leency 36
	} else {
9481 leency 37
		if (i16_mem) PutPaletteImage(18*18*4*_icon_n + i16_mem,
38
			18, 18, TSZE/2-9+2+_x, TSZE/2-9+1+_y+pressed, 32, 0);
7759 leency 39
	}
7910 leency 40
 
41
	if (!pressed) {
9602 leency 42
		DrawOvalBorder(_x, _y, TSZE, TSZE, lightest, sc.line, sc.light, sc.work);
7910 leency 43
	} else {
9602 leency 44
		DrawOvalBorder(_x, _y, TSZE, TSZE, sc.line, sc.light, sc.dark, sc.work);
7910 leency 45
		PutShadow(_x+1, _y+1, TSZE, TSZE, true, 2);
46
	}
47
 
7866 leency 48
	return _x;
7759 leency 49
}