Subversion Repositories Kolibri OS

Rev

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

Rev 1660 Rev 1682
1
;*****************************************************************************
1
;*****************************************************************************
2
; Example for Box_lib: checkbox
2
; Example for Box_lib: checkbox
3
; Copyright (c) 2007-2010, Alexey  Teplov aka 
3
; Copyright (c) 2007-2010, Alexey  Teplov aka 
4
; All rights reserved.
4
; All rights reserved.
5
;
5
;
6
; Redistribution and use in source and binary forms, with or without
6
; Redistribution and use in source and binary forms, with or without
7
; modification, are permitted provided that the following conditions are met:
7
; modification, are permitted provided that the following conditions are met:
8
;	 * Redistributions of source code must retain the above copyright
8
;	 * Redistributions of source code must retain the above copyright
9
;	   notice, this list of conditions and the following disclaimer.
9
;	   notice, this list of conditions and the following disclaimer.
10
;	 * Redistributions in binary form must reproduce the above copyright
10
;	 * Redistributions in binary form must reproduce the above copyright
11
;	   notice, this list of conditions and the following disclaimer in the
11
;	   notice, this list of conditions and the following disclaimer in the
12
;	   documentation and/or other materials provided with the distribution.
12
;	   documentation and/or other materials provided with the distribution.
13
;	 * Neither the name of the  nor the
13
;	 * Neither the name of the  nor the
14
;	   names of its contributors may be used to endorse or promote products
14
;	   names of its contributors may be used to endorse or promote products
15
;	   derived from this software without specific prior written permission.
15
;	   derived from this software without specific prior written permission.
16
;
16
;
17
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov ''AS IS'' AND ANY
17
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov ''AS IS'' AND ANY
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
;******************************************************************************
27
;******************************************************************************
28
 
28
 
29
use32
29
use32
30
	org 0x0
30
	org 0x0
31
;------------  from kolibrios programm
31
;------------  from kolibrios programm
32
	db 'MENUET01'
32
	db 'MENUET01'
33
	dd 0x01
33
	dd 0x01
34
	dd START
34
	dd START
35
	dd MEM_END
35
	dd MEM_END
36
	dd PRIL_END
36
	dd PRIL_END
37
	dd PRIL_END
37
	dd PRIL_END
38
	dd 0x0
38
	dd 0x0
39
	dd cur_dir_path
39
	dd cur_dir_path
40
;------------ 
40
;------------ 
41
;------------ 
41
;------------ 
42
include '../../../../macros.inc'
42
include '../../../../macros.inc'
43
include '../load_lib.mac'
43
include '../load_lib.mac'
44
include 'box_lib.mac'
44
include 'box_lib.mac'
45
;include 'macros.inc'
45
;include 'macros.inc'
46
;include 'load_lib.mac'
46
;include 'load_lib.mac'
47
;------------ 
47
;------------ 
48
;------------ 
48
;------------ 
49
@use_library
49
@use_library
50
;------------ 
50
;------------ 
51
;---------------------------------------------------------------------
51
;---------------------------------------------------------------------
52
;--- Start of program ----------------------------------------------
52
;--- Start of program ----------------------------------------------
53
;---------------------------------------------------------------------
53
;---------------------------------------------------------------------
54
START:
54
START:
55
	mcall	40,0x27
55
	mcall	40,0x27
56
 
56
 
57
sys_load_library  library_name, cur_dir_path, library_path, system_path, \
57
sys_load_library  library_name, cur_dir_path, library_path, system_path, \
58
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
58
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
59
       	test	eax,eax
59
       	test	eax,eax
60
	jnz	exit
60
	jnz	exit
61
;init checkboxes
61
;init checkboxes
62
	push	dword check1
62
	push	dword check1
63
	call	[init_checkbox]
63
	call	[init_checkbox]
64
 
64
 
65
	push	dword check2
65
	push	dword check2
66
	call	[init_checkbox]
66
	call	[init_checkbox]
67
 
67
 
68
	push	dword check3
68
	push	dword check3
69
	call	[init_checkbox]
69
	call	[init_checkbox]
70
 
70
 
71
	push	dword check4
71
	push	dword check4
72
	call	[init_checkbox]
72
	call	[init_checkbox]
73
 
73
 
74
	push	dword check5
74
	push	dword check5
75
	call	[init_checkbox]
75
	call	[init_checkbox]
76
 
76
 
77
	push	dword check6
77
	push	dword check6
78
	call	[init_checkbox]
78
	call	[init_checkbox]
79
 
79
 
80
	
80
	
81
window:
81
window:
82
	call draw_window		;ïåðâîíà÷àëüíî íåîáõîäèìî íàðèñîâàòü îêíî
82
	call draw_window		;ïåðâîíà÷àëüíî íåîáõîäèìî íàðèñîâàòü îêíî
83
align 4
83
align 4
84
still:				;îñíîâíîé îáðàáîò÷èê
84
still:				;îñíîâíîé îáðàáîò÷èê
85
	mcall	10		;Îæèäàòü ñîáûòèÿ
85
	mcall	10		;Îæèäàòü ñîáûòèÿ
86
	dec  eax
86
	dec  eax
87
	jz   window
87
	jz   window
88
	dec  eax
88
	dec  eax
89
	jz   key
89
	jz   key
90
	dec  eax
90
	dec  eax
91
	jz   button
91
	jz   button
92
 
92
 
93
	push	dword check1
93
	push	dword check1
94
	call	[check_box_mouse]
94
	call	[check_box_mouse]
95
 
95
 
96
	push	dword check2
96
	push	dword check2
97
	call	[check_box_mouse]
97
	call	[check_box_mouse]
98
 
98
 
99
	push	dword check3
99
	push	dword check3
100
	call	[check_box_mouse]
100
	call	[check_box_mouse]
101
 
101
 
102
 
102
 
103
	push	dword check4
103
	push	dword check4
104
	call	[check_box_mouse]
104
	call	[check_box_mouse]
105
 
105
 
106
	push	dword check5
106
	push	dword check5
107
	call	[check_box_mouse]
107
	call	[check_box_mouse]
108
 
108
 
109
	push	dword check6
109
	push	dword check6
110
	call	[check_box_mouse]
110
	call	[check_box_mouse]
111
 
111
 
112
 
112
 
113
	jmp still    ;åñëè íè÷åãî èç ïåðå÷èñëåííîãî òî ñíîâà â öèêë
113
	jmp still    ;åñëè íè÷åãî èç ïåðå÷èñëåííîãî òî ñíîâà â öèêë
114
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115
button:
115
button:
116
	mcall	17	;ïîëó÷èòü èäåíòèôèêàòîð íàæàòîé êëàâèøè
116
	mcall	17	;ïîëó÷èòü èäåíòèôèêàòîð íàæàòîé êëàâèøè
117
	test ah,ah	;åñëè â ah 0, òî ïåðåéòè íà îáðàáîò÷èê ñîáûòèé still
117
	test ah,ah	;åñëè â ah 0, òî ïåðåéòè íà îáðàáîò÷èê ñîáûòèé still
118
	jz  still
118
	jz  still
119
exit:	mcall	-1
119
exit:	mcall	-1
120
key:
120
key:
121
	mcall	2	;çàãðóçèì çíà÷åíèå 2 â ðåãèñòîð eax è ïîëó÷èì êîä íàæàòîé êëàâèøè
121
	mcall	2	;çàãðóçèì çíà÷åíèå 2 â ðåãèñòîð eax è ïîëó÷èì êîä íàæàòîé êëàâèøè
122
 
122
 
123
	jmp still
123
	jmp still
124
 
124
 
125
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
125
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
126
align 4
126
align 4
127
draw_window:		;ðèñîâàíèå îêíà ïðèëîæåíèÿ
127
draw_window:		;ðèñîâàíèå îêíà ïðèëîæåíèÿ
128
	mcall	12,1
128
	mcall	12,1
129
	mcall	0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
129
	mcall	0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
130
 
130
 
131
	push	dword check1
131
	push	dword check1
132
	call	[check_box_draw]
132
	call	[check_box_draw]
133
 
133
 
134
	push	dword check2
134
	push	dword check2
135
	call	[check_box_draw]
135
	call	[check_box_draw]
136
 
136
 
137
	push	dword check3
137
	push	dword check3
138
	call	[check_box_draw]
138
	call	[check_box_draw]
139
 
139
 
140
	push	dword check4
140
	push	dword check4
141
	call	[check_box_draw]
141
	call	[check_box_draw]
142
 
142
 
143
	push	dword check5
143
	push	dword check5
144
	call	[check_box_draw]
144
	call	[check_box_draw]
145
 
145
 
146
	push	dword check6
146
	push	dword check6
147
	call	[check_box_draw]
147
	call	[check_box_draw]
148
 
148
 
149
 
149
 
150
	mcall	12,2
150
	mcall	12,2
151
	ret
151
	ret
152
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
152
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
153
;DATA äàííûå
153
;DATA äàííûå
154
;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
154
;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
155
system_path	 db '/sys/lib/'
155
system_path	 db '/sys/lib/'
156
library_name	 db 'box_lib.obj',0
156
library_name	 db 'box_lib.obj',0
157
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
157
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
158
;system_path      db '/sys/lib/box_lib.obj',0
158
;system_path      db '/sys/lib/box_lib.obj',0
159
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
159
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
160
;library_name     db 'box_lib.obj',0
160
;library_name     db 'box_lib.obj',0
161
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
161
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
162
 
162
 
163
err_message_found_lib	db 'Sorry I cannot load library box_lib.obj',0
163
err_message_found_lib	db 'Sorry I cannot load library box_lib.obj',0
164
head_f_i:
164
head_f_i:
165
head_f_l		db 'System error',0
165
head_f_l		db 'System error',0
166
err_message_import	db 'Error on load import library box_lib.obj',0
166
err_message_import	db 'Error on load import library box_lib.obj',0
167
 
167
 
168
myimport:   
168
myimport:   
169
 
169
 
170
init_checkbox	dd	aInit_checkbox
170
init_checkbox	dd	aInit_checkbox
171
check_box_draw	dd	aCheck_box_draw
171
check_box_draw	dd	aCheck_box_draw
172
check_box_mouse dd	aCheck_box_mouse
172
check_box_mouse dd	aCheck_box_mouse
173
version_ch	dd	aVersion_ch
173
version_ch	dd	aVersion_ch
174
		dd	0,0
174
		dd	0,0
175
 
175
 
176
 
176
 
177
aInit_checkbox	 db 'init_checkbox',0
177
aInit_checkbox	 db 'init_checkbox2',0
178
aCheck_box_draw  db 'check_box_draw',0
178
aCheck_box_draw  db 'check_box_draw2',0
179
aCheck_box_mouse db 'check_box_mouse',0
179
aCheck_box_mouse db 'check_box_mouse2',0
180
aVersion_ch	 db 'version_ch',0
180
aVersion_ch	 db 'version_ch2',0
181
;---------------------------------------------------------------------
181
;---------------------------------------------------------------------
182
check1 check_box (10 shl 16 + 12),(10 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en
182
check1 check_box2 (10 shl 16 + 12),(10 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en
183
check2 check_box (10 shl 16 + 22),(25 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2
183
check2 check_box2 (10 shl 16 + 22),(25 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2
184
check3 check_box (10 shl 16 + 12),(40 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3
184
check3 check_box2 (10 shl 16 + 12),(40 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3
185
check4 check_box (10 shl 16 + 12),(70 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text4,ch_flag_top
185
check4 check_box2 (10 shl 16 + 12),(70 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text4,ch_flag_top
186
check5 check_box (10 shl 16 + 12),(100 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text5,ch_flag_middle
186
check5 check_box2 (10 shl 16 + 12),(100 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text5,ch_flag_middle
187
check6 check_box (10 shl 16 + 12),(130 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text6,ch_flag_bottom
187
check6 check_box2 (10 shl 16 + 12),(130 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text6,ch_flag_bottom
188
;---------------------------------------------------------------------
188
;---------------------------------------------------------------------
189
hed		db 'CheckBox Exemples  date 15.10.2010',0
189
hed		db 'CheckBox Exemples  date 15.10.2010',0
190
hed_end:
190
hed_end:
191
;---------------------------------------------------------------------
191
;---------------------------------------------------------------------
192
check_text	db 'First checkbox, set flag ch_flag_en',0
192
check_text	db 'First checkbox, set flag ch_flag_en',0
193
check_text2	db 'Second checkbox,not set any flag',0
193
check_text2	db 'Second checkbox,not set any flag',0
194
check_text3	db 'Number 3 checkbox, not set any flag',0
194
check_text3	db 'Number 3 checkbox, not set any flag',0
195
check_text4	db 'Set flag is ch_flag_top',0
195
check_text4	db 'Set flag is ch_flag_top',0
196
check_text5	db 'Set flag is ch_flag_middle',0
196
check_text5	db 'Set flag is ch_flag_middle',0
197
check_text6	db 'Set flag is ch_flag_bottom',0
197
check_text6	db 'Set flag is ch_flag_bottom',0
198
;---------------------------------------------------------------------
198
;---------------------------------------------------------------------
199
MEM_END:
199
MEM_END:
200
cur_dir_path	rb 1024
200
cur_dir_path	rb 1024
201
library_path	rb 1024
201
library_path	rb 1024
202
		rb 1024		;for stack
202
		rb 1024		;for stack
203
PRIL_END:
203
PRIL_END: