Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1639 Lrz 1
;*****************************************************************************
2
; Example for Box_lib: checkbox
3
; Copyright (c) 2007-2010, Alexey  Teplov aka 
4
; All rights reserved.
5
;
6
; Redistribution and use in source and binary forms, with or without
7
; modification, are permitted provided that the following conditions are met:
8
;	 * Redistributions of source code must retain the above copyright
9
;	   notice, this list of conditions and the following disclaimer.
10
;	 * Redistributions in binary form must reproduce the above copyright
11
;	   notice, this list of conditions and the following disclaimer in the
12
;	   documentation and/or other materials provided with the distribution.
13
;	 * Neither the name of the  nor the
14
;	   names of its contributors may be used to endorse or promote products
15
;	   derived from this software without specific prior written permission.
16
;
17
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov ''AS IS'' AND ANY
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
;******************************************************************************
28
 
29
use32
30
	org 0x0
31
;------------  from kolibrios programm
32
	db 'MENUET01'
33
	dd 0x01
34
	dd START
35
	dd MEM_END
36
	dd PRIL_END
37
	dd PRIL_END
38
	dd 0x0
39
	dd cur_dir_path
40
;------------ 
41
;------------ 
42
include '../../../../macros.inc'
43
include '../load_lib.mac'
44
include 'box_lib.mac'
45
;include 'macros.inc'
46
;include 'load_lib.mac'
47
;------------ 
48
;------------ 
49
@use_library
50
;------------ 
51
;---------------------------------------------------------------------
52
;--- Start of program ----------------------------------------------
53
;---------------------------------------------------------------------
54
START:
1657 lrz 55
	mcall	40,0x27
56
 
1639 Lrz 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
59
       	test	eax,eax
60
	jnz	exit
1657 lrz 61
;init checkboxes
62
	push	dword check1
63
	call	[init_checkbox]
1639 Lrz 64
 
1657 lrz 65
	push	dword check2
66
	call	[init_checkbox]
67
 
68
	push	dword check3
69
	call	[init_checkbox]
70
 
1660 lrz 71
	push	dword check4
72
	call	[init_checkbox]
73
 
74
	push	dword check5
75
	call	[init_checkbox]
76
 
77
	push	dword check6
78
	call	[init_checkbox]
79
 
1657 lrz 80
 
1639 Lrz 81
window:
82
	call draw_window		;первоначально необходимо нарисовать окно
83
align 4
84
still:				;основной обработчик
85
	mcall	10		;Ожидать события
86
	dec  eax
87
	jz   window
88
	dec  eax
89
	jz   key
90
	dec  eax
91
	jz   button
92
 
93
	push	dword check1
94
	call	[check_box_mouse]
95
 
96
	push	dword check2
97
	call	[check_box_mouse]
98
 
1657 lrz 99
	push	dword check3
100
	call	[check_box_mouse]
101
 
102
 
1660 lrz 103
	push	dword check4
104
	call	[check_box_mouse]
105
 
106
	push	dword check5
107
	call	[check_box_mouse]
108
 
109
	push	dword check6
110
	call	[check_box_mouse]
111
 
112
 
1639 Lrz 113
	jmp still    ;если ничего из перечисленного то снова в цикл
114
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115
button:
116
	mcall	17	;получить идентификатор нажатой клавиши
117
	test ah,ah	;если в ah 0, то перейти на обработчик событий still
118
	jz  still
119
exit:	mcall	-1
120
key:
121
	mcall	2	;загрузим значение 2 в регистор eax и получим код нажатой клавиши
122
 
123
	jmp still
124
 
125
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
126
align 4
127
draw_window:		;рисование окна приложения
128
	mcall	12,1
129
	mcall	0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
130
 
131
	push	dword check1
132
	call	[check_box_draw]
133
 
134
	push	dword check2
135
	call	[check_box_draw]
136
 
1657 lrz 137
	push	dword check3
138
	call	[check_box_draw]
139
 
1660 lrz 140
	push	dword check4
141
	call	[check_box_draw]
1657 lrz 142
 
1660 lrz 143
	push	dword check5
144
	call	[check_box_draw]
145
 
146
	push	dword check6
147
	call	[check_box_draw]
148
 
149
 
1639 Lrz 150
	mcall	12,2
151
	ret
152
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
153
;DATA данные
154
;Всегда соблюдать последовательность в имени.
155
system_path	 db '/sys/lib/'
156
library_name	 db 'box_lib.obj',0
157
; Если есть желание разъединить, то нужно использовать следующию конструкцию
158
;system_path      db '/sys/lib/box_lib.obj',0
159
;... любая последовательность других команд и определений.
160
;library_name     db 'box_lib.obj',0
161
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
162
 
163
err_message_found_lib	db 'Sorry I cannot load library box_lib.obj',0
164
head_f_i:
165
head_f_l		db 'System error',0
166
err_message_import	db 'Error on load import library box_lib.obj',0
167
 
168
myimport:
169
 
1657 lrz 170
init_checkbox	dd	aInit_checkbox
1639 Lrz 171
check_box_draw	dd	aCheck_box_draw
172
check_box_mouse dd	aCheck_box_mouse
173
version_ch	dd	aVersion_ch
174
		dd	0,0
175
 
176
 
1682 lrz 177
aInit_checkbox	 db 'init_checkbox2',0
178
aCheck_box_draw  db 'check_box_draw2',0
179
aCheck_box_mouse db 'check_box_mouse2',0
180
aVersion_ch	 db 'version_ch2',0
1639 Lrz 181
;---------------------------------------------------------------------
1682 lrz 182
check1 check_box2 (10 shl 16 + 12),(10 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en
183
check2 check_box2 (10 shl 16 + 22),(25 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2
184
check3 check_box2 (10 shl 16 + 12),(40 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3
185
check4 check_box2 (10 shl 16 + 12),(70 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text4,ch_flag_top
186
check5 check_box2 (10 shl 16 + 12),(100 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text5,ch_flag_middle
187
check6 check_box2 (10 shl 16 + 12),(130 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text6,ch_flag_bottom
1639 Lrz 188
;---------------------------------------------------------------------
1660 lrz 189
hed		db 'CheckBox Exemples  date 15.10.2010',0
1639 Lrz 190
hed_end:
191
;---------------------------------------------------------------------
1660 lrz 192
check_text	db 'First checkbox, set flag ch_flag_en',0
193
check_text2	db 'Second 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
196
check_text5	db 'Set flag is ch_flag_middle',0
197
check_text6	db 'Set flag is ch_flag_bottom',0
1639 Lrz 198
;---------------------------------------------------------------------
199
MEM_END:
200
cur_dir_path	rb 1024
201
library_path	rb 1024
202
		rb 1024		;for stack
203
PRIL_END:
204