forked from KolibriOS/kolibrios
That new in this version:
1) Transfer of parameters to functions of library is copied on the convention stdcall. 2) Now functions link on names. 3)Now, if to guide the mouse on a component and to press the left button of the mouse all messages from the mouse are sent only to this component.If to release(let off) the left button of the mouse messages from the mouse again become accessible to all components. 4) In library new functions are added. int Version (void) - to receive the version of library. The version comes back in a format: year + month + day. The current library has version 71014. void RemoveComponent (void *Control, int new_x, int new_y) - moves a component to new coordinates. void ResizeComponent (void *Control, int new_sizex, int new_sizey) - changes the size of a component. Examples of use of these functions look in example Bookmark. 5) The example of work with libGUI in programming language C is added. This example is a part of the interface written by me for my scientific program. git-svn-id: svn://kolibrios.org@648 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
1270
programs/develop/libGUI/examples/C example/interface.c
Normal file
1270
programs/develop/libGUI/examples/C example/interface.c
Normal file
File diff suppressed because it is too large
Load Diff
18
programs/develop/libGUI/examples/C example/kolibri.ld
Normal file
18
programs/develop/libGUI/examples/C example/kolibri.ld
Normal file
@@ -0,0 +1,18 @@
|
||||
/*OUTPUT_FORMAT("binary")*/
|
||||
ENTRY("start_")
|
||||
SECTIONS
|
||||
{
|
||||
.text 0x000000:
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.data : {
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
}
|
||||
}
|
22
programs/develop/libGUI/examples/C example/makefile2
Normal file
22
programs/develop/libGUI/examples/C example/makefile2
Normal file
@@ -0,0 +1,22 @@
|
||||
OUTFILE = interface.kex
|
||||
INPUT = interface.c
|
||||
OUTPUT = interface.o
|
||||
OBJS = start.o interface.o
|
||||
|
||||
|
||||
.SUFFIXES: .asm .o
|
||||
|
||||
$(OUTFILE) : $(OBJS)
|
||||
fasm start.asm start.o
|
||||
gcc -c $(INPUT) -nostdinc -I/home/andrew/kolibri/develop/include/
|
||||
ld -nostdlib -T kolibri.ld -n -L/home/andrew/kolibri/develop/lib/ -o $(OUTFILE) $(OBJS) -lck -lm
|
||||
objcopy $(OUTFILE) -O binary
|
||||
|
||||
.asm.o:
|
||||
fasm $*.asm
|
||||
|
||||
.c.o:
|
||||
gcc -c $*.c
|
||||
|
||||
clean :
|
||||
del *.o
|
136
programs/develop/libGUI/examples/C example/start.asm
Normal file
136
programs/develop/libGUI/examples/C example/start.asm
Normal file
@@ -0,0 +1,136 @@
|
||||
format MS COFF
|
||||
section '.text' executable
|
||||
public start_
|
||||
;extrn mf_init
|
||||
extrn main
|
||||
;include 'debug2.inc'
|
||||
__DEBUG__=0
|
||||
|
||||
start_:
|
||||
;virtual at 0
|
||||
db 'MENUET01' ; 1. Magic number (8 bytes)
|
||||
dd 0x01 ; 2. Version of executable file
|
||||
dd start ; 3. Start address
|
||||
dd 0x0 ; 4. Size of image
|
||||
dd 0x100000 ; 5. Size of needed memory
|
||||
dd 0x100000 ; 6. Pointer to stack
|
||||
hparams dd 0x0 ; 7. Pointer to program arguments
|
||||
hpath dd 0x0 ; 8. Pointer to program path
|
||||
;end virtual
|
||||
|
||||
start:
|
||||
;DEBUGF 'Start programm\n'
|
||||
;init heap of memory
|
||||
mov eax,68
|
||||
mov ebx,11
|
||||
int 0x40
|
||||
|
||||
;DEBUGF ' path "%s"\n params "%s"\n', .path, .params
|
||||
; check for overflow
|
||||
mov al, [path+buf_len-1]
|
||||
or al, [params+buf_len-1]
|
||||
jnz .crash
|
||||
; check if path written by OS
|
||||
mov eax, [hparams]
|
||||
test eax, eax
|
||||
jz .without_path
|
||||
mov eax, path
|
||||
.without_path:
|
||||
mov esi, eax
|
||||
call push_param
|
||||
; retrieving parameters
|
||||
mov esi, params
|
||||
xor edx, edx ; dl - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0)
|
||||
; dh - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
mov ecx, 1 ; cl = 1
|
||||
; ch = 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
.parse:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .run
|
||||
test dl, dl
|
||||
jnz .findendparam
|
||||
;{<7B><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp al, ' '
|
||||
jz .parse ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov dl, cl ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp al, '"'
|
||||
jz @f ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov dh, ch ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec esi
|
||||
call push_param
|
||||
inc esi
|
||||
jmp .parse
|
||||
|
||||
@@:
|
||||
mov dh, cl ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call push_param ;<3B><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jmp .parse ;<3B><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
||||
|
||||
.findendparam:
|
||||
test dh, dh
|
||||
jz @f ; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp al, '"'
|
||||
jz .clear
|
||||
jmp .parse
|
||||
@@:
|
||||
cmp al, ' '
|
||||
jnz .parse
|
||||
|
||||
.clear:
|
||||
lea ebx, [esi - 1]
|
||||
mov [ebx], ch
|
||||
mov dl, ch
|
||||
jmp .parse
|
||||
|
||||
.run:
|
||||
;DEBUGF 'call main(%x, %x) with params:\n', [argc], argv
|
||||
if __DEBUG__ = 1
|
||||
mov ecx, [argc]
|
||||
@@:
|
||||
lea esi, [ecx * 4 + argv-4]
|
||||
DEBUGF '0x%x) "%s"\n', cx, [esi]
|
||||
loop @b
|
||||
end if
|
||||
push [argc]
|
||||
push argv
|
||||
call main
|
||||
.exit:
|
||||
;DEBUGF 'Exit from prog\n';
|
||||
xor eax,eax
|
||||
dec eax
|
||||
int 0x40
|
||||
dd -1
|
||||
.crash:
|
||||
;DEBUGF 'E:buffer overflowed\n'
|
||||
jmp .exit
|
||||
;============================
|
||||
push_param:
|
||||
;============================
|
||||
;parameters
|
||||
; esi - pointer
|
||||
;description
|
||||
; procedure increase argc
|
||||
; and add pointer to array argv
|
||||
; procedure changes ebx
|
||||
mov ebx, [argc]
|
||||
cmp ebx, max_parameters
|
||||
jae .dont_add
|
||||
mov [argv+4*ebx], esi
|
||||
inc [argc]
|
||||
.dont_add:
|
||||
ret
|
||||
;==============================
|
||||
public params as '__argv'
|
||||
public path as '__path'
|
||||
|
||||
section '.bss'
|
||||
buf_len = 0x400
|
||||
max_parameters=0x20
|
||||
argc rd 1
|
||||
argv rd max_parameters
|
||||
path rb buf_len
|
||||
params rb buf_len
|
||||
|
||||
;section '.data'
|
||||
;include_debug_strings ; ALWAYS present in data section
|
47
programs/develop/libGUI/examples/bookmarks/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/bookmarks/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
800
programs/develop/libGUI/examples/bookmarks/bookmark.asm
Normal file
800
programs/develop/libGUI/examples/bookmarks/bookmark.asm
Normal file
@@ -0,0 +1,800 @@
|
||||
;
|
||||
;
|
||||
; This is example using GUI component Bookmark from libGUI.
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 126*1024
|
||||
dd 126*1024
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnResizeComponent
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [resize_component],eax
|
||||
|
||||
push fnRemoveComponent
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [remove_component],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteScroller
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_scroller],eax
|
||||
|
||||
push fnCraeteBookmark
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_bookmark],eax
|
||||
|
||||
push fnCraeteImage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_image],eax
|
||||
|
||||
push fnCraeteText
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_text],eax
|
||||
|
||||
push fnCraeteNumber
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_number],eax
|
||||
|
||||
push fnCraeteCheckbox
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_check_box],eax
|
||||
|
||||
push fnCraeteEditbox
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_edit_box],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],120
|
||||
mov [Button1.y],120
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
|
||||
|
||||
mov [Button3.type],byte 10010001b
|
||||
mov [Button3.x],165
|
||||
mov [Button3.y],320
|
||||
mov [Button3.width],word 70
|
||||
mov [Button3.height],word 20
|
||||
mov [Button3.color1],dword ecx
|
||||
mov [Button3.color2],dword 0xffffff
|
||||
mov [Button3.text],text3
|
||||
|
||||
|
||||
push Button3
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
;********************************************
|
||||
;***************Init scrollers****************
|
||||
;********************************************
|
||||
|
||||
;init vertical scroller
|
||||
mov ecx,[ColorsTable+8]
|
||||
mov [VerticalScroller.type],byte 11110001b
|
||||
mov [VerticalScroller.x],150
|
||||
mov [VerticalScroller.y],10
|
||||
mov [VerticalScroller.pos],0.2
|
||||
mov [VerticalScroller.length],200
|
||||
mov [VerticalScroller.size],0.3
|
||||
mov [VerticalScroller.color1],ecx
|
||||
|
||||
;********************************************
|
||||
;******************Init Image****************
|
||||
;********************************************
|
||||
|
||||
mov [Image.type],byte 10000000b
|
||||
mov [Image.x],30
|
||||
mov [Image.y],10
|
||||
mov [Image.sizex],200
|
||||
mov [Image.sizey],200
|
||||
mov [Image.pointer],Picture
|
||||
|
||||
;********************************************
|
||||
;******************Init Text*****************
|
||||
;********************************************
|
||||
|
||||
mov [Text.type],byte 10000000b
|
||||
mov [Text.color],0xffffff
|
||||
mov [Text.x],100
|
||||
mov [Text.y],100
|
||||
mov [Text.length],25
|
||||
mov [Text.pointer],text_for_text
|
||||
|
||||
;********************************************
|
||||
;*****************Init Number****************
|
||||
;********************************************
|
||||
|
||||
mov [Number.type],byte 10000010b
|
||||
mov [Number.color],0xffffff
|
||||
mov [Number.x],150
|
||||
mov [Number.y],100
|
||||
mov [Number.parameters],5*65536+4
|
||||
mov [Number.number],-1234.5678
|
||||
|
||||
;********************************************
|
||||
;***************Init CheckBox****************
|
||||
;********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
;mov [CheckBox.ch_flags],word 10b
|
||||
mov [CheckBox.ch_left],150
|
||||
mov [CheckBox.ch_top],330
|
||||
mov [CheckBox.ch_text_margin],4
|
||||
mov [CheckBox.ch_size],11
|
||||
mov [CheckBox.ch_color],0xffffff
|
||||
mov [CheckBox.ch_border_color],ecx
|
||||
mov [CheckBox.ch_text_color],0
|
||||
mov [CheckBox.ch_text_ptr],check_box_text
|
||||
mov [CheckBox.ch_text_length],9
|
||||
|
||||
;********************************************
|
||||
;***************Init EditBox*****************
|
||||
;********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
mov [EditBox.ed_flags],0b;1000000000000000b
|
||||
mov [EditBox.ed_left],100 ;x
|
||||
mov [EditBox.ed_top],100 ;y
|
||||
mov [EditBox.ed_width],150
|
||||
mov [EditBox.ed_height],14
|
||||
mov [EditBox.ed_max],100
|
||||
mov [EditBox.ed_text],buffer_for_text
|
||||
mov [EditBox.ed_color],dword 0xffffff
|
||||
mov [EditBox.shift_color],dword 0xaabbcc
|
||||
mov [EditBox.ed_focus_border_color],0
|
||||
mov [EditBox.ed_blur_border_color],ecx
|
||||
mov [EditBox.ed_text_color],0
|
||||
|
||||
|
||||
|
||||
;********************************************
|
||||
;***************Init bookmark****************
|
||||
;********************************************
|
||||
|
||||
|
||||
;init bookmark
|
||||
mov ecx,[ColorsTable+8]
|
||||
mov [Bookmark.type],byte 10000001b
|
||||
mov [Bookmark.x],10
|
||||
mov [Bookmark.y],10
|
||||
mov [Bookmark.sizex],350
|
||||
mov [Bookmark.sizey],270
|
||||
mov [Bookmark.color_1],dword ecx
|
||||
mov [Bookmark.color2],dword 0xffffff
|
||||
|
||||
mov [Bookmark.number_bookmarks],3
|
||||
mov [Bookmark.number_zak_in_1],2
|
||||
mov [Bookmark.number_zak_in_2],3
|
||||
mov [Bookmark.number_zak_in_3],1
|
||||
|
||||
mov [Bookmark.text_for_1],text4
|
||||
mov [Bookmark.number_contrl_1],1
|
||||
mov [Bookmark.type_control_1],1
|
||||
mov [Bookmark.info_1_control],dword Button1
|
||||
|
||||
mov [Bookmark.text_for_2],text5
|
||||
mov [Bookmark.number_contrl_2],1
|
||||
mov [Bookmark.type_control_2],6
|
||||
mov [Bookmark.info_2_control],dword Number
|
||||
|
||||
mov [Bookmark.text_for_3],text6
|
||||
mov [Bookmark.number_contrl_3],1
|
||||
mov [Bookmark.type_control_3],8
|
||||
mov [Bookmark.info_3_control],dword EditBox
|
||||
|
||||
mov [Bookmark.text_for_4],text7
|
||||
mov [Bookmark.number_contrl_4],1
|
||||
mov [Bookmark.type_control_4],4
|
||||
mov [Bookmark.info_4_control],dword Image
|
||||
|
||||
mov [Bookmark.text_for_5],text8
|
||||
mov [Bookmark.number_contrl_5],1
|
||||
mov [Bookmark.type_control_5],2
|
||||
mov [Bookmark.info_5_control],dword VerticalScroller
|
||||
|
||||
mov [Bookmark.text_for_6],text9
|
||||
mov [Bookmark.number_contrl_6],1
|
||||
mov [Bookmark.type_control_6],5
|
||||
mov [Bookmark.info_6_control],dword Text
|
||||
|
||||
|
||||
push Bookmark
|
||||
push Parend
|
||||
call [craete_bookmark]
|
||||
mov [PointerToControlForBookmark],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
;*****************************************************
|
||||
;**********Example of resize component****************
|
||||
;*****************************************************
|
||||
mov ebx,[PointerToControlForButtonExit]
|
||||
push 30;270
|
||||
push 150;250
|
||||
push ebx
|
||||
call [resize_component]
|
||||
|
||||
;*****************************************************
|
||||
;**********Example of remove component****************
|
||||
;*****************************************************
|
||||
mov ebx,[PointerToControlForButtonExit]
|
||||
push 340;270
|
||||
push 120;250
|
||||
push ebx
|
||||
call [remove_component]
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov eax,[PointerToControlForBookmark]
|
||||
mov ebx,[Window_SizeX]
|
||||
mov ecx,[Window_SizeY]
|
||||
sub ebx,50
|
||||
sub ecx,130
|
||||
;or [eax+44],byte 1000000b
|
||||
mov [eax+32],ebx
|
||||
mov [eax+36],ecx
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForBookmark]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
mcall 9,IPC_table,-1
|
||||
mcall 12,1
|
||||
|
||||
mov eax,[IPC_table+34]
|
||||
mov ebx,[IPC_table+38]
|
||||
mov ecx,[IPC_table+42]
|
||||
mov edx,[IPC_table+46]
|
||||
mov [Window_CordinatX],eax
|
||||
mov [Window_CordinatY],ebx
|
||||
mov [Window_SizeX],ecx
|
||||
mov [Window_SizeY],edx
|
||||
|
||||
cmp [Window_SizeX],400
|
||||
jae no_minimum_size_x
|
||||
|
||||
mov [Window_SizeX],400
|
||||
mov ecx,[Window_SizeX]
|
||||
|
||||
no_minimum_size_x:
|
||||
|
||||
cmp [Window_SizeY],400
|
||||
jae no_minimum_size_y
|
||||
|
||||
mov [Window_SizeY],400
|
||||
mov edx,[Window_SizeY]
|
||||
|
||||
no_minimum_size_y:
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,[Window_CordinatX]
|
||||
mov ecx,[Window_CordinatY]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[Window_SizeX]
|
||||
add ecx,[Window_SizeY]
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
;call print_controls_information
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
check_box_text db 'Check box',0
|
||||
|
||||
text1 db 'text',0
|
||||
text3 db 'Exit',0
|
||||
|
||||
text4 db 'Bookmark_1',0
|
||||
text5 db 'Bookmark_2',0
|
||||
text6 db 'Bookmark_3',0
|
||||
text7 db 'Bookmark_4',0
|
||||
|
||||
text8 db 'Bookmark_5',0
|
||||
text9 db 'Bookmark_6',0
|
||||
|
||||
text_for_text db 'Hello world from bookmark',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnResizeComponent db 'ResizeComponent',0
|
||||
fnRemoveComponent db 'RemoveComponent',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteScroller db 'CraeteScroller',0
|
||||
fnCraeteBookmark db 'CraeteBookmark',0
|
||||
fnCraeteImage db 'CraeteImage',0
|
||||
fnCraeteText db 'CraeteText',0
|
||||
fnCraeteNumber db 'CraeteNumber',0
|
||||
fnCraeteCheckbox db 'CraeteCheckbox',0
|
||||
fnCraeteEditbox db 'CraeteEditbox',0
|
||||
fnCraeteProgressbar db 'CraeteProgressbar',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
resize_component dd 0
|
||||
remove_component dd 0
|
||||
craete_button dd 0
|
||||
craete_scroller dd 0
|
||||
craete_bookmark dd 0
|
||||
craete_image dd 0
|
||||
craete_text dd 0
|
||||
craete_number dd 0
|
||||
craete_check_box dd 0
|
||||
craete_edit_box dd 0
|
||||
craete_progres_bar dd 0
|
||||
|
||||
PointerToControlForButton1 dd 0
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForHorizontalScroller dd 0
|
||||
PointerToControlForVerticalScroller dd 0
|
||||
|
||||
PointerToControlForBookmark dd 0
|
||||
|
||||
PointerToControlForImage dd 0
|
||||
|
||||
PointerToControlForText dd 0
|
||||
|
||||
PointerToControlForCheckBox dd 0
|
||||
|
||||
PointerToControlForEditBox dd 0
|
||||
|
||||
|
||||
Window_CordinatX dd 0
|
||||
Window_CordinatY dd 0
|
||||
|
||||
Window_SizeX dd 0
|
||||
Window_SizeY dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
IPC_table rd 256
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
buffer_for_text rb 100+2
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
struc SCROLLER
|
||||
{
|
||||
.type rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.length rw 1
|
||||
.color1 rd 1
|
||||
.size rd 1
|
||||
.pos rd 1
|
||||
.buttons_flags rw 1
|
||||
.ChildButton1 rd 1
|
||||
.ChildButton2 rd 1
|
||||
.mouseX rw 1
|
||||
.mouseY rw 1
|
||||
}
|
||||
|
||||
struc BOOKMARK
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.color_1 rd 1
|
||||
.reserved rd 1
|
||||
.color2 rd 1
|
||||
|
||||
.number_bookmarks rd 1
|
||||
.number_zak_in_1 rd 1
|
||||
.number_zak_in_2 rd 1
|
||||
.number_zak_in_3 rd 1
|
||||
|
||||
.text_for_1 rd 1
|
||||
.number_contrl_1 rd 1
|
||||
.type_control_1 rd 1
|
||||
.info_1_control rd 1
|
||||
|
||||
.text_for_2 rd 1
|
||||
.number_contrl_2 rd 1
|
||||
.type_control_2 rd 1
|
||||
.info_2_control rd 1
|
||||
|
||||
.text_for_3 rd 1
|
||||
.number_contrl_3 rd 1
|
||||
.type_control_3 rd 1
|
||||
.info_3_control rd 1
|
||||
|
||||
.text_for_4 rd 1
|
||||
.number_contrl_4 rd 1
|
||||
.type_control_4 rd 1
|
||||
.info_4_control rd 1
|
||||
|
||||
.text_for_5 rd 1
|
||||
.number_contrl_5 rd 1
|
||||
.type_control_5 rd 1
|
||||
.info_5_control rd 1
|
||||
|
||||
.text_for_6 rd 1
|
||||
.number_contrl_6 rd 1
|
||||
.type_control_6 rd 1
|
||||
.info_6_control rd 1
|
||||
|
||||
}
|
||||
|
||||
struc IMAGE
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.pointer rd 1
|
||||
}
|
||||
|
||||
struc TEXT
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.length rd 1
|
||||
.pointer rd 1
|
||||
}
|
||||
|
||||
struc NUMBER
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.number rd 1
|
||||
.parameters rd 1
|
||||
}
|
||||
|
||||
struc CHECKBOX
|
||||
{
|
||||
.ch_flags rw 1
|
||||
.ch_left rw 1
|
||||
.ch_top rw 1
|
||||
.ch_text_margin rd 1
|
||||
.ch_size rd 1
|
||||
.ch_size_2 rw 1
|
||||
.ch_size_3 rw 1
|
||||
.ch_color rd 1
|
||||
.ch_border_color rd 1
|
||||
.ch_text_color rd 1
|
||||
.ch_text_ptr rd 1
|
||||
.ch_text_length rw 1
|
||||
.mouseX rd 1
|
||||
.mouseY rd 1
|
||||
}
|
||||
struc EDITBOX
|
||||
{
|
||||
.ed_width rd 1 ;? ?
|
||||
.ed_left rd 1 ; ??
|
||||
.ed_top rd 1 ; ??
|
||||
.ed_color rd 1 ;??? ?
|
||||
.shift_color rd 1 ;?????. ??
|
||||
.ed_focus_border_color rd 1 ;??? ?
|
||||
.ed_blur_border_color rd 1 ;?? ? ?
|
||||
.ed_text_color rd 1 ;????
|
||||
.ed_max rd 1 ;- ? ?? ?? ?
|
||||
.ed_text rd 1 ;??? ??
|
||||
.ed_flags rw 1 ;?
|
||||
.ed_size rd 1 ;- ?
|
||||
.ed_pos rd 1 ;? ??
|
||||
.ed_offset rd 1 ;??
|
||||
.cl_curs_x rd 1 ;??? ???? ?
|
||||
.cl_curs_y rd 1 ;??? ???? ?
|
||||
.ed_shift_pos rd 1 ; ??
|
||||
.ed_shift_pos_old rd 1 ;?? ??
|
||||
.ed_height rd 1
|
||||
.mouseX rd 1
|
||||
.mouseY rd 1
|
||||
}
|
||||
|
||||
struc PROGRESSBAR
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color1 rd 1
|
||||
.color2 rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.progres rd 1
|
||||
.color3 rd 1
|
||||
}
|
||||
|
||||
Button1 BUTTON
|
||||
Button3 BUTTON
|
||||
VerticalScroller SCROLLER
|
||||
Bookmark BOOKMARK
|
||||
Image IMAGE
|
||||
Text TEXT
|
||||
Number NUMBER
|
||||
CheckBox CHECKBOX
|
||||
EditBox EDITBOX
|
||||
EditBox2 EDITBOX
|
||||
ProgressBar PROGRESSBAR
|
||||
|
||||
antibug: rb 2000
|
||||
|
||||
Picture:
|
||||
file 'image.raw'
|
||||
|
||||
i_end:
|
85
programs/develop/libGUI/examples/bookmarks/image.raw
Normal file
85
programs/develop/libGUI/examples/bookmarks/image.raw
Normal file
File diff suppressed because one or more lines are too long
47
programs/develop/libGUI/examples/button/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/button/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
444
programs/develop/libGUI/examples/button/button.asm
Normal file
444
programs/develop/libGUI/examples/button/button.asm
Normal file
@@ -0,0 +1,444 @@
|
||||
;
|
||||
;
|
||||
; This is a example of using GUI component Button from libGUI
|
||||
;
|
||||
;
|
||||
|
||||
control_hader_size = 44
|
||||
control_button_data_size = 50
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 4*1024
|
||||
dd 4*1024
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
;load dll from system directory
|
||||
mcall 68,19,sys_dll_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [crate_button],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],20
|
||||
mov [Button1.y],10
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],0xaabbccff;dword ecx
|
||||
;mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [crate_button]
|
||||
mov [PointerToControlForButton1],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button2.type],byte 10010010b
|
||||
mov [Button2.x],20
|
||||
mov [Button2.y],40
|
||||
mov [Button2.width],word 70
|
||||
mov [Button2.height],word 20
|
||||
mov [Button2.color1],dword ecx
|
||||
mov [Button2.color2],dword 0xffffff
|
||||
mov [Button2.image],ButtonPicture
|
||||
mov [Button2.imageSizeX],16
|
||||
mov [Button2.imageSizeY],16
|
||||
mov [Button2.transparentColor],0xffffff
|
||||
|
||||
push Button2
|
||||
push Parend
|
||||
call [crate_button]
|
||||
mov [PointerToControlForButton2],eax
|
||||
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button3.type],byte 10000100b
|
||||
mov [Button3.x],20
|
||||
mov [Button3.y],70
|
||||
mov [Button3.width],word 70
|
||||
mov [Button3.height],word 20
|
||||
mov [Button3.color1],dword ecx
|
||||
mov [Button3.color2],dword 0xffffff
|
||||
mov [Button3.text],text1
|
||||
mov [Button3.textX],40
|
||||
mov [Button3.textY],8
|
||||
mov [Button3.textcolor],0
|
||||
mov [Button3.image],ButtonPicture
|
||||
mov [Button3.imageX],3
|
||||
mov [Button3.imageY],3
|
||||
mov [Button3.imageSizeX],16
|
||||
mov [Button3.imageSizeY],16
|
||||
mov [Button3.transparentColor],0xffffff
|
||||
|
||||
push Button3
|
||||
push Parend
|
||||
call [crate_button]
|
||||
mov [PointerToControlForButton3],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button4.type],byte 10010001b
|
||||
mov [Button4.x],20
|
||||
mov [Button4.y],100
|
||||
mov [Button4.width],word 70
|
||||
mov [Button4.height],word 20
|
||||
mov [Button4.color1],dword ecx
|
||||
mov [Button4.color2],dword 0xffffff
|
||||
mov [Button4.text],text4
|
||||
mov [Button4.textX],10
|
||||
mov [Button4.textY],10
|
||||
mov [Button4.textcolor],0
|
||||
mov [Button4.image],ButtonPicture
|
||||
mov [Button4.imageX],5
|
||||
mov [Button4.imageY],5
|
||||
mov [Button4.imageSizeX],16
|
||||
mov [Button4.imageSizeY],16
|
||||
mov [Button4.transparentColor],0xffffff
|
||||
|
||||
push Button4
|
||||
push Parend
|
||||
call [crate_button]
|
||||
mov [PointerToControlForButton4],eax
|
||||
|
||||
|
||||
call draw_window
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
mov [SystemEvent],eax
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
|
||||
;button 1
|
||||
mov esi,[PointerToControlForButton1]
|
||||
add esi,control_hader_size ;size control's structure
|
||||
mov edi,Button1
|
||||
mov ecx,control_button_data_size
|
||||
rep movsb
|
||||
|
||||
;button 2
|
||||
mov esi,[PointerToControlForButton2]
|
||||
add esi,control_hader_size ;size control's structure
|
||||
mov edi,Button2
|
||||
mov ecx,control_button_data_size
|
||||
rep movsb
|
||||
|
||||
;button 3
|
||||
mov esi,[PointerToControlForButton3]
|
||||
add esi,control_hader_size ;size control's structure
|
||||
mov edi,Button3
|
||||
mov ecx,control_button_data_size
|
||||
rep movsb
|
||||
|
||||
;button 4
|
||||
mov esi,[PointerToControlForButton4]
|
||||
add esi,control_hader_size ;size control's structure
|
||||
mov edi,Button4
|
||||
mov ecx,control_button_data_size
|
||||
rep movsb
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Button4.flag]
|
||||
cmp al,11b
|
||||
jne no_exit_demo
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_exit_demo:
|
||||
|
||||
cmp al,1b
|
||||
jne no_only_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_only_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_only_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
;free resourses
|
||||
push [PointerToControlForButton1]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForButton2]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForButton3]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForButton4]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,200
|
||||
add ecx,200
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_dll_path db '/sys/lib/libGUi.obj',0
|
||||
|
||||
|
||||
text1 db 'text',0
|
||||
text4 db 'Exit',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
crate_button dd 0
|
||||
|
||||
PointerToControlForButton1 dd 0
|
||||
PointerToControlForButton2 dd 0
|
||||
PointerToControlForButton3 dd 0
|
||||
PointerToControlForButton4 dd 0
|
||||
|
||||
SystemEvent dd 0
|
||||
button_pressed rb 1
|
||||
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message dd 0,0,0,0
|
||||
ColorsTable dd 0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
|
||||
Button1 BUTTON
|
||||
Button2 BUTTON
|
||||
Button3 BUTTON
|
||||
Button4 BUTTON
|
||||
|
||||
antibug rb 460
|
||||
|
||||
ButtonPicture:
|
||||
file 'test.raw'
|
||||
|
||||
i_end:
|
1
programs/develop/libGUI/examples/button/test.raw
Normal file
1
programs/develop/libGUI/examples/button/test.raw
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǡ<EFBFBD><EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>v<EFBFBD><EFBFBD><EFBFBD><EFBFBD><17><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{<7B><><1A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>k<EFBFBD><6B><EFBFBD>B<EFBFBD>줟<EFBFBD><ECA49F><EFBFBD>ȩ<EFBFBD><C8A9>sӫ<73><D3AB>D<EFBFBD><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><06><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>m<EFBFBD><6D>}<7D><>{<7B><>E<EFBFBD><45>M<EFBFBD><4D>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>H<EFBFBD><48>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!<21><>c<EFBFBD><63>P<EFBFBD><50>H<EFBFBD><48>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>U<EFBFBD><1E><><EFBFBD>@<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD><52><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><13><> <20><> <20><><0F><><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD>K<EFBFBD><4B>j<EFBFBD><6A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD><44><EFBFBD><EFBFBD>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%<25><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD><65>Z<EFBFBD><5A>H<EFBFBD><48><EFBFBD><EFBFBD>P<EFBFBD><50><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><16><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD><51><EFBFBD>Þ<EFBFBD><C39E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%<25><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>d<EFBFBD><64>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><77><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
47
programs/develop/libGUI/examples/check_box/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/check_box/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
373
programs/develop/libGUI/examples/check_box/check_box.asm
Normal file
373
programs/develop/libGUI/examples/check_box/check_box.asm
Normal file
@@ -0,0 +1,373 @@
|
||||
;
|
||||
;
|
||||
; Example of using gui component CheckBox from libGUI.
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 1600
|
||||
dd 1600
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteCheckbox
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_check_box],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Buttton****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],10
|
||||
mov [Button1.y],40
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
;********************************************
|
||||
;***************Init CheckBox****************
|
||||
;********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
;mov [CheckBox.ch_flags],word 10b
|
||||
mov [CheckBox.ch_left],20
|
||||
mov [CheckBox.ch_top],15
|
||||
mov [CheckBox.ch_text_margin],4
|
||||
mov [CheckBox.ch_size],11
|
||||
mov [CheckBox.ch_color],0xffffff
|
||||
mov [CheckBox.ch_border_color],ecx
|
||||
mov [CheckBox.ch_text_color],0
|
||||
mov [CheckBox.ch_text_ptr],check_box_text
|
||||
mov [CheckBox.ch_text_length],9
|
||||
|
||||
push CheckBox
|
||||
push Parend
|
||||
call [craete_check_box]
|
||||
mov [PointerToControlForCheckBox],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForCheckBox]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,100
|
||||
add ecx,100
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
check_box_text db 'Check box',0
|
||||
|
||||
text1 db 'Exit',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteCheckbox db 'CraeteCheckbox',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
craete_button dd 0
|
||||
craete_check_box dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForCheckBox dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
|
||||
struc CHECKBOX
|
||||
{
|
||||
.ch_flags rw 1
|
||||
.ch_left rw 1
|
||||
.ch_top rw 1
|
||||
.ch_text_margin rd 1
|
||||
.ch_size rd 1
|
||||
.ch_size_2 rw 1
|
||||
.ch_size_3 rw 1
|
||||
.ch_color rd 1
|
||||
.ch_border_color rd 1
|
||||
.ch_text_color rd 1
|
||||
.ch_text_ptr rd 1
|
||||
.ch_text_length rw 1
|
||||
.mouseX rd 1
|
||||
.mouseY rd 1
|
||||
}
|
||||
|
||||
|
||||
Button1 BUTTON
|
||||
CheckBox CHECKBOX
|
||||
i_end:
|
47
programs/develop/libGUI/examples/edit_box/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/edit_box/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
383
programs/develop/libGUI/examples/edit_box/edit_box.asm
Normal file
383
programs/develop/libGUI/examples/edit_box/edit_box.asm
Normal file
@@ -0,0 +1,383 @@
|
||||
;
|
||||
;
|
||||
; This is example of using GUI component EditBox from libGUI.
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 1800
|
||||
dd 1800
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteEditbox
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_edit_box],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],20
|
||||
mov [Button1.y],50
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
;********************************************
|
||||
;***************Init EditBox*****************
|
||||
;********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
mov [EditBox.ed_flags],0b;1000000000000000b
|
||||
mov [EditBox.ed_left],5 ;x
|
||||
mov [EditBox.ed_top],10 ;y
|
||||
mov [EditBox.ed_width],100
|
||||
mov [EditBox.ed_height],14
|
||||
mov [EditBox.ed_max],100
|
||||
mov [EditBox.ed_text],buffer_for_text
|
||||
mov [EditBox.ed_color],dword 0xffffff
|
||||
mov [EditBox.shift_color],dword 0xaabbcc
|
||||
mov [EditBox.ed_focus_border_color],0
|
||||
mov [EditBox.ed_blur_border_color],ecx
|
||||
mov [EditBox.ed_text_color],0
|
||||
|
||||
push EditBox
|
||||
push Parend
|
||||
call [craete_edit_box]
|
||||
mov [PointerToControlForEditBox],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForEditBox]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,120
|
||||
add ecx,120
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
text1 db 'Exit',0
|
||||
|
||||
text_for_text db 'Hello world from zakladka',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteEditbox db 'CraeteEditbox',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
craete_button dd 0
|
||||
craete_edit_box dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForEditBox dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
buffer_for_text rb 100+2
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
struc EDITBOX
|
||||
{
|
||||
.ed_width rd 1
|
||||
.ed_left rd 1
|
||||
.ed_top rd 1
|
||||
.ed_color rd 1
|
||||
.shift_color rd 1
|
||||
.ed_focus_border_color rd 1
|
||||
.ed_blur_border_color rd 1
|
||||
.ed_text_color rd 1
|
||||
.ed_max rd 1
|
||||
.ed_text rd 1
|
||||
.ed_flags rw 1
|
||||
.ed_size rd 1
|
||||
.ed_pos rd 1
|
||||
.ed_offset rd 1
|
||||
.cl_curs_x rd 1
|
||||
.cl_curs_y rd 1
|
||||
.ed_shift_pos rd 1
|
||||
.ed_shift_pos_old rd 1
|
||||
.ed_height rd 1
|
||||
.mouseX rd 1
|
||||
.mouseY rd 1
|
||||
}
|
||||
|
||||
Button1 BUTTON
|
||||
EditBox EDITBOX
|
||||
|
||||
i_end:
|
47
programs/develop/libGUI/examples/image/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/image/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
BIN
programs/develop/libGUI/examples/image/KOSLOGO.RAW
Normal file
BIN
programs/develop/libGUI/examples/image/KOSLOGO.RAW
Normal file
Binary file not shown.
362
programs/develop/libGUI/examples/image/image.asm
Normal file
362
programs/develop/libGUI/examples/image/image.asm
Normal file
@@ -0,0 +1,362 @@
|
||||
;
|
||||
;
|
||||
; This is example of using GUI component Image from libGUI.
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 7*1024+100
|
||||
dd 7*1024+100
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [crate_button],eax
|
||||
|
||||
push fnCraeteImage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [crate_image],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],10
|
||||
mov [Button1.y],50
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [crate_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
;********************************************
|
||||
;******************Init Image****************
|
||||
;********************************************
|
||||
|
||||
mov [Image.type],byte 10000000b
|
||||
mov [Image.x],25
|
||||
mov [Image.y],5
|
||||
mov [Image.sizex],40
|
||||
mov [Image.sizey],40
|
||||
mov [Image.pointer],Picture
|
||||
|
||||
push Image
|
||||
push Parend
|
||||
call [crate_image]
|
||||
mov [PointerToControlForImage],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForImage]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,100
|
||||
add ecx,100
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
text1 db 'Exit',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteImage db 'CraeteImage',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
crate_button dd 0
|
||||
crate_image dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForImage dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
struc IMAGE
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.pointer rd 1
|
||||
}
|
||||
|
||||
Button1 BUTTON
|
||||
Image IMAGE
|
||||
|
||||
untibug: rb 1000
|
||||
|
||||
Picture:
|
||||
file 'koslogo.raw'
|
||||
|
||||
i_end:
|
47
programs/develop/libGUI/examples/number/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/number/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
377
programs/develop/libGUI/examples/number/number.asm
Normal file
377
programs/develop/libGUI/examples/number/number.asm
Normal file
@@ -0,0 +1,377 @@
|
||||
;
|
||||
;
|
||||
; This is example using GUI component Number from libGUI.
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 1700
|
||||
dd 1700
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteNumber
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_number],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],10
|
||||
mov [Button1.y],50
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
;********************************************
|
||||
;****************Init Numbers****************
|
||||
;********************************************
|
||||
|
||||
mov [NumberFloat.type],byte 10000010b
|
||||
mov [NumberFloat.color],0xffffff
|
||||
mov [NumberFloat.x],20
|
||||
mov [NumberFloat.y],10
|
||||
mov [NumberFloat.parameters],4*65536+5
|
||||
mov [NumberFloat.number],-1234.56789
|
||||
|
||||
mov [NumberInteger.type],byte 10000000b
|
||||
mov [NumberInteger.color],0xffffff
|
||||
mov [NumberInteger.x],26
|
||||
mov [NumberInteger.y],30
|
||||
mov [NumberInteger.parameters],8*65536
|
||||
mov [NumberInteger.number],12345678
|
||||
|
||||
push NumberFloat
|
||||
push Parend
|
||||
call [craete_number]
|
||||
mov [PointerToControlForNumberFloat],eax
|
||||
|
||||
push NumberInteger
|
||||
push Parend
|
||||
call [craete_number]
|
||||
mov [PointerToControlForNumberInteger],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForNumberFloat]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForNumberInteger]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,100
|
||||
add ecx,100
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
text1 db 'Exit',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteNumber db 'CraeteNumber',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
craete_button dd 0
|
||||
craete_number dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForNumberFloat dd 0
|
||||
PointerToControlForNumberInteger dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
|
||||
struc NUMBER
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.number rd 1
|
||||
.parameters rd 1
|
||||
}
|
||||
|
||||
Button1 BUTTON
|
||||
NumberFloat NUMBER
|
||||
NumberInteger NUMBER
|
||||
|
||||
i_end:
|
47
programs/develop/libGUI/examples/progress_bar/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/progress_bar/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
412
programs/develop/libGUI/examples/progress_bar/progress_bar.asm
Normal file
412
programs/develop/libGUI/examples/progress_bar/progress_bar.asm
Normal file
@@ -0,0 +1,412 @@
|
||||
;
|
||||
;
|
||||
; Example of using GUI componet ProgressBar from libGUI
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 124*1024
|
||||
dd 124*1024
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteProgressbar
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_progress_bar],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],60
|
||||
mov [Button1.y],50
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
mov [ProgressBar.type],byte 10000001b
|
||||
mov [ProgressBar.color1],dword 0xffffff
|
||||
mov [ProgressBar.color2],0xff0000
|
||||
mov [ProgressBar.color3],ecx
|
||||
mov [ProgressBar.x],5
|
||||
mov [ProgressBar.y],5
|
||||
mov [ProgressBar.sizex],175
|
||||
mov [ProgressBar.sizey],16
|
||||
mov [ProgressBar.progres],0
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
push ProgressBar
|
||||
push Parend
|
||||
call [craete_progress_bar]
|
||||
mov [PointerToControlForProgressBar],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov [progress],0.02
|
||||
mov [progress_step],0.01
|
||||
still:
|
||||
;----------------------------------------
|
||||
;--send special message for ProgressBar--
|
||||
;----------------------------------------
|
||||
|
||||
mov ebx,[progress]
|
||||
mov eax,[PointerToControlForProgressBar]
|
||||
mov [eax+44],byte 1b
|
||||
mov [eax+44+26],ebx
|
||||
|
||||
fld [progress_step]
|
||||
fld [progress]
|
||||
fadd st0,st1
|
||||
fstp [progress]
|
||||
fstp st0
|
||||
|
||||
cmp [progress],dword 1.0
|
||||
jl no_1_
|
||||
|
||||
mov [progress],0.02
|
||||
mov eax,[PointerToControlForProgressBar]
|
||||
mov [eax+44],byte 10000001b
|
||||
mov [eax+44+26],dword 0.02
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
no_1_:
|
||||
|
||||
;fld [progress]
|
||||
;fcmovbe
|
||||
;fstsw ax
|
||||
;sahf
|
||||
;jle no_1_
|
||||
|
||||
;no_1_:
|
||||
|
||||
mov [Message],dword 3
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mcall 5,1
|
||||
|
||||
mcall 11
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForProgressBar]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,200
|
||||
add ecx,100
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
;call print_controls_information
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
text1 db 'Exit',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteProgressbar db 'CraeteProgressbar',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
craete_button dd 0
|
||||
|
||||
craete_progress_bar dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForProgressBar dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
progress dd 0
|
||||
progress_step dd 0
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
struc PROGRESSBAR
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color1 rd 1
|
||||
.color2 rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.progres rd 1
|
||||
.color3 rd 1
|
||||
}
|
||||
|
||||
Button1 BUTTON
|
||||
ProgressBar PROGRESSBAR
|
||||
i_end:
|
47
programs/develop/libGUI/examples/scroll_bar/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/scroll_bar/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
506
programs/develop/libGUI/examples/scroll_bar/scroller.asm
Normal file
506
programs/develop/libGUI/examples/scroll_bar/scroller.asm
Normal file
@@ -0,0 +1,506 @@
|
||||
;
|
||||
;
|
||||
; This is example of using GUI component Scroller from libGUI
|
||||
;
|
||||
;
|
||||
|
||||
control_hader_size = 44
|
||||
control_scroller_data_size = 29
|
||||
control_button_data_size = 50
|
||||
|
||||
first_child_button_pressed = 1b
|
||||
second_child_button_pressed = 10000b
|
||||
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 4000
|
||||
dd 4000
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
;load dll from system directory
|
||||
mcall 68,19,sys_dll_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteScroller
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_scroller],eax
|
||||
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [ButtonExit.type],byte 10010001b
|
||||
mov [ButtonExit.x],90
|
||||
mov [ButtonExit.y],160
|
||||
mov [ButtonExit.width],word 70
|
||||
mov [ButtonExit.height],word 20
|
||||
mov [ButtonExit.color1],dword ecx
|
||||
mov [ButtonExit.color2],dword 0xffffff
|
||||
mov [ButtonExit.text],text
|
||||
|
||||
|
||||
push ButtonExit
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
;********************************************
|
||||
;***************Init scrollers****************
|
||||
;********************************************
|
||||
|
||||
;init vertical scroller
|
||||
mov ecx,[ColorsTable+8]
|
||||
mov [VerticalScroller.type],byte 11100001b
|
||||
mov [VerticalScroller.x],10
|
||||
mov [VerticalScroller.y],30
|
||||
mov [VerticalScroller.pos],0.2
|
||||
mov [VerticalScroller.length],200
|
||||
mov [VerticalScroller.size],0.9
|
||||
mov [VerticalScroller.color1],ecx
|
||||
|
||||
|
||||
push VerticalScroller
|
||||
push Parend
|
||||
call [craete_scroller]
|
||||
mov [PointerToControlForVerticalScroller],eax
|
||||
|
||||
;init horizontal scroller
|
||||
mov ecx,[ColorsTable+8]
|
||||
mov [HorizontalScroller.type],byte 11110010b
|
||||
mov [HorizontalScroller.x],30
|
||||
mov [HorizontalScroller.y],30
|
||||
mov [HorizontalScroller.pos],0.7
|
||||
mov [HorizontalScroller.length],200
|
||||
mov [HorizontalScroller.size],0.3
|
||||
mov [HorizontalScroller.color1],0xaabbccff;ecx
|
||||
|
||||
push HorizontalScroller
|
||||
push Parend
|
||||
call [craete_scroller]
|
||||
mov [PointerToControlForHorizontalScroller],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
mov [SystemEvent],eax
|
||||
|
||||
;-----------------------
|
||||
;check for redraw window
|
||||
;-----------------------
|
||||
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;---------------------
|
||||
;check for keys events
|
||||
;---------------------
|
||||
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;-------------------------
|
||||
;check for events of mouse
|
||||
;-------------------------
|
||||
|
||||
cmp eax,3
|
||||
jne no_button_close_window
|
||||
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_button_close_window:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
;craete message of mouse for controls
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send message to controls
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
;interraction with button exit
|
||||
;copy data of scroller of button from control to structure
|
||||
|
||||
mov esi,[PointerToControlForButtonExit]
|
||||
add esi,control_hader_size
|
||||
mov edi,ButtonExit
|
||||
mov ecx,control_button_data_size
|
||||
rep movsb
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ButtonExit.flag]
|
||||
|
||||
;check button for pressing
|
||||
and al,10b
|
||||
test al,al
|
||||
jz button_3_not_pressed
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
jmp no_pressed_button
|
||||
|
||||
button_3_not_pressed:
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_pressed_button
|
||||
|
||||
jmp exit
|
||||
no_pressed_button:
|
||||
|
||||
;interraction with vertical scroller
|
||||
|
||||
;copy data of vertical scroller from control to structure
|
||||
|
||||
mov esi,[PointerToControlForVerticalScroller]
|
||||
add esi,control_hader_size
|
||||
mov edi,VerticalScroller
|
||||
mov ecx,control_scroller_data_size
|
||||
rep movsb
|
||||
|
||||
mov eax,[VerticalScroller.pos]
|
||||
mov [PosY_float],eax ;position of scroll bar from 0...1
|
||||
|
||||
xor edx,edx
|
||||
call DrawRectangle
|
||||
|
||||
xor eax,eax
|
||||
mov ax,[VerticalScroller.buttons_flags]
|
||||
and ax,first_child_button_pressed
|
||||
test ax,ax
|
||||
jz vertical_first_child_button_not_pressed
|
||||
|
||||
mov edx,0xff00
|
||||
call DrawRectangle
|
||||
|
||||
vertical_first_child_button_not_pressed:
|
||||
|
||||
|
||||
xor eax,eax
|
||||
mov ax,[VerticalScroller.buttons_flags]
|
||||
and ax,second_child_button_pressed
|
||||
test ax,ax
|
||||
jz vertical_second_child_button_not_pressed
|
||||
|
||||
mov edx,0xff
|
||||
call DrawRectangle
|
||||
|
||||
vertical_second_child_button_not_pressed:
|
||||
|
||||
;interraction with horizontal scroller
|
||||
|
||||
;copy data of horizontal scroller from control to structure
|
||||
|
||||
mov esi,[PointerToControlForHorizontalScroller]
|
||||
add esi,control_hader_size
|
||||
mov edi,HorizontalScroller
|
||||
mov ecx,control_scroller_data_size
|
||||
rep movsb
|
||||
|
||||
xor eax,eax
|
||||
mov ax,[HorizontalScroller.buttons_flags]
|
||||
and ax,first_child_button_pressed
|
||||
test ax,ax
|
||||
jz horizontal_first_child_button_not_pressed
|
||||
|
||||
mov edx,0xffffff
|
||||
call DrawRectangle
|
||||
|
||||
horizontal_first_child_button_not_pressed:
|
||||
|
||||
xor eax,eax
|
||||
mov ax,[HorizontalScroller.buttons_flags]
|
||||
and ax,second_child_button_pressed
|
||||
test ax,ax
|
||||
jz horizontal_second_child_button_not_pressed
|
||||
|
||||
mov edx,0xff0000
|
||||
call DrawRectangle
|
||||
|
||||
horizontal_second_child_button_not_pressed:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
;free resourses
|
||||
push [PointerToControlForVerticalScroller]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForHorizontalScroller]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,280
|
||||
add ecx,280
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
DrawRectangle:
|
||||
|
||||
mov eax,13
|
||||
mov ebx,100*65536+50
|
||||
mov ecx,100*65536+50
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_dll_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
text db 'Exit',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteScroller db 'CraeteScroller',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
craete_button dd 0
|
||||
craete_scroller dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForHorizontalScroller dd 0
|
||||
PointerToControlForVerticalScroller dd 0
|
||||
|
||||
|
||||
SystemEvent dd 0
|
||||
|
||||
PosX_float dd 0
|
||||
PosY_float dd 0
|
||||
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
IPC_table rd 256
|
||||
path rb 256
|
||||
ColorsTable rd 10
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
x dd 0
|
||||
y dd 0
|
||||
number dd 0
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
struc SCROLLER
|
||||
{
|
||||
.type rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.length rw 1
|
||||
.color1 rd 1
|
||||
.size rd 1
|
||||
.pos rd 1
|
||||
.buttons_flags rw 1
|
||||
.ChildButton1 rd 1
|
||||
.ChildButton2 rd 1
|
||||
.mouseX rw 1
|
||||
.mouseY rw 1
|
||||
}
|
||||
|
||||
ButtonExit BUTTON
|
||||
VerticalScroller SCROLLER
|
||||
HorizontalScroller SCROLLER
|
||||
|
||||
|
||||
i_end:
|
47
programs/develop/libGUI/examples/text/GETPROC.ASM
Normal file
47
programs/develop/libGUI/examples/text/GETPROC.ASM
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
_ksys_cofflib_getproc:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
|
||||
next_name_check:
|
||||
|
||||
mov ecx,[ebx]
|
||||
test ecx,ecx
|
||||
jz end_export
|
||||
|
||||
;cmp export string with name
|
||||
mov esi,[esp+8]
|
||||
xor edi,edi
|
||||
next_simbol_check:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ecx]
|
||||
test al,al
|
||||
jz exit_check_simbol
|
||||
|
||||
xor edx,edx
|
||||
mov dl,[esi]
|
||||
cmp al,dl
|
||||
je simbols_equvalent
|
||||
add edi,1
|
||||
jmp exit_check_simbol
|
||||
simbols_equvalent:
|
||||
|
||||
add ecx,1
|
||||
add esi,1
|
||||
jmp next_simbol_check
|
||||
exit_check_simbol:
|
||||
|
||||
test edi,edi
|
||||
jnz function_not_finded
|
||||
mov eax,[ebx+4]
|
||||
jmp end_export
|
||||
function_not_finded:
|
||||
|
||||
add ebx,8
|
||||
|
||||
jmp next_name_check
|
||||
|
||||
end_export:
|
||||
|
||||
ret 8
|
364
programs/develop/libGUI/examples/text/text.asm
Normal file
364
programs/develop/libGUI/examples/text/text.asm
Normal file
@@ -0,0 +1,364 @@
|
||||
;
|
||||
;
|
||||
; This is example using GUI component Text from libGUI.
|
||||
;
|
||||
;
|
||||
|
||||
include 'macros.inc'
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd 1600
|
||||
dd 1600
|
||||
dd 0
|
||||
dd path
|
||||
|
||||
start:
|
||||
;init hepe of memory
|
||||
mcall 68,11
|
||||
|
||||
;set current dir as ./
|
||||
call GetPath
|
||||
|
||||
;load dll
|
||||
mcall 68,19,path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall 68,19,sys_libGUI_path
|
||||
|
||||
test eax,eax
|
||||
jnz libGUI_loaded
|
||||
|
||||
mcall -1
|
||||
|
||||
libGUI_loaded:
|
||||
|
||||
mov [myexport],eax
|
||||
|
||||
;load dll functions
|
||||
|
||||
push fnDestroyControl
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [destroy_control],eax
|
||||
|
||||
push fnSendMessage
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [send_message],eax
|
||||
|
||||
push fnCraeteButton
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_button],eax
|
||||
|
||||
push fnCraeteText
|
||||
push [myexport]
|
||||
call _ksys_cofflib_getproc
|
||||
mov [craete_text],eax
|
||||
|
||||
;set events mask
|
||||
mcall 40,1100111b
|
||||
|
||||
;get standart colors table
|
||||
mcall 48,3,ColorsTable,40
|
||||
|
||||
;*********************************************
|
||||
;****************Init Butttons****************
|
||||
;*********************************************
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
mov [Button1.type],byte 10010001b
|
||||
mov [Button1.x],80
|
||||
mov [Button1.y],50
|
||||
mov [Button1.width],word 70
|
||||
mov [Button1.height],word 20
|
||||
mov [Button1.color1],dword ecx
|
||||
mov [Button1.color2],dword 0xffffff
|
||||
mov [Button1.text],text1
|
||||
|
||||
push Button1
|
||||
push Parend
|
||||
call [craete_button]
|
||||
mov [PointerToControlForButtonExit],eax
|
||||
|
||||
mov ecx,[ColorsTable+8]
|
||||
and ecx,0xffffff
|
||||
|
||||
|
||||
;********************************************
|
||||
;******************Init Text*****************
|
||||
;********************************************
|
||||
|
||||
mov [Text.type],byte 10000000b
|
||||
mov [Text.color],0xffffff
|
||||
mov [Text.x],5
|
||||
mov [Text.y],10
|
||||
mov [Text.length],36
|
||||
mov [Text.pointer],text_for_text
|
||||
|
||||
|
||||
push Text
|
||||
push Parend
|
||||
call [craete_text]
|
||||
mov [PointerToControlForText],eax
|
||||
|
||||
call draw_window
|
||||
|
||||
|
||||
;send message 1 for redrawing ALL controls
|
||||
mov [Message],dword 1
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
;check for redraw window
|
||||
cmp eax,1
|
||||
jne no_window
|
||||
|
||||
call draw_window
|
||||
|
||||
mov [Message],dword 1
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
jmp still
|
||||
no_window:
|
||||
|
||||
;check for keys events
|
||||
cmp eax,2
|
||||
jne no_keys
|
||||
|
||||
mcall 2
|
||||
shr eax,8
|
||||
|
||||
mov [Message],dword 2
|
||||
mov [Message+4],eax
|
||||
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[Message+4]
|
||||
|
||||
cmp al,27
|
||||
je exit
|
||||
|
||||
jmp still
|
||||
no_keys:
|
||||
|
||||
;check for pressed butons
|
||||
cmp eax,3
|
||||
jne no_buttons
|
||||
|
||||
mcall 17
|
||||
shr eax,8
|
||||
|
||||
jmp still
|
||||
no_buttons:
|
||||
|
||||
;check for mouse events
|
||||
cmp eax,6
|
||||
jne no_mouse
|
||||
|
||||
mov [Message],dword 6
|
||||
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
shr eax,16 ;x
|
||||
and ebx,0xffff ;y
|
||||
|
||||
mov [Message+4],eax
|
||||
mov [Message+8],ebx
|
||||
|
||||
mcall 37,2
|
||||
mov [Message+12],eax
|
||||
|
||||
;send system events to control
|
||||
push Message
|
||||
push Parend
|
||||
call [send_message]
|
||||
|
||||
mov eax,[PointerToControlForButtonExit]
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,11b
|
||||
jne no_crossing_pressing_button
|
||||
|
||||
mov [button_pressed],1
|
||||
|
||||
no_crossing_pressing_button:
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,byte[eax+45]
|
||||
cmp bl,1b
|
||||
jne no_crossing_button
|
||||
|
||||
cmp [button_pressed],1
|
||||
jne no_crossing_button
|
||||
|
||||
jmp exit
|
||||
|
||||
no_crossing_button:
|
||||
|
||||
jmp still
|
||||
no_mouse:
|
||||
|
||||
jmp still
|
||||
|
||||
exit:
|
||||
|
||||
push [PointerToControlForButtonExit]
|
||||
call [destroy_control]
|
||||
|
||||
push [PointerToControlForText]
|
||||
call [destroy_control]
|
||||
|
||||
mcall -1
|
||||
|
||||
|
||||
;**********************************************
|
||||
;*******************Draw window****************
|
||||
;**********************************************
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,50
|
||||
mov ecx,50
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,250
|
||||
add ecx,100
|
||||
mov edx,0x03aabbcc
|
||||
mov esi,0x805080d0
|
||||
mov edi,0x005080d0
|
||||
mcall
|
||||
|
||||
;call print_controls_information
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
|
||||
|
||||
GetPath:
|
||||
|
||||
mov ebx,255
|
||||
mov ecx,path
|
||||
|
||||
next_symvol:
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[edx]
|
||||
cmp eax,'/'
|
||||
je exit_path
|
||||
|
||||
dec ebx
|
||||
jnz next_symvol
|
||||
|
||||
exit_path:
|
||||
|
||||
inc edx
|
||||
mov esi,dll_name
|
||||
mov edi,edx
|
||||
mov ecx,10
|
||||
rep movsb
|
||||
|
||||
ret
|
||||
|
||||
include 'getproc.asm'
|
||||
|
||||
;************************************************************
|
||||
;***************************DATA*****************************
|
||||
;************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
dll_name db 'libGUI.obj',0
|
||||
sys_libGUI_path db '/sys/lib/libGUI.obj',0
|
||||
|
||||
text1 db 'Exit',0
|
||||
|
||||
text_for_text db 'Example of using GUI component text.',0
|
||||
|
||||
fnDestroyControl db 'DestroyControl',0
|
||||
fnSendMessage db 'SendMessage',0
|
||||
fnCraeteButton db 'CraeteButton',0
|
||||
fnCraeteText db 'CraeteText',0
|
||||
|
||||
myexport dd 0
|
||||
|
||||
destroy_control dd 0
|
||||
send_message dd 0
|
||||
craete_button dd 0
|
||||
craete_text dd 0
|
||||
|
||||
PointerToControlForButtonExit dd 0
|
||||
|
||||
PointerToControlForText dd 0
|
||||
|
||||
button_pressed dd 0
|
||||
|
||||
|
||||
path rb 256
|
||||
|
||||
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
|
||||
Message rd 4
|
||||
|
||||
ColorsTable rd 10
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.type db 1
|
||||
.flag db 1
|
||||
.x dw 1
|
||||
.y dw 1
|
||||
.width dw 1
|
||||
.height dw 1
|
||||
.image dd 1
|
||||
.imageX dw 1
|
||||
.imageY dw 1
|
||||
.imageSizeX dw 1
|
||||
.imageSizeY dw 1
|
||||
.transparentColor dd 1
|
||||
.text dd 1
|
||||
.textX dw 1
|
||||
.textY dw 1
|
||||
.textcolor dd 1
|
||||
.color1 dd 1
|
||||
.color2 dd 1
|
||||
.mouseX dw 1
|
||||
.mouseY dw 1
|
||||
}
|
||||
|
||||
struc TEXT
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.length rd 1
|
||||
.pointer rd 1
|
||||
}
|
||||
|
||||
Button1 BUTTON
|
||||
Text TEXT
|
||||
|
||||
i_end:
|
Reference in New Issue
Block a user