Subversion Repositories Kolibri OS

Rev

Rev 1652 | 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
 
71
 
1639 Lrz 72
window:
73
	call draw_window		;первоначально необходимо нарисовать окно
74
align 4
75
still:				;основной обработчик
76
	mcall	10		;Ожидать события
77
	dec  eax
78
	jz   window
79
	dec  eax
80
	jz   key
81
	dec  eax
82
	jz   button
83
 
84
	push	dword check1
85
	call	[check_box_mouse]
86
 
87
	push	dword check2
88
	call	[check_box_mouse]
89
 
1657 lrz 90
	push	dword check3
91
	call	[check_box_mouse]
92
 
93
 
1639 Lrz 94
	jmp still    ;если ничего из перечисленного то снова в цикл
95
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96
button:
97
	mcall	17	;получить идентификатор нажатой клавиши
98
	test ah,ah	;если в ah 0, то перейти на обработчик событий still
99
	jz  still
100
exit:	mcall	-1
101
key:
102
	mcall	2	;загрузим значение 2 в регистор eax и получим код нажатой клавиши
103
 
104
	jmp still
105
 
106
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
107
align 4
108
draw_window:		;рисование окна приложения
109
	mcall	12,1
110
	mcall	0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
111
 
112
	push	dword check1
113
	call	[check_box_draw]
114
 
115
	push	dword check2
116
	call	[check_box_draw]
117
 
1657 lrz 118
	push	dword check3
119
	call	[check_box_draw]
120
 
121
 
1639 Lrz 122
	mcall	12,2
123
	ret
124
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
125
;DATA данные
126
;Всегда соблюдать последовательность в имени.
127
system_path	 db '/sys/lib/'
128
library_name	 db 'box_lib.obj',0
129
; Если есть желание разъединить, то нужно использовать следующию конструкцию
130
;system_path      db '/sys/lib/box_lib.obj',0
131
;... любая последовательность других команд и определений.
132
;library_name     db 'box_lib.obj',0
133
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134
 
135
err_message_found_lib	db 'Sorry I cannot load library box_lib.obj',0
136
head_f_i:
137
head_f_l		db 'System error',0
138
err_message_import	db 'Error on load import library box_lib.obj',0
139
 
140
myimport:
141
 
1657 lrz 142
init_checkbox	dd	aInit_checkbox
1639 Lrz 143
check_box_draw	dd	aCheck_box_draw
144
check_box_mouse dd	aCheck_box_mouse
145
version_ch	dd	aVersion_ch
146
		dd	0,0
147
 
148
 
1657 lrz 149
aInit_checkbox	 db 'init_checkbox',0
1639 Lrz 150
aCheck_box_draw  db 'check_box_draw',0
151
aCheck_box_mouse db 'check_box_mouse',0
152
aVersion_ch	 db 'version_ch',0
153
;---------------------------------------------------------------------
1657 lrz 154
check1 check_box (20 shl 16 + 12),(45 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en
155
check2 check_box (20 shl 16 + 22),(60 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2
156
check3 check_box (20 shl 16 + 12),(75 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3
1639 Lrz 157
;---------------------------------------------------------------------
1657 lrz 158
hed		db 'CheckBox Exemples  date 12.10.2010',0
1639 Lrz 159
hed_end:
160
;---------------------------------------------------------------------
1652 lrz 161
check_text	db 'First checkbox',0
162
check_text2	db 'Second checkbox',0
1657 lrz 163
check_text3	db 'Number 3 checkbox',0
1639 Lrz 164
;---------------------------------------------------------------------
165
MEM_END:
166
cur_dir_path	rb 1024
167
library_path	rb 1024
168
		rb 1024		;for stack
169
PRIL_END:
170