Subversion Repositories Kolibri OS

Rev

Rev 1815 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1815 yogev_ezra 1
include 'proc32.inc'
2
 
3
macro start_draw_window x,y,xsize,ysize,areacolor,caption,capsize
4
{
5
	;pusha
6
	mov	eax, 12 		; function 12:tell os about windowdraw
7
	mov	ebx, 1			; 1, start of draw
8
	int	0x40
9
	; DRAW WINDOW
10
	mov	eax, 0			; function 0 : define and draw window
11
	mov	ebx, x*65536+xsize	; [x start] *65536 + [x size]
12
	mov	ecx, y*65536+ysize	; [y start] *65536 + [y size]
13
	mov	edx, areacolor		 ; color of work area RRGGBB
14
	mov	esi, 0x00334455 	 ; color of grab bar  RRGGBB
15
	mov	edi, 0x00ddeeff 	 ; color of frames    RRGGBB
16
	int	0x40
17
	; WINDOW LABEL
18
	mov	eax, 4			; function 4 : write text to window
19
	mov	ebx, 8*65536+8		; [x start] *65536 + [y start]
1816 yogev_ezra 20
	mov	ecx, 0x0;0ffffff         ; color of text RRGGBB
1815 yogev_ezra 21
	mov	edx, caption		; pointer to text beginning
22
	mov	esi, capsize	; text length
23
	int	0x40
24
	;popa
25
}
26
 
27
macro end_draw_window
28
{
29
	mov	eax, 12 		; end of redraw
30
	mov	ebx, 2
31
	int	0x40
32
}
33
 
34
macro change_window_place_size x,y,xsize,ysize
35
{
36
	mov	eax, 67 		 ; function 67 : replace and/or resize window
37
	mov	ebx, x
38
	mov	ecx, y
39
	mov	edx, xsize
40
	mov	esi, ysize
41
	int	0x40
42
}
43
 
44
proc draw_button stdcall, x:dword, y:dword, xsize:dword, ysize:dword, \
45
	id:dword, butcolor:dword, text:dword, textlen:byte, textcolor:dword
46
 
47
	pusha
48
	mov	ebx, dword [x]
49
	shl	ebx, 16
50
	add	ebx, dword [xsize]	  ; [x start] *65536 + [x size]
51
 
52
	mov	ecx, dword [y]
53
	shl	ecx, 16
54
	add	ecx, dword [ysize]	  ; [y start] *65536 + [y size]
55
 
56
	mov	edx, dword [id] 		; button id
57
	mov	esi, dword [butcolor]		; button color RRGGBB
58
	mov	eax, 8			; function 8 : define and draw button
59
	int	0x40
60
 
61
	mov	ebx, dword [x]
62
	add	ebx, 5
63
	shl	ebx, 16
64
	mov	eax, dword [ysize]
65
	sub	eax, 5
66
	shr	eax, 1
67
	add	ebx, eax
68
	add	ebx, dword [y]	;mov    ebx, (x+5)*65536+y+(ysize-5)/2  ; Draw button text
69
 
70
	mov	ecx, dword [textcolor]
71
	mov	edx, dword [text]
72
	xor	eax, eax
73
	mov	al,  byte [textlen]
74
	mov	esi, eax
75
	mov	eax, 4
76
	int	0x40
77
	popa
78
ret
79
endp
80
 
81
;macro outtextxy x,y,prompt,prompt_len,color
82
;{
83
proc outtextxy stdcall, x:dword, y:dword, prompt:dword, prompt_len:dword, color:dword
84
	pusha
85
	mov	eax, 4
86
	mov	ebx, dword [x]	       ; draw info text with function 4
87
	shl	ebx, 16
88
	or	ebx, dword [y]
89
	mov	ecx, dword [color]
90
	mov	edx, dword [prompt]
91
	mov	esi, dword [prompt_len]
1816 yogev_ezra 92
	test	esi, esi
93
	jnz	@f
94
	or	ecx, 0x80000000
95
      @@:
1815 yogev_ezra 96
	int	0x40
97
	popa
98
ret
99
endp
100
;}
101
 
102
;proc bar x:dword, y:dword, xsize:dword, ysize:dword, color:dword
103
macro bar x, y, xsize, ysize, color
104
{
105
	pusha
106
	mov eax, 13
107
	;mov ebx, [x]
108
	;shl ebx, 16
109
	;add ebx, [xsize]
110
	;mov ecx, [y]
111
	;shl ecx, 16
112
	;add ecx, [ysize]
113
	;mov edx, [color]
114
	mov	ebx, x*65536+xsize
115
	mov	ecx, y*65536+ysize
116
	mov edx, color
117
 
118
	int 0x40
119
	popa
120
;ret
121
;endp
122
}
123
 
124
macro line x1,y1,x2,y2,color
125
{
126
  pusha
127
  mov eax, 38
128
  mov ebx, x1*65536+x2
129
  mov ecx, y1*65536+y2
130
  mov edx, color
131
  int 0x40
132
  popa
133
}
134
 
135
macro rectangle x,y,xsize,ysize,color
136
{
137
  x2=x+xsize
138
  y2=y+ysize
139
  line x,y,x2,y,color
140
  line x,y,x,y2,color
141
  line x,y2,x2,y2,color
142
  line x2,y,x2,y2,color
143
}
144
 
1816 yogev_ezra 145
macro rectangle2 x,y,xsize,ysize,color1,color2
146
{
147
  x2=x+xsize
148
  y2=y+ysize
149
  line x,y,x2,y,color1
150
  line x,y,x,y2,color1
151
  line x,y2,x2,y2,color2
152
  line x2,y,x2,y2,color2
153
}
154
 
1815 yogev_ezra 155
macro putpixel x,y,color
156
{
157
  mov eax, 1
158
  mov ebx, x
159
  mov ecx, y
160
  mov edx, color
161
  int 0x40
162
}
163