Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | 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:
55
sys_load_library  library_name, cur_dir_path, library_path, system_path, \
56
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
57
       	test	eax,eax
58
	jnz	exit
59
 
60
window:
61
	call draw_window		;первоначально необходимо нарисовать окно
62
align 4
63
still:				;основной обработчик
64
	mcall	10		;Ожидать события
65
	dec  eax
66
	jz   window
67
	dec  eax
68
	jz   key
69
	dec  eax
70
	jz   button
71
 
72
	push	dword check1
73
	call	[check_box_mouse]
74
 
75
	push	dword check2
76
	call	[check_box_mouse]
77
 
78
	jmp still    ;если ничего из перечисленного то снова в цикл
79
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
80
button:
81
	mcall	17	;получить идентификатор нажатой клавиши
82
	test ah,ah	;если в ah 0, то перейти на обработчик событий still
83
	jz  still
84
exit:	mcall	-1
85
key:
86
	mcall	2	;загрузим значение 2 в регистор eax и получим код нажатой клавиши
87
 
88
	jmp still
89
 
90
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
91
align 4
92
draw_window:		;рисование окна приложения
93
	mcall	12,1
94
	mcall	0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
95
 
96
	push	dword check1
97
	call	[check_box_draw]
98
 
99
	push	dword check2
100
	call	[check_box_draw]
101
 
102
	mcall	12,2
103
	ret
104
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
105
;DATA данные
106
;Всегда соблюдать последовательность в имени.
107
system_path	 db '/sys/lib/'
108
library_name	 db 'box_lib.obj',0
109
; Если есть желание разъединить, то нужно использовать следующию конструкцию
110
;system_path      db '/sys/lib/box_lib.obj',0
111
;... любая последовательность других команд и определений.
112
;library_name     db 'box_lib.obj',0
113
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114
 
115
err_message_found_lib	db 'Sorry I cannot load library box_lib.obj',0
116
head_f_i:
117
head_f_l		db 'System error',0
118
err_message_import	db 'Error on load import library box_lib.obj',0
119
 
120
myimport:
121
 
122
check_box_draw	dd	aCheck_box_draw
123
check_box_mouse dd	aCheck_box_mouse
124
version_ch	dd	aVersion_ch
125
		dd	0,0
126
 
127
 
128
aCheck_box_draw  db 'check_box_draw',0
129
aCheck_box_mouse db 'check_box_mouse',0
130
aVersion_ch	 db 'version_ch',0
131
;---------------------------------------------------------------------
132
check1 check_box (10 shr 16 + 12),(45 shr 16 + 12),6,0x80AABBCC,0,0,check_text,14,ch_flag_en
133
check2 check_box (10 shr 16 + 12),(60 shr 16 + 12),6,0x80AABBCC,0,0,check_text2,15
134
;---------------------------------------------------------------------
135
hed		db 'CheckBox Exemples  date 03.10.2010',0
136
hed_end:
137
;---------------------------------------------------------------------
138
check_text	db 'First checkbox'
139
check_text2	db 'Second checkbox'
140
;---------------------------------------------------------------------
141
MEM_END:
142
cur_dir_path	rb 1024
143
library_path	rb 1024
144
		rb 1024		;for stack
145
PRIL_END:
146