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:
parent
16f5992719
commit
6cdf720037
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 - èä¸ò ïàðàìåòð(1) èëè ðàçäåëèòåëè(0)
|
||||
; dh - ñèìâîë ñ êîòîðîãî íà÷àëñÿ ïàðàìåòð (1 êàâû÷êè, 0 îñòàëüíîå)
|
||||
mov ecx, 1 ; cl = 1
|
||||
; ch = 0 ïðîñòî íîëü
|
||||
.parse:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .run
|
||||
test dl, dl
|
||||
jnz .findendparam
|
||||
;{åñëè áûë ðàçäåëèòåëü
|
||||
cmp al, ' '
|
||||
jz .parse ;çàãðóæåí ïðîáåë, ãðóçèì ñëåäóþùèé ñèìâîë
|
||||
mov dl, cl ;íà÷èíàåòñÿ ïàðàìåòð
|
||||
cmp al, '"'
|
||||
jz @f ;çàãðóæåíû êàâû÷êè
|
||||
mov dh, ch ;ïàðàìåòð áåç êàâû÷åê
|
||||
dec esi
|
||||
call push_param
|
||||
inc esi
|
||||
jmp .parse
|
||||
|
||||
@@:
|
||||
mov dh, cl ;ïàðàìåòð â êàâû÷åêàõ
|
||||
call push_param ;åñëè íå ïðîáåë çíà÷èò íà÷èíàåòñÿ êàêîé òî ïàðàìåòð
|
||||
jmp .parse ;åñëè áûë ðàçäåëèòåëü}
|
||||
|
||||
.findendparam:
|
||||
test dh, dh
|
||||
jz @f ; áåç êàâû÷åê
|
||||
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 @@
|
||||
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙úý˙÷üţűĆĺ÷™Ń˙˙˙˙˙˙˙˙˙˙x˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙·˙˙ǡáůVÉôě›ŇővÁ÷üţµđěůŔ˙˙O˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙„˙˙ś{Ő÷¶ńĚÂčúżâĎđüJĆôľęŻ˙˙W˙˙˙˙˙˙˙˙˙‹Úřˇáů˙˙˙˙˙<CB99>˙˙k°ćŇBĂ줟Ú÷<C39A>Č©äÝsÓ«˙˙D˙˙Ľ˙˙˙˙˙˙˙˙˙1ľň°ďŤŰřąéăÓńŽéřm°ć}śÔ{÷ŤEÔéMşéf˙˙čĚďüHĹô)»ň˙˙˙†Ů÷!¸ńcÍőPÇôHĹô2ľňÓń©üÓUîŹüÝ@˙˙Á—ŢřRČô–ŢřoŃö˙˙˙úý˙úý˙˙˙˙í•î šî ší‰˙˙µňNŻýăV÷ŹźÚK°Ýjľú·ß˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ţđřýŕńýŕńţđDţń×ňJţň€˙˙<CB99>ţí÷ůŻŰď%ť˙˙˙˙˙˙˙˙˙˙˙˙˙˙ń˙˙<CB99>˙˙e˙˙Z˙˙HýáěňP°˙˙p˙˙Ž˙˙˙˙ýţî–ţôú˙˙˙˙˙˙˙˙˙˙˙č˙˙n˙˙´˙˙ľ˝ęďßÚńňQ±“ÝĂžŕźýţ˙˙˙˙ţňů˙ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ůý˙DÄóÍâőöŠĘŰôý%şńľęű˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙§ăůdÎőfÎő˙˙˙˙˙˙˙˙˙¬ĺúhĎö˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ęîüµçúäöý˙˙˙˙˙˙˙˙˙ŢőýwÔö˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
|
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:
|
29
programs/develop/libGUI/install.txt
Normal file
29
programs/develop/libGUI/install.txt
Normal file
@ -0,0 +1,29 @@
|
||||
RUSSIAN
|
||||
|
||||
Åñòü íåñêîëüêî ñïîñîáîâ óñòàíîâèòü libGUI.
|
||||
|
||||
1) Óñòàíîâêà èç KolibriOS.
|
||||
|
||||
Çàãðóçèòå KolibriOS. Ïðè ïîìîùè ôàéëîâîãî ìåíåäæåðà (KFAR èëè KFM íà âàø âûáîð) çàéäèòå â äèðåêòîðèþ /rd/1/lib/ è ñêîïèðóéòå òóäà libGUI.obj
|
||||
Çàïóñòèòå ïðîãðàììó RDSAVE. Åñëè âû çàãðóçèëèñü ñ æ¸ñòêîãî äèñêà, òî ñîõðàíèòå îáðàç íà æ¸ñòêèé äèñê. Ïî óìîë÷àíèþ ïîäðàçóìåâàåòñÿ, ÷òî Âû
|
||||
çàãðóçèëè KolibriOS èç äèðåêòîðèè /hdx/1/kolibri/ , ãäå x çàâèñèò îò òîãî, íà êàêîì IDE ðàçú¸ìå íàõîäèòüñÿ âàø æ¸ñòêèé äèñê. Çíà÷åíèå x âû ìîæåòå
|
||||
ïîñìîòðåòü â ôàéëîâîì ìåíåäæåðå.Åñëè âû çàãðóçèëèñü ñ floppy äèñêà, òî íàæìèòå ñîîòâåòñòâóþùóþ êíîïêó.
|
||||
Âñ¸, óñòàíîâêà çàêîí÷åíà!
|
||||
|
||||
2)Îòêðîéòå îáðàç KOLIBRI.IMG ,Ýòî ìîæíî ñäåëàòü ïðè ïîìîùè ïðîãðàììû WinImage èëè êàêîé ëèáî äðóãîé ïðîãðàììû, ðàáîòàþùåé ñ img îáðàçàìè.
|
||||
Çàéäèòå â îáðàçå â ïàïêó lib è ñêîïèðóéòå òóäà libGUI.obj . Ñîõðàíèòå îáðàç.
|
||||
|
||||
ENGLISH
|
||||
|
||||
There are some ways to establish libGUI.
|
||||
|
||||
1) Installation from KolibriOS.
|
||||
|
||||
Load KolibriOS. By means of the file manager (KFAR or KFM on your choice) go in a directory/rd/1/lib/and copy there libGUI.obj
|
||||
Start program RDSAVE. If you were loaded from a hard disk keep an image on a hard disk. By default it is meant, that you
|
||||
Have loaded KolibriOS from a directory/hdx/1/kolibri/where x depends on on what IDE a socket to be your hard disk. Value x you can
|
||||
To look in the file manager. If you were loaded with floppy a disk press the appropriate button.
|
||||
Everything, installation is completed!
|
||||
|
||||
2) Open image KOLIBRI.IMG, It can be made by means of program WinImage or what or other program working with img in the images.
|
||||
Go in an image in a folder lib and copy there libGUI.obj. Keep an image.
|
16
programs/develop/libGUI/src/VERSION.INC
Normal file
16
programs/develop/libGUI/src/VERSION.INC
Normal file
@ -0,0 +1,16 @@
|
||||
;****************************************************
|
||||
;****************get version of library**************
|
||||
;****************************************************
|
||||
;IN
|
||||
;not
|
||||
;OUT
|
||||
;version of library
|
||||
;fersion format year:mouth:day
|
||||
align 4
|
||||
|
||||
get_version:
|
||||
|
||||
xor eax,eax
|
||||
mov eax,dword 071014 ;07.10.13
|
||||
|
||||
ret
|
1647
programs/develop/libGUI/src/bookmark.inc
Normal file
1647
programs/develop/libGUI/src/bookmark.inc
Normal file
File diff suppressed because it is too large
Load Diff
1437
programs/develop/libGUI/src/button.inc
Normal file
1437
programs/develop/libGUI/src/button.inc
Normal file
File diff suppressed because it is too large
Load Diff
234
programs/develop/libGUI/src/check_box.inc
Normal file
234
programs/develop/libGUI/src/check_box.inc
Normal file
@ -0,0 +1,234 @@
|
||||
|
||||
cb_control_data_dize = 44
|
||||
|
||||
;****************************************************
|
||||
;****************craete CheckBox**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to CheckBox's structure
|
||||
;OUT
|
||||
;pointer to initialized control
|
||||
align 4
|
||||
|
||||
craete_check_box:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForCheckBox],eax
|
||||
|
||||
mov eax,control_header_size+cb_control_data_dize
|
||||
call craete_control
|
||||
|
||||
;set all CheckBox's parameters in control
|
||||
mov [eax],dword check_box
|
||||
|
||||
mov ecx,cb_control_data_dize
|
||||
mov esi,[PointerToStructureForCheckBox]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForCheckBox]
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov cx,[ebx+2] ;CheckBox x
|
||||
mov dx,[ebx+4] ;CheckBox y
|
||||
mov esi,[ebx+10] ;CheckBox size
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],esi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;*****************Draw CheckBox**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of CheckBox
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
check_box:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of CheckBox
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForCheckBox],esi
|
||||
|
||||
;copy information from control to structure
|
||||
add esi,control_header_size
|
||||
mov edi,dword CheckBox
|
||||
mov ecx,control_header_size+cb_control_data_dize
|
||||
rep movsb
|
||||
|
||||
push eax
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForCheckBox]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size
|
||||
;set current coordinats and sizes in CheckBox
|
||||
mov [CheckBox.ch_left],bx
|
||||
mov [CheckBox.ch_top],cx
|
||||
mov [CheckBox.ch_size],edx
|
||||
pop eax
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_check_box
|
||||
|
||||
mov eax,13
|
||||
mov bx,[CheckBox.ch_left]
|
||||
mov cx,[CheckBox.ch_top]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ecx,[CheckBox.ch_size]
|
||||
mov edx,[CheckBox.ch_border_color]
|
||||
mcall
|
||||
|
||||
mov edx,[CheckBox.ch_color]
|
||||
add ebx,1 shl 16 - 2
|
||||
add ecx,1 shl 16 - 2
|
||||
mcall
|
||||
|
||||
mov eax,[CheckBox.ch_size]
|
||||
mov ebx,eax
|
||||
mov ecx,3
|
||||
shr ebx,1
|
||||
cdq
|
||||
idiv ecx
|
||||
mov [CheckBox.ch_size_2],bx
|
||||
mov [CheckBox.ch_size_3],ax
|
||||
|
||||
test word [CheckBox.ch_flags],2
|
||||
jz @f
|
||||
call draw_ch
|
||||
@@:
|
||||
|
||||
movzx ebx,word[CheckBox.ch_left]
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ebx,[CheckBox.ch_text_margin]
|
||||
shl ebx,16
|
||||
mov bx,[CheckBox.ch_top]
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ebx,(-9+1)
|
||||
mov ecx,[CheckBox.ch_text_color]
|
||||
|
||||
mov edx,[CheckBox.ch_text_ptr]
|
||||
movzx esi,word [CheckBox.ch_text_length]
|
||||
|
||||
mov eax,4
|
||||
mcall
|
||||
|
||||
jmp exit_check_box
|
||||
no_redraw_all_check_box:
|
||||
|
||||
|
||||
cmp [eax],dword 6
|
||||
jne no_mouse_check_box
|
||||
|
||||
mov esi,[eax+4]
|
||||
mov edi,[eax+8]
|
||||
mov ebx,[eax+12] ;buttons of mouse state
|
||||
mov [CheckBox.mouseX],esi
|
||||
mov [CheckBox.mouseY],edi
|
||||
mov eax,ebx
|
||||
|
||||
test eax,eax
|
||||
jnz @f
|
||||
btr word [CheckBox.ch_flags],2
|
||||
jmp exit_check_box
|
||||
@@:
|
||||
bts word [CheckBox.ch_flags],2
|
||||
jc .mouse_end
|
||||
movzx esi,word [CheckBox.ch_text_length]
|
||||
|
||||
imul esi,6
|
||||
add esi,[CheckBox.ch_text_margin]
|
||||
|
||||
mov eax,[CheckBox.mouseX]
|
||||
shl eax,16
|
||||
add eax,[CheckBox.mouseY]
|
||||
|
||||
xor ebx,ebx
|
||||
|
||||
movzx ebx,word[CheckBox.ch_top]
|
||||
cmp ax,bx
|
||||
jl .mouse_end
|
||||
add ebx,[CheckBox.ch_size]
|
||||
cmp ax,bx
|
||||
jg .mouse_end
|
||||
|
||||
shr eax,16
|
||||
movzx ebx,word[CheckBox.ch_left]
|
||||
cmp ax,bx
|
||||
jl .mouse_end
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ebx,esi
|
||||
cmp ax,bx
|
||||
jg .mouse_end
|
||||
|
||||
bts word[CheckBox.ch_flags],1
|
||||
jc @f
|
||||
|
||||
call draw_ch
|
||||
|
||||
jmp .mouse_end
|
||||
@@:
|
||||
btr word[CheckBox.ch_flags],1
|
||||
call clear_ch
|
||||
|
||||
.mouse_end:
|
||||
|
||||
no_mouse_check_box:
|
||||
|
||||
exit_check_box:
|
||||
|
||||
;save resultat of work in control
|
||||
mov ecx,cb_control_data_dize ;save in control only flags
|
||||
mov esi,dword CheckBox
|
||||
mov edi,[PointerForCheckBox]
|
||||
add edi,control_header_size
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
ret 8
|
||||
|
||||
;ch_text_margin=4
|
||||
;ch_size=11
|
||||
|
||||
clear_ch:
|
||||
mov edx,[CheckBox.ch_color]
|
||||
jmp @f
|
||||
|
||||
draw_ch:
|
||||
mov edx,[CheckBox.ch_border_color]
|
||||
@@:
|
||||
|
||||
movzx ebx,word[CheckBox.ch_left]
|
||||
add bx,[CheckBox.ch_size_3]
|
||||
shl ebx,16
|
||||
mov bx,[CheckBox.ch_size_2]
|
||||
;mov bp,bx
|
||||
;push bx
|
||||
movzx ecx,word [CheckBox.ch_top]
|
||||
mov eax,13
|
||||
add cx,[CheckBox.ch_size_3]
|
||||
shl ecx,16
|
||||
;mov cx,bp
|
||||
mov cx,[CheckBox.ch_size_2]
|
||||
mcall
|
||||
|
||||
ret
|
26
programs/develop/libGUI/src/check_crossing_box.inc
Normal file
26
programs/develop/libGUI/src/check_crossing_box.inc
Normal file
@ -0,0 +1,26 @@
|
||||
;eax - x1
|
||||
;ebx - y1
|
||||
;ecx - size x
|
||||
;edx - size y
|
||||
;esi - x2
|
||||
;edi - y2
|
||||
;if crossing than eax=0xffffff
|
||||
|
||||
CheckCrossingBox:
|
||||
|
||||
add ecx,eax
|
||||
add edx,ebx
|
||||
|
||||
cmp esi,eax
|
||||
jl exit_crossing
|
||||
cmp esi,ecx
|
||||
ja exit_crossing
|
||||
cmp edi,ebx
|
||||
jl exit_crossing
|
||||
cmp edi,edx
|
||||
ja exit_crossing
|
||||
xor eax,eax
|
||||
mov eax,0xffffff
|
||||
exit_crossing:
|
||||
|
||||
ret
|
1
programs/develop/libGUI/src/config.inc
Normal file
1
programs/develop/libGUI/src/config.inc
Normal file
@ -0,0 +1 @@
|
||||
__CPU_type fix p5
|
131
programs/develop/libGUI/src/debug.inc
Normal file
131
programs/develop/libGUI/src/debug.inc
Normal file
@ -0,0 +1,131 @@
|
||||
macro debug_print str
|
||||
{
|
||||
local ..string, ..label
|
||||
|
||||
jmp ..label
|
||||
..string db str,0
|
||||
..label:
|
||||
|
||||
pushf
|
||||
pushad
|
||||
mov edx,..string
|
||||
call debug_outstr
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
dps fix debug_print
|
||||
|
||||
macro debug_print_dec arg
|
||||
{
|
||||
pushf
|
||||
pushad
|
||||
if ~arg eq eax
|
||||
mov eax,arg
|
||||
end if
|
||||
call debug_outdec
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
dpd fix debug_print_dec
|
||||
|
||||
;---------------------------------
|
||||
debug_outdec: ;(eax - num, edi-str)
|
||||
push 10 ;2
|
||||
pop ecx ;1
|
||||
push -'0' ;2
|
||||
.l0:
|
||||
xor edx,edx ;2
|
||||
div ecx ;2
|
||||
push edx ;1
|
||||
test eax,eax ;2
|
||||
jnz .l0 ;2
|
||||
.l1:
|
||||
pop eax ;1
|
||||
add al,'0' ;2
|
||||
call debug_outchar ; stosb
|
||||
jnz .l1 ;2
|
||||
ret ;1
|
||||
;---------------------------------
|
||||
|
||||
debug_outchar: ; al - char
|
||||
pushf
|
||||
pushad
|
||||
mov cl,al
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
popad
|
||||
popf
|
||||
ret
|
||||
|
||||
debug_outstr:
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
@@:
|
||||
mov cl,[edx]
|
||||
test cl,cl
|
||||
jz @f
|
||||
int 40h
|
||||
inc edx
|
||||
jmp @b
|
||||
@@:
|
||||
ret
|
||||
|
||||
|
||||
macro newline
|
||||
{
|
||||
dps <13,10>
|
||||
}
|
||||
|
||||
macro print message
|
||||
{
|
||||
dps message
|
||||
newline
|
||||
}
|
||||
|
||||
macro pregs
|
||||
{
|
||||
dps "EAX: "
|
||||
dpd eax
|
||||
dps " EBX: "
|
||||
dpd ebx
|
||||
newline
|
||||
dps "ECX: "
|
||||
dpd ecx
|
||||
dps " EDX: "
|
||||
dpd edx
|
||||
newline
|
||||
}
|
||||
|
||||
macro debug_print_hex arg
|
||||
{
|
||||
pushf
|
||||
pushad
|
||||
if ~arg eq eax
|
||||
mov eax, arg
|
||||
end if
|
||||
call debug_outhex
|
||||
popad
|
||||
popf
|
||||
}
|
||||
dph fix debug_print_hex
|
||||
|
||||
debug_outhex:
|
||||
; eax - number
|
||||
mov edx, 8
|
||||
.new_char:
|
||||
rol eax, 4
|
||||
movzx ecx, al
|
||||
and cl, 0x0f
|
||||
mov cl, [__hexdigits + ecx]
|
||||
pushad
|
||||
mcall 63, 1
|
||||
popad
|
||||
dec edx
|
||||
jnz .new_char
|
||||
ret
|
||||
|
||||
__hexdigits:
|
||||
db '0123456789ABCDEF'
|
595
programs/develop/libGUI/src/draw.inc
Normal file
595
programs/develop/libGUI/src/draw.inc
Normal file
@ -0,0 +1,595 @@
|
||||
|
||||
DrawLine:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Line.x1]
|
||||
mov ecx,[Line.y1]
|
||||
mov edx,[Line.color]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[Line.x2]
|
||||
add ecx,[Line.y2]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
DrawPixel:
|
||||
|
||||
xor eax,eax
|
||||
inc al
|
||||
mov ebx,[Pixel.x]
|
||||
mov ecx,[Pixel.y]
|
||||
mov edx,[Pixel.color]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
RectangleContour:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ebx,[Rectangle.width]
|
||||
mcall
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
add ecx,[Rectangle.height]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ebx,[Rectangle.width]
|
||||
mcall
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ecx,[Rectangle.height]
|
||||
mcall
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
add ebx,[Rectangle.width]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ecx,[Rectangle.height]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;OUT
|
||||
;eax - averege color
|
||||
calculate_average_color:
|
||||
|
||||
and eax,0xffffff
|
||||
and ebx,0xffffff
|
||||
|
||||
mov [b_min],al
|
||||
mov [b_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [g_min],al
|
||||
mov [g_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [r_min],al
|
||||
mov [r_max],bl
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov al,[r_max]
|
||||
mov bl,[r_min]
|
||||
add eax,ebx
|
||||
shr eax,1
|
||||
mov [r],al
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov al,[g_max]
|
||||
mov bl,[g_min]
|
||||
add eax,ebx
|
||||
shr eax,1
|
||||
mov [g],al
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov al,[b_max]
|
||||
mov bl,[b_min]
|
||||
add eax,ebx
|
||||
shr eax,1
|
||||
mov [b],al
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r]
|
||||
shl eax,8
|
||||
mov al,[g]
|
||||
shl eax,8
|
||||
mov al,[b]
|
||||
|
||||
ret
|
||||
|
||||
;eax -color
|
||||
;ebx- sub value
|
||||
;OUT
|
||||
;eax - sabved color
|
||||
calculate_sabved_color:
|
||||
|
||||
and eax,0xffffff
|
||||
|
||||
mov [b],al
|
||||
shr eax,8
|
||||
mov [g],al
|
||||
shr eax,8
|
||||
mov [r],al
|
||||
|
||||
sub [r],bl
|
||||
sub [g],bl
|
||||
sub [b],bl
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r]
|
||||
shl eax,8
|
||||
mov al,[g]
|
||||
shl eax,8
|
||||
mov al,[b]
|
||||
|
||||
ret
|
||||
|
||||
DrawString:
|
||||
|
||||
mov ebx,[Button.text]
|
||||
call GetLengthString
|
||||
mov esi,eax
|
||||
|
||||
mov eax,4
|
||||
mov ebx,[Font.x]
|
||||
shl ebx,16
|
||||
add ebx,[Font.y]
|
||||
mov ecx,[Button.textcolor]
|
||||
mov edx,[Button.text]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_right:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,esi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
add ecx,[line_size_y]
|
||||
|
||||
mov eax,[line_size_x]
|
||||
add [line_coordinat_x],eax
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_x]
|
||||
|
||||
next_vertical_line_draw_right:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
sub [line_coordinat_x],1
|
||||
|
||||
dec edi
|
||||
jnz next_vertical_line_draw_right
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_left:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,esi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
add ecx,[line_size_y]
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_x]
|
||||
|
||||
next_vertical_line_draw_left:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
add [line_coordinat_x],1
|
||||
|
||||
dec edi
|
||||
jnz next_vertical_line_draw_left
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_up:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,edi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
add ebx,[line_size_x]
|
||||
|
||||
mov eax,[line_size_y]
|
||||
add [line_coordinat_y],eax
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_y]
|
||||
|
||||
next_horizontal_line_draw_up:
|
||||
|
||||
mov eax,38
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
sub [line_coordinat_y],1
|
||||
|
||||
dec edi
|
||||
jnz next_horizontal_line_draw_up
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_down:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,edi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
add ebx,[line_size_x]
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_y]
|
||||
|
||||
next_horizontal_line_draw_down:
|
||||
|
||||
mov eax,38
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
add [line_coordinat_y],1
|
||||
|
||||
dec edi
|
||||
jnz next_horizontal_line_draw_down
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- length of line
|
||||
;edx- pointer to memory for colors of gradient
|
||||
|
||||
gradient:
|
||||
|
||||
mov [length],ecx
|
||||
|
||||
and eax,0xffffff
|
||||
and eax,0xffffff
|
||||
|
||||
mov [b_min],al
|
||||
mov [b_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [g_min],al
|
||||
mov [g_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [r_min],al
|
||||
mov [r_max],bl
|
||||
|
||||
mov eax,[length]
|
||||
dec eax
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r_max]
|
||||
sub al,[r_min]
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fdiv st0,st1
|
||||
fstp [step_r]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[g_max]
|
||||
sub al,[g_min]
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fdiv st0,st1
|
||||
fstp [step_g]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[b_max]
|
||||
sub al,[b_min]
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fdiv st0,st1
|
||||
fstp [step_b]
|
||||
|
||||
fstp [v]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r_min]
|
||||
mov [r],al
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fstp [r_f]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[g_min]
|
||||
mov [g],al
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fstp [g_f]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[b_min]
|
||||
mov [b],al
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fstp [b_f]
|
||||
|
||||
next_gradient_color_save:
|
||||
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
mov al,[r]
|
||||
mov bl,al
|
||||
shl eax,8
|
||||
mov al,[g]
|
||||
shl eax,8
|
||||
mov al,[b]
|
||||
|
||||
mov [edx],ax
|
||||
mov [edx+2],bl
|
||||
|
||||
fld [step_r]
|
||||
fld [r_f]
|
||||
fadd st0,st1
|
||||
fst [r_f]
|
||||
fistp [v]
|
||||
xor eax,eax
|
||||
mov eax,[v]
|
||||
mov [r],al
|
||||
fstp [v]
|
||||
|
||||
fld [step_g]
|
||||
fld [g_f]
|
||||
fadd st0,st1
|
||||
fst [g_f]
|
||||
fistp [v]
|
||||
xor eax,eax
|
||||
mov eax,[v]
|
||||
mov [g],al
|
||||
fstp [v]
|
||||
|
||||
fld [step_b]
|
||||
fld [b_f]
|
||||
fadd st0,st1
|
||||
fst [b_f]
|
||||
fistp [v]
|
||||
xor eax,eax
|
||||
mov eax,[v]
|
||||
mov [b],al
|
||||
fstp [v]
|
||||
|
||||
add edx,3
|
||||
|
||||
dec ecx
|
||||
jnz next_gradient_color_save
|
||||
|
||||
ret
|
||||
|
||||
;IN
|
||||
;NON
|
||||
;OUT
|
||||
;variable [skin_height]
|
||||
|
||||
get_skin_height:
|
||||
|
||||
pushad
|
||||
|
||||
mov eax,48
|
||||
mov ebx,4
|
||||
int 0x40
|
||||
|
||||
mov [skin_height],eax
|
||||
popad
|
||||
|
||||
ret
|
||||
;eax - x
|
||||
;ebx - y
|
||||
;ecx - size x
|
||||
;edx - size y
|
||||
;esi - pointer to memory for rectangle
|
||||
SaveFonForRectangle:
|
||||
|
||||
mov [Rectangle.x],eax
|
||||
mov [Rectangle.y],ebx
|
||||
mov [Rectangle.width],ecx
|
||||
mov [Rectangle.height],edx
|
||||
mov [PointerToMem],esi
|
||||
|
||||
;get bytes per string
|
||||
mov eax,61
|
||||
mov ebx,2
|
||||
mcall
|
||||
mov [BitsPerPixel],eax
|
||||
|
||||
mov eax,61
|
||||
mov ebx,3
|
||||
mcall
|
||||
mov [BytesPerString],eax
|
||||
|
||||
|
||||
;get window coordinats
|
||||
mov eax,9
|
||||
mov ebx,dword IPC_table
|
||||
or ecx,-1
|
||||
mcall
|
||||
|
||||
mov eax,dword[IPC_table+34]
|
||||
mov ebx,dword[IPC_table+38]
|
||||
;mov ecx,dword[IPC_table+42]
|
||||
;mov edx,dword[IPC_table+46]
|
||||
;mov [WindowCoordinatX],eax
|
||||
;mov [WindowCoordinatY],ebx
|
||||
;mov [WindowSizeX],ecx
|
||||
;mov [WindowSizeY],edx
|
||||
|
||||
add eax,[Rectangle.x]
|
||||
add ebx,[Rectangle.y]
|
||||
|
||||
imul ebx,[BytesPerString]
|
||||
mov esi,[Rectangle.width]
|
||||
|
||||
cmp [BitsPerPixel],24
|
||||
jne no_24
|
||||
|
||||
lea eax,[eax+eax*2]
|
||||
lea esi,[esi+esi*2]
|
||||
mov edi,3
|
||||
jmp exit_bits_per_pixel
|
||||
no_24:
|
||||
|
||||
shl eax,2
|
||||
shl esi,2
|
||||
mov edi,4
|
||||
exit_bits_per_pixel:
|
||||
|
||||
add eax,ebx
|
||||
|
||||
mov ebx,[BytesPerString]
|
||||
sub ebx,esi
|
||||
mov [offset],ebx
|
||||
|
||||
mov esi,[PointerToMem]
|
||||
mov edx,[Rectangle.height]
|
||||
next_string_pixels_save:
|
||||
|
||||
mov ecx,[Rectangle.width]
|
||||
next_pixel_save:
|
||||
|
||||
mov ebx,[gs:eax]
|
||||
and ebx,0xffffff
|
||||
mov [esi],bx
|
||||
shr ebx,16
|
||||
mov [esi+2],bl
|
||||
|
||||
add esi,3
|
||||
add eax,edi
|
||||
dec ecx
|
||||
jnz next_pixel_save
|
||||
|
||||
add eax,[offset]
|
||||
dec edx
|
||||
jnz next_string_pixels_save
|
||||
|
||||
exit_:
|
||||
ret
|
249
programs/develop/libGUI/src/edit_box.inc
Normal file
249
programs/develop/libGUI/src/edit_box.inc
Normal file
@ -0,0 +1,249 @@
|
||||
|
||||
eb_control_data_size = 82
|
||||
|
||||
;****************************************************
|
||||
;******************craete EditBox*********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to EditBox's structure
|
||||
;OUT
|
||||
;pointer to initialized control
|
||||
align 4
|
||||
|
||||
craete_edit_box:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForEditBox],eax
|
||||
|
||||
mov eax,control_header_size+eb_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all EditBox's parameters in control
|
||||
mov [eax],dword edit_box
|
||||
|
||||
mov ecx,eb_control_data_size
|
||||
mov esi,[PointerToStructureForEditBox]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForEditBox]
|
||||
mov ecx,[ebx+4] ;x
|
||||
mov edx,[ebx+8] ;y
|
||||
mov esi,[ebx] ;size x
|
||||
mov edi,[ebx+70] ;size y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],edi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;******************Draw EditBox**********************
|
||||
;****************************************************
|
||||
;include 'editbox_mac.inc'
|
||||
;IN
|
||||
;pointer to control of EditBox
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
include 'editbox_mac.inc'
|
||||
|
||||
edit_box:
|
||||
;;;;;;;;;;;;
|
||||
;Structure from libGui á®æ¨ æ¨ï áâàãªâãà
|
||||
;;;;;;;;;;;;
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of button
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForEditBox],esi
|
||||
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword EditBox
|
||||
mov ecx,eb_control_data_size
|
||||
rep movsb
|
||||
|
||||
;;;;;;;;;;;;
|
||||
;Structure from libGui á®æ¨ æ¨ï áâàãªâãà
|
||||
;;;;;;;;;;;;
|
||||
srt_ed_libgui
|
||||
|
||||
push eax
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForEditBox]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size x
|
||||
mov esi,[eax+36] ;size y
|
||||
;set current coordinats and sizes in EeditBox
|
||||
mov [EditBox.ed_left],ebx
|
||||
mov [EditBox.ed_top],ecx
|
||||
mov [EditBox.ed_width],edx
|
||||
mov [EditBox.ed_height],esi
|
||||
pop eax
|
||||
|
||||
;events of redraw all EditBox
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne .no_redraw_all_edit_box
|
||||
|
||||
|
||||
call .draw_border
|
||||
.draw_bg_cursor_text:
|
||||
|
||||
call .check_offset
|
||||
|
||||
call .draw_bg
|
||||
|
||||
call .draw_shift
|
||||
.draw_cursor_text:
|
||||
|
||||
test word[EditBox.ed_flags],ed_focus
|
||||
je @f
|
||||
call .draw_cursor
|
||||
@@:
|
||||
call .draw_text
|
||||
|
||||
jmp .editbox_exit;exit_edit_box
|
||||
.no_redraw_all_edit_box:
|
||||
|
||||
|
||||
;events of keys for EditBox
|
||||
|
||||
cmp [eax],dword 2
|
||||
jne .no_keys_edit_box
|
||||
|
||||
mov ebx,[eax+4]
|
||||
shl ebx,8
|
||||
mov eax,ebx
|
||||
|
||||
test word [EditBox.ed_flags],ed_focus
|
||||
je .editbox_exit;exit_edit_box;@b
|
||||
|
||||
call .check_shift
|
||||
|
||||
;----------------------------------------------------------
|
||||
;--- ¯à®¢¥à塞, çâ® ¦ â® --------------------------------
|
||||
;----------------------------------------------------------
|
||||
|
||||
use_key_process backspase,delete,left,right,home,end,insert
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;‡ £«ãèª ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢¨§ â.¥. ¯à¨
|
||||
;®¡ à㦥¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
srt_ed_libgui
|
||||
use_key_no_process up,down,esc
|
||||
|
||||
;--- ¦ â ¤àã£ ï ª« ¢¨è ---
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD>஢¥àª ãáâ ®¢«¥ «¨ ä« £ ¯à¨ ª®â®à®¬ 㦮 ¢ë¢®¤¨âì
|
||||
;⮫쪮 æ¨äàë ¢ 㦮¬ ¡®ªá¥ ¥á«¨ â ª®© ¥®¡å®¤¨¬®á⨠¥â
|
||||
;㦮 § ª®¬¥â¨à®¢ âì ¬ ªà®á
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_key_figures_only
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;¯à®¢¥àª shift ¡ë« «¨ ¦ â
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
are_key_shift_press
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ¯à®¢¥à塞, 室¨âáï «¨ ªãàá®à ¢ ª®æ¥ + ¤ «ì¥©è ï ®¡à ¡®âª
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
are_key_cur_end
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡à ¡®âª ª« ¢¨è insert,delete.backspase,home,end,left,right
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_work_key
|
||||
|
||||
|
||||
.no_keys_edit_box:
|
||||
|
||||
;events of mouse for EditBox
|
||||
|
||||
cmp [eax],dword 6
|
||||
jne .editbox_exit
|
||||
|
||||
mov esi,[eax+4]
|
||||
mov edi,[eax+8]
|
||||
mov ecx,[eax+12]
|
||||
mov [EditBox.mouseX],esi
|
||||
mov [EditBox.mouseY],edi
|
||||
mov [ButtonsOfMouse],ecx
|
||||
|
||||
mov eax,ecx
|
||||
|
||||
test eax,1
|
||||
jnz .mouse_left_button
|
||||
and word [EditBox.ed_flags],ed_mouse_on_off
|
||||
jmp .editbox_exit
|
||||
|
||||
.mouse_left_button:
|
||||
|
||||
mov eax,[EditBox.mouseX]
|
||||
shl eax,16
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;”ãªæ¨ï ®¡à ¡®âª¨ ¬ë誨 ¯®«ã票¥ ª®®à¤¨ â ¨ ¯à®¢¥àª ¨å + ¢ë¤¥«¥¨ï
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_work_mouse ;scr_h,scr_w
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡é¨¥ äãªæ¨¨ ®¡à ¡®âª¨
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_general_func
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;”ãªæ¨¨ ¤«ï à ¡®âë á key
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_key_func
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;”ãªæ¨¨ ¤«ï à ¡®âë á mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_mouse_func ;scr_w
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å äãªæ¨© ¨ ¯®áâ ®¡à ¡®â稪®¢
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
.editbox_exit:
|
||||
|
||||
exit_edit_box:
|
||||
|
||||
;save resulatat of work in control
|
||||
mov esi,dword EditBox
|
||||
mov edi,[PointerForEditBox]
|
||||
add edi,control_header_size
|
||||
mov ecx,eb_control_data_size
|
||||
rep movsb
|
||||
|
||||
ret 8
|
||||
|
1143
programs/develop/libGUI/src/editbox_mac.inc
Normal file
1143
programs/develop/libGUI/src/editbox_mac.inc
Normal file
File diff suppressed because it is too large
Load Diff
140
programs/develop/libGUI/src/image.inc
Normal file
140
programs/develop/libGUI/src/image.inc
Normal file
@ -0,0 +1,140 @@
|
||||
|
||||
im_control_data_size = 26
|
||||
im_redraw_all = 10000000b
|
||||
im_redraw_all_off = 01111111b
|
||||
im_special_redraw_on = 1b
|
||||
im_special_redraw_off = 11111110b
|
||||
|
||||
;****************************************************
|
||||
;*******************craete Image**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to Image's structure
|
||||
;OUT
|
||||
;pointer to initialized Image's structure
|
||||
align 4
|
||||
|
||||
craete_image:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForImage],eax
|
||||
|
||||
mov eax,control_header_size+im_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all image's parameters in control
|
||||
mov [eax],dword image
|
||||
|
||||
mov ecx,im_control_data_size
|
||||
mov esi,[PointerToStructureForImage]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForImage]
|
||||
mov ecx,[ebx+6] ;x
|
||||
mov edx,[ebx+10] ;y
|
||||
mov esi,[ebx+14] ;size x
|
||||
mov edi,[ebx+18] ;size y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],edi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;********************Draw Image**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of button
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
image:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of image
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForImage],esi
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword Image
|
||||
mov ecx,im_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_image
|
||||
|
||||
or [Image.type],im_redraw_all
|
||||
no_redraw_all_image:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_image
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Image.type]
|
||||
and al,im_special_redraw_on
|
||||
test al,al
|
||||
jz no_activate_redraw_image
|
||||
|
||||
and [Image.type],im_special_redraw_off
|
||||
or [Image.type],im_redraw_all
|
||||
no_activate_redraw_image:
|
||||
|
||||
no_special_message_image:
|
||||
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForImage]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size x
|
||||
mov esi,[eax+36] ;size y
|
||||
;set current coordinats and sizes in zakladka
|
||||
mov [Image.x],ebx
|
||||
mov [Image.y],ecx
|
||||
mov [Image.sizex],edx
|
||||
mov [Image.sizey],esi
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Image.type]
|
||||
and al,im_redraw_all
|
||||
test al,al
|
||||
jz no_redraw_image_
|
||||
|
||||
and [Image.type],im_redraw_all_off
|
||||
|
||||
mov esi,dword Image
|
||||
mov edi,[PointerForImage]
|
||||
add edi,control_header_size
|
||||
mov ecx,2
|
||||
rep movsb
|
||||
|
||||
mov eax,7
|
||||
mov ebx,[Image.pointer]
|
||||
mov ecx,[Image.sizex]
|
||||
shl ecx,16
|
||||
add ecx,[Image.sizey]
|
||||
mov edx,[Image.x]
|
||||
shl edx,16
|
||||
add edx,[Image.y]
|
||||
mcall
|
||||
|
||||
no_redraw_image_:
|
||||
|
||||
exit_image:
|
||||
|
||||
ret 8
|
537
programs/develop/libGUI/src/libGUI.asm
Normal file
537
programs/develop/libGUI/src/libGUI.asm
Normal file
@ -0,0 +1,537 @@
|
||||
;**********************************************************************
|
||||
; library of Graphics Universal Interface for Kolibri operation system
|
||||
;
|
||||
; version 071001
|
||||
; 2007 year
|
||||
;
|
||||
;autors:
|
||||
;
|
||||
;andrew_programmer polynki@mail.ru
|
||||
;
|
||||
;menegement of controls : destroy_control, send_message
|
||||
;GUI components : button,scroller,Bookmark,text,image,number,progres bar
|
||||
;
|
||||
;<Lrz> and Maxxxx32
|
||||
;
|
||||
;GUI components : CheckBox,EditBox
|
||||
;
|
||||
;**********************************************************************
|
||||
|
||||
format MS COFF
|
||||
|
||||
public EXPORTS
|
||||
|
||||
control_header_size = 44
|
||||
|
||||
border_width = 5
|
||||
|
||||
section '.flat' code readable align 16
|
||||
|
||||
include 'macros.inc'
|
||||
include 'debug.inc'
|
||||
|
||||
;GUI components
|
||||
|
||||
include 'button.inc'
|
||||
|
||||
include 'scroller.inc'
|
||||
|
||||
include 'bookmark.inc'
|
||||
|
||||
include 'image.inc'
|
||||
|
||||
include 'text.inc'
|
||||
|
||||
include 'number.inc'
|
||||
|
||||
include 'check_box.inc'
|
||||
|
||||
include 'edit_box.inc'
|
||||
|
||||
include 'progress_bar.inc'
|
||||
|
||||
;engen of libGUI(menegment of controls)
|
||||
|
||||
include 'menegment_of_controls.inc'
|
||||
|
||||
;functions which proved work of GUI components
|
||||
|
||||
include 'draw.inc'
|
||||
|
||||
include 'string.inc'
|
||||
|
||||
include 'check_crossing_box.inc'
|
||||
|
||||
include 'memory.inc'
|
||||
|
||||
;function for get version of library
|
||||
include 'version.inc'
|
||||
|
||||
;function for resize GUI component
|
||||
include 'resize_component.inc'
|
||||
|
||||
;function for remove GUI component
|
||||
include 'remove_component.inc'
|
||||
|
||||
align 16
|
||||
EXPORTS:
|
||||
dd szDestroyControl,destroy_control
|
||||
dd szSendMessage,send_message
|
||||
dd szVersion,get_version
|
||||
dd szResizeComponent,resize_component
|
||||
dd szRemoveComponent,remove_component
|
||||
dd szcraeteButton,craete_button
|
||||
dd szcraeteScroller,craete_scroller
|
||||
dd szcraeteBookmark,craete_Bookmark
|
||||
dd szcraeteImage,craete_image
|
||||
dd szcraeteText,craete_text
|
||||
dd szcraeteNumber,craete_number
|
||||
dd szcraeteCheckBox,craete_check_box
|
||||
dd szcraeteEditBox,craete_edit_box
|
||||
dd szcraeteProgressBar,craete_progress_bar
|
||||
dd 0,0
|
||||
|
||||
szDestroyControl db 'DestroyControl',0
|
||||
szSendMessage db 'SendMessage',0
|
||||
szVersion db 'Version',0
|
||||
szResizeComponent db 'ResizeComponent',0
|
||||
szRemoveComponent db 'RemoveComponent',0
|
||||
szcraeteButton db 'CraeteButton',0
|
||||
szcraeteScroller db 'CraeteScroller',0
|
||||
szcraeteBookmark db 'CraeteBookmark',0
|
||||
szcraeteImage db 'CraeteImage',0
|
||||
szcraeteText db 'CraeteText',0
|
||||
szcraeteNumber db 'CraeteNumber',0
|
||||
szcraeteCheckBox db 'CraeteCheckbox',0
|
||||
szcraeteEditBox db 'CraeteEditbox',0
|
||||
szcraeteProgressBar db 'CraeteProgressbar',0
|
||||
|
||||
section '.data' data readable writable align 16
|
||||
;************************************************
|
||||
;******************DLL DATA**********************
|
||||
;************************************************
|
||||
|
||||
point db '.',0
|
||||
signum db '-',0
|
||||
|
||||
BitsPerPixel rd 1
|
||||
BytesPerString rd 1
|
||||
WindowCoordinatX rd 1
|
||||
WindowCoordinatY rd 1
|
||||
WindowSizeX rd 1
|
||||
WindowSizeY rd 1
|
||||
|
||||
PointerToMem rd 1
|
||||
offset rd 1
|
||||
|
||||
v rd 1
|
||||
v2 rd 1
|
||||
v3 rd 1
|
||||
|
||||
r_min rb 1
|
||||
r_max rb 1
|
||||
g_min rb 1
|
||||
g_max rb 1
|
||||
b_min rb 1
|
||||
b_max rb 1
|
||||
r rb 1
|
||||
g rb 1
|
||||
b rb 1
|
||||
r_f rd 1
|
||||
g_f rd 1
|
||||
b_f rd 1
|
||||
step_r rd 1
|
||||
step_g rd 1
|
||||
step_b rd 1
|
||||
length rd 1
|
||||
length2 rd 1
|
||||
Color rd 1
|
||||
AveregeColor rd 1
|
||||
|
||||
line_coordinat_x rd 1
|
||||
line_coordinat_y rd 1
|
||||
line_size_x rd 1
|
||||
line_size_y rd 1
|
||||
line_size_y_f rd 1
|
||||
|
||||
x rd 1
|
||||
y rd 1
|
||||
xo rd 1
|
||||
yo rd 1
|
||||
x_ctl rd 1
|
||||
y_ctl rd 1
|
||||
|
||||
;ReturnAddresButton rd 1
|
||||
;ReturnAddresScroller rd 1
|
||||
;ReturnAddresBookmark rd 1
|
||||
;ReturnAddresImage rd 1
|
||||
;ReturnAddresText rd 1
|
||||
;ReturnAddresNumber rd 1
|
||||
;ReturnAddresCheckBox rd 1
|
||||
;ReturnAddresEditBox rd 1
|
||||
;ReturnAddresProgressBar rd 1
|
||||
|
||||
Button_Flag rb 1
|
||||
|
||||
Scrollersize rd 1
|
||||
ControlID rd 1
|
||||
Message rd 4
|
||||
Parend rd 1
|
||||
Control rd 1
|
||||
ReturnControl rd 1
|
||||
PointerToControl rd 1
|
||||
ActiveControl rd 1
|
||||
ActiveControlForKeys rd 1
|
||||
ButtonsOfMouse rd 1
|
||||
|
||||
PointerToStructureForBookmark rd 1
|
||||
ParendForBookmark rd 1
|
||||
PointerToStructureForButton rd 1
|
||||
ParendForButton rd 1
|
||||
PointerToStructureForScroller rd 1
|
||||
ParendForScroller rd 1
|
||||
PointerToStructureForImage rd 1
|
||||
PointerToStructureForText rd 1
|
||||
PointerToStructureForNumber rd 1
|
||||
PointerToStructureForCheckBox rd 1
|
||||
PointerToStructureForEditBox rd 1
|
||||
PointerToStructureForProgressBar rd 1
|
||||
|
||||
PointerForButton rd 1
|
||||
PointerForScroller rd 1
|
||||
PointerForBookmark rd 1
|
||||
PointerForImage rd 1
|
||||
PointerForText rd 1
|
||||
PointerForNumber rd 1
|
||||
PointerForCheckBox rd 1
|
||||
PointerForEditBox rd 1
|
||||
PointerForProgressBar rd 1
|
||||
|
||||
ChisloZakladok rd 1
|
||||
|
||||
integer_part rd 1
|
||||
float_part rd 1
|
||||
tochnost1 rd 1
|
||||
tochnost2 rd 1
|
||||
signum_float_number rb 1
|
||||
|
||||
skin_height rd 1
|
||||
|
||||
;*********************************
|
||||
;**********GUI structures*********
|
||||
;*********************************
|
||||
|
||||
;struc CONTROL
|
||||
;{
|
||||
; .ctrl_proc rd 0 ;0
|
||||
; .ctrl_fd rd 0 ;4
|
||||
; .ctrl_bk rd 0 ;8
|
||||
; .child_fd rd 0 ;12
|
||||
; .child_bk rd 0 ;16
|
||||
; .parend rd 0 ;20
|
||||
; .x rd 0 ;24
|
||||
; .y rd 0 ;28
|
||||
; .sizex rd 0 ;32
|
||||
; .sizey rd 0 ;36
|
||||
; .ID rd 0 ;40
|
||||
;}
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.ctrl_proc rd 1
|
||||
.ctrl_fd rd 1
|
||||
.ctrl_bk rd 1
|
||||
.child_fd rd 1
|
||||
.child_bk rd 1
|
||||
.parend rd 1
|
||||
.ctrl_x rd 1
|
||||
.ctrl_y rd 1
|
||||
.ctrl_sizex rd 1
|
||||
.ctrl_sizey rd 1
|
||||
.ctrl_ID rd 1
|
||||
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.width rw 1
|
||||
.height rw 1
|
||||
.image rd 1
|
||||
.imageX rw 1
|
||||
.imageY rw 1
|
||||
.imageSizeX rw 1
|
||||
.imageSizeY rw 1
|
||||
.transparentColor rd 1
|
||||
.text rd 1
|
||||
.textX rw 1
|
||||
.textY rw 1
|
||||
.textcolor rd 1
|
||||
.color1 rd 1
|
||||
.color2 rd 1
|
||||
.mouseX rw 1
|
||||
.mouseY rw 1
|
||||
}
|
||||
|
||||
struc SCROLLER
|
||||
{
|
||||
.ctrl_proc rd 1
|
||||
.ctrl_fd rd 1
|
||||
.ctrl_bk rd 1
|
||||
.child_fd rd 1
|
||||
.child_bk rd 1
|
||||
.parend rd 1
|
||||
.ctrl_x rd 1
|
||||
.ctrl_y rd 1
|
||||
.ctrl_sizex rd 1
|
||||
.ctrl_sizey rd 1
|
||||
.ctrl_ID rd 1
|
||||
|
||||
.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
|
||||
}
|
||||
|
||||
;********************************
|
||||
;*********Child Buttons**********
|
||||
;********************************
|
||||
struc CHILDBUTTON
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.width rw 1
|
||||
.height rw 1
|
||||
.image rd 1
|
||||
.imageX rw 1
|
||||
.imageY rw 1
|
||||
.imageSizeX rw 1
|
||||
.imageSizeY rw 1
|
||||
.transparentColor rd 1
|
||||
.text rd 1
|
||||
.textX rw 1
|
||||
.textY rw 1
|
||||
.textcolor rd 1
|
||||
.color1 rd 1
|
||||
.color2 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
|
||||
.color1 rd 1
|
||||
.reserved rd 1
|
||||
.color2 rd 1
|
||||
|
||||
.FullBookmarkSizeX rd 1
|
||||
.BookmarkSizeX rd 1
|
||||
.PointerToTextForBookmark rd 1
|
||||
.BookmarkX rd 1
|
||||
.BookmarkY rd 1
|
||||
.ChildButtonsForBookmark rd 1
|
||||
.CounterChildButtons rd 1
|
||||
.ChisloZakladok rd 1
|
||||
.ChisloStrokeZakladok rd 1
|
||||
.MessageForChildButton rd 5
|
||||
.ChildControlForBookmark rd 1
|
||||
.NumberBookmarksInActiveString rd 1
|
||||
.NumberBookmarksInEndString rd 1
|
||||
.PointerToActiveBookmarks rd 1
|
||||
.PointerToEndBookmarks rd 1
|
||||
.BookmarkFlag rb 1
|
||||
.y_end_stroke rd 1
|
||||
|
||||
.CounterChildControls rd 1
|
||||
.ActiveChildControl rd 1
|
||||
.AddresOfActiveChildControl rd 1
|
||||
.MouseX rd 1
|
||||
.MouseY rd 1
|
||||
|
||||
.DefectSizeX rd 1
|
||||
.ControlAddres rd 1
|
||||
|
||||
.counter1 rd 1
|
||||
.counter2 rd 1
|
||||
|
||||
.NumberActiveControl rd 1
|
||||
|
||||
.WorkPlace_x rd 1
|
||||
.WorkPlace_y rd 1
|
||||
.WorkPlace_sizex rd 1
|
||||
.WorkPlace_sizey rd 1
|
||||
.WorkPlace_windowx rd 1
|
||||
.WorkPlace_windowsizex 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
|
||||
.progress rd 1
|
||||
.color3 rd 1
|
||||
}
|
||||
|
||||
;********************************
|
||||
;*Graphics primitives structures*
|
||||
;********************************
|
||||
struc LINE
|
||||
{
|
||||
.x1 rd 1
|
||||
.y1 rd 1
|
||||
.x2 rd 1
|
||||
.y2 rd 1
|
||||
.color rd 1
|
||||
}
|
||||
|
||||
struc PIXEL
|
||||
{
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.color rd 1
|
||||
}
|
||||
|
||||
struc FONT1
|
||||
{
|
||||
.sizeX rd 6
|
||||
.sizeY rd 9
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
}
|
||||
|
||||
struc RECTANGLE
|
||||
{
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.width rd 1
|
||||
.height rd 1
|
||||
.color rd 1
|
||||
}
|
||||
|
||||
struc SCROLLBAR
|
||||
{
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
}
|
||||
|
||||
Line LINE
|
||||
Pixel PIXEL
|
||||
Font FONT1
|
||||
Rectangle RECTANGLE
|
||||
ScrollBar SCROLLBAR
|
||||
ChildButton CHILDBUTTON
|
||||
|
||||
Button BUTTON
|
||||
Scroller SCROLLER
|
||||
Bookmark BOOKMARK
|
||||
Image IMAGE
|
||||
Text TEXT
|
||||
Number NUMBER
|
||||
CheckBox CHECKBOX
|
||||
EditBox EDITBOX
|
||||
ProgressBar PROGRESSBAR
|
||||
|
||||
pointer rd 50
|
||||
pointer2 rd 13
|
||||
IPC_table process_information; rb 1024
|
||||
colors_table1 rd 15
|
||||
colors_table2 rd 15
|
269
programs/develop/libGUI/src/macros.inc
Normal file
269
programs/develop/libGUI/src/macros.inc
Normal file
@ -0,0 +1,269 @@
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if used name
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if (used name)&(lang eq lng)
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro struct name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
}
|
||||
|
||||
; structures used in MeOS
|
||||
struc process_information
|
||||
{
|
||||
.cpu_usage dd ? ; +0
|
||||
.window_stack_position dw ? ; +4
|
||||
.window_stack_value dw ? ; +6
|
||||
.not_used1 dw ? ; +8
|
||||
.process_name rb 12 ; +10
|
||||
.memory_start dd ? ; +22
|
||||
.used_memory dd ? ; +26
|
||||
.PID dd ? ; +30
|
||||
.x_start dd ? ; +34
|
||||
.y_start dd ? ; +38
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.grab_button dd ?
|
||||
.grab_button_text dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
.work_button_text dd ?
|
||||
.work_text dd ?
|
||||
.work_graph dd ?
|
||||
}
|
||||
struct system_colors
|
||||
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
32
programs/develop/libGUI/src/memory.inc
Normal file
32
programs/develop/libGUI/src/memory.inc
Normal file
@ -0,0 +1,32 @@
|
||||
;eax - size
|
||||
;OUT
|
||||
;eax - pointer
|
||||
malloc:
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,68
|
||||
mov ebx,12
|
||||
mcall
|
||||
|
||||
pop ecx
|
||||
pop ebx
|
||||
|
||||
ret
|
||||
|
||||
;eax - pointer
|
||||
free:
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,68
|
||||
mov ebx,13
|
||||
mcall
|
||||
|
||||
pop ecx
|
||||
pop ebx
|
||||
|
||||
ret
|
503
programs/develop/libGUI/src/menegment_of_controls.inc
Normal file
503
programs/develop/libGUI/src/menegment_of_controls.inc
Normal file
@ -0,0 +1,503 @@
|
||||
;****************************************************************
|
||||
;***************Elements of menegment for Controls***************
|
||||
;****************************************************************
|
||||
|
||||
;**********************************************************
|
||||
;********************craete control*************************
|
||||
;**********************************************************
|
||||
|
||||
;IN
|
||||
;eax - ctructure's size
|
||||
;ebx - Parend(pointer to structure for parend)
|
||||
;OUT
|
||||
;eax - pointer to new control
|
||||
|
||||
craete_control:
|
||||
|
||||
test eax,eax
|
||||
jnz no_null_size
|
||||
|
||||
mov eax,1
|
||||
no_null_size:
|
||||
|
||||
call malloc
|
||||
mov [ReturnControl],eax
|
||||
|
||||
push ebx ;parend
|
||||
push eax ;control
|
||||
call AddObject
|
||||
|
||||
mov eax,[ReturnControl]
|
||||
|
||||
;information about craete control output to debug board
|
||||
call new_line
|
||||
mov [s_p],s_craete
|
||||
call print_string
|
||||
debug_print_dec [ReturnControl]
|
||||
mov [s_p],s_parend
|
||||
call print_string
|
||||
debug_print_dec dword[eax+20]
|
||||
mov [s_p],s_last
|
||||
call print_string
|
||||
debug_print_dec dword[eax+4]
|
||||
;--------------------------------
|
||||
|
||||
ret
|
||||
|
||||
AddObject:
|
||||
|
||||
mov ecx,[esp+4] ;control
|
||||
mov edx,[esp+8] ;parend
|
||||
|
||||
mov eax,[edx+12] ;eax=parend->child_fd
|
||||
test eax,eax
|
||||
jnz else_parend_add_object
|
||||
|
||||
add [ControlID],1
|
||||
mov esi,[ControlID]
|
||||
|
||||
mov [edx+12],ecx ;Parend->child_fd=control
|
||||
mov [edx+16],ecx ;Parend->child_bk=control
|
||||
|
||||
mov [ecx+20],edx ;control->parend=Parend
|
||||
mov [ecx+4],edx ;control->ctrl_fd=Parend
|
||||
mov [ecx+40],esi ;control->ctrl_ID=ID
|
||||
|
||||
jmp exit_if_parend_add_object
|
||||
else_parend_add_object:
|
||||
|
||||
add [ControlID],1
|
||||
mov esi,[ControlID]
|
||||
|
||||
mov edi,[edx+16] ;last_control=Parend->child_bk
|
||||
mov [edx+16],ecx ;Parend->child_bk=control
|
||||
|
||||
mov [edi+8],ecx ;last_control->ctrl_bk=control
|
||||
mov [ecx+4],edi ;control->ctrl_fd=last_control;
|
||||
mov [ecx+20],edx ;control->parend=Parend;
|
||||
mov [ecx+40],esi ;control->ctrl_ID=ID
|
||||
|
||||
exit_if_parend_add_object:
|
||||
|
||||
ret 8
|
||||
|
||||
|
||||
;************************************************************
|
||||
;***********************Destroy control**********************
|
||||
;************************************************************
|
||||
|
||||
;Delete Control.
|
||||
;IN
|
||||
;pointer to control for delete
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
destroy_control:
|
||||
|
||||
mov eax,[esp+4]
|
||||
|
||||
mov ebx,[eax+20] ;get parend for control
|
||||
|
||||
;checking pointer of control to 0
|
||||
test eax,eax
|
||||
jz exit_destroy_control
|
||||
|
||||
;checking parend to main parend(parend of window)
|
||||
;if parend equ main parend than exit
|
||||
test ebx,ebx
|
||||
jz exit_destroy_control
|
||||
|
||||
mov ecx,[ebx+12] ;Parend->child_fd
|
||||
test ecx,ecx
|
||||
jz exit_destroy_control
|
||||
|
||||
mov ecx,[ebx+12] ;Parend->child_fd
|
||||
mov edx,[ebx+16] ;Parend->child_bk
|
||||
|
||||
cmp ecx,edx
|
||||
jne no_if_parend_child_fd_child_bk
|
||||
|
||||
cmp ecx,eax
|
||||
jne no_if_parend_child_fd_control
|
||||
|
||||
mov [ebx+12],dword 0 ;Parend->child_fd=0
|
||||
mov [ebx+16],dword 0 ;Parend->child_bk=0
|
||||
|
||||
;send message to control for deleting
|
||||
push eax
|
||||
|
||||
mov [Message],dword -1
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop eax
|
||||
|
||||
push eax
|
||||
call free
|
||||
pop eax
|
||||
|
||||
call new_line
|
||||
mov [s_p],s_destroy
|
||||
call print_string
|
||||
debug_print_dec eax
|
||||
mov [s_p],s_1
|
||||
call print_string
|
||||
|
||||
jmp exit_destroy_control
|
||||
no_if_parend_child_fd_control:
|
||||
|
||||
no_if_parend_child_fd_child_bk:
|
||||
;----------------------------------------------
|
||||
mov esi,ecx ;seek_control=Parend->child_fd
|
||||
|
||||
while_seek_control:
|
||||
cmp esi,0
|
||||
je exit_destroy_control
|
||||
;*******************************************************************
|
||||
cmp esi,eax
|
||||
jne no_if_seek_control_control
|
||||
;***************************************************************
|
||||
mov edi,[esi+8]
|
||||
test edi,edi
|
||||
jz no_if_seek_control_ctrl_bk
|
||||
;***********************************************************
|
||||
mov ecx,[esi+4]
|
||||
mov edx,[esi+8]
|
||||
mov [edx+4],ecx
|
||||
|
||||
cmp ecx,ebx
|
||||
je no_if_last_control_parend
|
||||
;*******************************************************
|
||||
mov [ecx+8],edx
|
||||
jmp else_seek_control_ctrl_bk
|
||||
;*******************************************************
|
||||
no_if_last_control_parend:
|
||||
|
||||
mov [ebx+12],edx
|
||||
|
||||
jmp else_seek_control_ctrl_bk
|
||||
;*********************************************************
|
||||
no_if_seek_control_ctrl_bk:
|
||||
;**********************************************************
|
||||
|
||||
mov ecx,[esi+4] ;last_control=seek_control->ctrl_fd
|
||||
mov [ecx+8],dword 0 ;last_control->ctrl_bk=0
|
||||
mov [ebx+16],ecx ;Parend->child_bk=last_control
|
||||
|
||||
else_seek_control_ctrl_bk:
|
||||
;**********************************************************
|
||||
|
||||
;send message to control for deleting
|
||||
push eax
|
||||
|
||||
mov [Message],dword -1
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop eax
|
||||
|
||||
push eax
|
||||
call free
|
||||
pop eax
|
||||
|
||||
call new_line
|
||||
mov [s_p],s_destroy
|
||||
call print_string
|
||||
debug_print_dec eax
|
||||
mov [s_p],s_2
|
||||
call print_string
|
||||
|
||||
jmp exit_destroy_control
|
||||
|
||||
no_if_seek_control_control:
|
||||
;****************************************************************
|
||||
|
||||
mov edi,[esi+8] ;exchange_control=seek_control->ctrl_bk
|
||||
mov esi,edi ;seek_control=exchange_control
|
||||
|
||||
jmp while_seek_control
|
||||
;*******************************************************************
|
||||
exit_destroy_control:
|
||||
|
||||
ret 4
|
||||
|
||||
;***********************************************************
|
||||
;*****************Send message to Control*******************
|
||||
;***********************************************************
|
||||
|
||||
;IN
|
||||
;pointer to message
|
||||
;pointer to parend(structure)
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
send_message:
|
||||
|
||||
;get pointer to parend
|
||||
mov eax,[esp+4]
|
||||
mov [Parend],eax
|
||||
|
||||
;get message
|
||||
mov esi,[esp+8]
|
||||
mov edi,dword Message
|
||||
mov ecx,4
|
||||
rep movsd
|
||||
|
||||
;load event type
|
||||
mov eax,[Message]
|
||||
|
||||
|
||||
;check for event type and get parameters for Control
|
||||
dec eax
|
||||
jnz no_window_redraw
|
||||
|
||||
mov ebx,[Parend]
|
||||
mov esi,[ebx+12] ;get pointer to first child control of parend
|
||||
mov ebx,esi
|
||||
|
||||
send_message_for_redraw_to_next_control:
|
||||
|
||||
;if esi=0 than exit
|
||||
test esi,esi
|
||||
jz exit_check_event_type
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
|
||||
mov eax,ebx
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
mov esi,[ebx+8]
|
||||
mov ebx,esi
|
||||
|
||||
jmp send_message_for_redraw_to_next_control
|
||||
|
||||
no_window_redraw:
|
||||
|
||||
dec eax
|
||||
jnz no_keys
|
||||
|
||||
|
||||
;if have active control than send message
|
||||
;checking for active control
|
||||
mov ebx,[ActiveControlForKeys]
|
||||
test ebx,ebx
|
||||
jz exit_check_event_type
|
||||
|
||||
mov eax,[ActiveControlForKeys]
|
||||
mov ebx,[eax] ;load proc for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
jmp exit_check_event_type
|
||||
no_keys:
|
||||
|
||||
dec eax
|
||||
jnz no_special_system_message
|
||||
|
||||
mov ebx,[Parend];
|
||||
mov esi,[ebx+12]
|
||||
mov ebx,esi
|
||||
|
||||
send_special_message_to_next_control:
|
||||
|
||||
;if esi=0 than exit
|
||||
test esi,esi
|
||||
jz exit_check_event_type
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
|
||||
mov eax,ebx
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
mov esi,[ebx+8]
|
||||
mov ebx,esi
|
||||
|
||||
jmp send_special_message_to_next_control
|
||||
|
||||
no_special_system_message:
|
||||
|
||||
;*************************************************
|
||||
;****************Mouse send message***************
|
||||
;*************************************************
|
||||
|
||||
cmp eax,3
|
||||
jne no_mouse
|
||||
|
||||
;check childrens of parend for crossing
|
||||
mov ebx,[Parend]
|
||||
mov esi,[ebx+12] ;esi =first child control
|
||||
mov ebx,esi ;ebx =first child control
|
||||
|
||||
mov eax,[Message+12]
|
||||
and eax,1b
|
||||
test eax,eax
|
||||
jz left_button_of_mouse_not_pressed
|
||||
|
||||
mov eax,[ActiveControl]
|
||||
test eax,eax
|
||||
jz havent_active_control
|
||||
|
||||
mov eax,[ActiveControl]
|
||||
mov ebx,[eax] ;load proc for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
jmp exit_check_event_type
|
||||
havent_active_control:
|
||||
|
||||
jmp exit_if_left_button_of_mouse__pressed
|
||||
left_button_of_mouse_not_pressed:
|
||||
|
||||
mov eax,[ActiveControl]
|
||||
test eax,eax
|
||||
jz havent_active_control_
|
||||
|
||||
mov [ActiveControl],dword 0
|
||||
|
||||
havent_active_control_:
|
||||
|
||||
exit_if_left_button_of_mouse__pressed:
|
||||
|
||||
|
||||
next_conrol_check_for_crossing_with_mouse:
|
||||
|
||||
test esi,esi
|
||||
jz exit_next_conrol_check_for_crossing_with_mouse
|
||||
|
||||
mov [PointerToControl],ebx
|
||||
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
|
||||
mov eax,[ebx+28] ;eax = y coordinat of control
|
||||
mov [y_ctl],eax
|
||||
mov eax,[ebx+24] ;eax = x coordinat of control
|
||||
|
||||
mov ecx,[ebx+32] ;ecx = size x of control
|
||||
mov edx,[ebx+36] ;edx = size y of control
|
||||
mov esi,[Message+4] ;mouse x
|
||||
mov edi,[Message+8] ;mouse y
|
||||
mov ebx,[y_ctl]
|
||||
|
||||
call CheckCrossingBox
|
||||
|
||||
cmp eax,0xffffff
|
||||
jne no_activate_control
|
||||
|
||||
mov eax,[Message+12]
|
||||
and eax,1b
|
||||
test eax,eax
|
||||
jz no_activate_control
|
||||
|
||||
mov eax,[PointerToControl]
|
||||
mov [ActiveControl],eax
|
||||
mov [ActiveControlForKeys],eax
|
||||
|
||||
no_activate_control:
|
||||
|
||||
mov eax,[PointerToControl]
|
||||
mov ebx,[eax] ;load proc for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
mov esi,[ebx+8] ;16 but not 8
|
||||
mov ebx,esi
|
||||
|
||||
jmp next_conrol_check_for_crossing_with_mouse
|
||||
|
||||
exit_next_conrol_check_for_crossing_with_mouse:
|
||||
|
||||
no_mouse:
|
||||
|
||||
exit_check_event_type:
|
||||
|
||||
ret 8
|
||||
|
||||
|
||||
new_line:
|
||||
|
||||
pushad
|
||||
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
xor ecx,ecx
|
||||
mov cl,13
|
||||
int 0x40
|
||||
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
xor ecx,ecx
|
||||
mov cl,10
|
||||
int 0x40
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
print_string:
|
||||
|
||||
pushad
|
||||
|
||||
xor esi,esi
|
||||
|
||||
next_symbol_print:
|
||||
|
||||
mov edi,[s_p]
|
||||
add edi,esi
|
||||
|
||||
xor edx,edx
|
||||
mov dl,byte[edi]
|
||||
test dl,dl
|
||||
jz exit_print_str
|
||||
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
xor ecx,ecx
|
||||
mov cl,byte[edi]
|
||||
int 0x40
|
||||
|
||||
inc esi
|
||||
jmp next_symbol_print
|
||||
|
||||
exit_print_str:
|
||||
|
||||
popad
|
||||
|
||||
|
||||
ret
|
||||
|
||||
s_p dd 0
|
||||
s_craete db 'craete ',0
|
||||
s_destroy db 'destroy ',0
|
||||
s_parend db ' parend ',0
|
||||
s_last db ' ctrl_fd ',0
|
||||
s_next db ' ctrl_bk ',0
|
||||
s_1 db ' 1',0
|
||||
s_2 db ' 2',0
|
383
programs/develop/libGUI/src/number.inc
Normal file
383
programs/develop/libGUI/src/number.inc
Normal file
@ -0,0 +1,383 @@
|
||||
|
||||
nm_control_data_size = 22
|
||||
nm_redraw_all = 10000000b
|
||||
nm_redraw_off = 01111111b
|
||||
nm_special_redraw_on = 100b
|
||||
nm_special_redraw_off = 11111011b
|
||||
nm_integer_type = 10b
|
||||
nm_no_show_number = 1b
|
||||
|
||||
;****************************************************
|
||||
;********************craete Number**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to Number's structure
|
||||
;OUT
|
||||
;pointer to initialized Number's structure
|
||||
align 4
|
||||
|
||||
craete_number:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForNumber],eax
|
||||
|
||||
mov eax,control_header_size+nm_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all image's parameters in control
|
||||
mov [eax],dword number
|
||||
|
||||
mov ecx,nm_control_data_size
|
||||
mov esi,[PointerToStructureForNumber]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForNumber]
|
||||
mov ecx,[ebx+6] ;x
|
||||
mov edx,[ebx+10] ;y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;********************Draw Number*********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of number
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
number:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of image
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForNumber],esi
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword Number
|
||||
mov ecx,nm_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_number
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Number.type]
|
||||
and bl,nm_no_show_number
|
||||
test bl,bl
|
||||
jnz no_redraw_all_number
|
||||
|
||||
or [Number.type],nm_redraw_all
|
||||
|
||||
no_redraw_all_number:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_for_number
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Number.type]
|
||||
and bl,nm_special_redraw_on
|
||||
test bl,bl
|
||||
jz no_special_message_for_number
|
||||
|
||||
or [Number.type],nm_redraw_all
|
||||
and [Number.type],nm_special_redraw_off
|
||||
|
||||
no_special_message_for_number:
|
||||
|
||||
cmp [eax],dword -1
|
||||
jne no_destroy_control_of_number
|
||||
|
||||
jmp exit_number
|
||||
no_destroy_control_of_number:
|
||||
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForNumber]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
;set current coordinats and sizes in zakladka
|
||||
mov [Number.x],ebx
|
||||
mov [Number.y],ecx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Number.type]
|
||||
and al,nm_redraw_all
|
||||
test al,al
|
||||
jz no_redraw_number_
|
||||
|
||||
and [Number.type],nm_redraw_off
|
||||
|
||||
mov esi,dword Number
|
||||
mov edi,[PointerForNumber]
|
||||
add edi,control_header_size
|
||||
mov ecx,2
|
||||
rep movsb
|
||||
|
||||
;get standart colors table
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,dword pointer2
|
||||
mov edx,40
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Number.type]
|
||||
and al,nm_integer_type
|
||||
test al,al
|
||||
jnz no_integer_number
|
||||
|
||||
mov eax,47
|
||||
mov ebx,[Number.parameters]
|
||||
mov ecx,[Number.number]
|
||||
mov edx,[Number.x]
|
||||
shl edx,16
|
||||
add edx,[Number.y]
|
||||
mov esi,[Number.color]
|
||||
mov edi,[pointer2+8]
|
||||
mcall
|
||||
|
||||
jmp no_redraw_number_
|
||||
no_integer_number:
|
||||
;---------------------------------------
|
||||
|
||||
mov ebx,[Number.parameters]
|
||||
mov ecx,ebx
|
||||
shr ebx,16 ;format for integer
|
||||
and ecx,0xffff ;format for float
|
||||
|
||||
;get integer part of float number
|
||||
mov eax,1
|
||||
mov edi,ecx
|
||||
pow_10__:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10__
|
||||
mov edx,eax
|
||||
|
||||
;check for signum
|
||||
mov [v2],0
|
||||
fld [Number.number]
|
||||
fcom [v2]
|
||||
fstsw ax
|
||||
sahf
|
||||
jae no_signum_float_number
|
||||
|
||||
fabs
|
||||
mov [signum_float_number],byte 1
|
||||
|
||||
no_signum_float_number:
|
||||
fstp [Number.number]
|
||||
|
||||
mov [v2],edx ;v2=10^ecx
|
||||
fild [v2]
|
||||
fld [Number.number]
|
||||
fmul st0,st1
|
||||
fistp [v]
|
||||
fstp st0
|
||||
|
||||
mov esi,edx
|
||||
mov eax,[v]
|
||||
cdq
|
||||
idiv esi
|
||||
mov [v],eax
|
||||
|
||||
and [integer_part],0
|
||||
and [tochnost1],0
|
||||
|
||||
;save v in v2
|
||||
mov eax,[v]
|
||||
mov [v2],eax
|
||||
|
||||
mov [Number.flag],0
|
||||
mov esi,ebx
|
||||
get_next_razryd_of_number_integer:
|
||||
|
||||
mov eax,1
|
||||
|
||||
mov edi,esi
|
||||
pow_10_integer:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10_integer
|
||||
|
||||
mov edi,eax
|
||||
mov eax,[v]
|
||||
cdq
|
||||
idiv edi
|
||||
and eax,0xf
|
||||
|
||||
test eax,eax
|
||||
jz no_save_pos_for_integer
|
||||
|
||||
cmp [Number.flag],0
|
||||
jne no_save_pos_for_integer
|
||||
|
||||
mov [Number.flag],1b
|
||||
mov [tochnost1],esi
|
||||
add [tochnost1],1
|
||||
|
||||
no_save_pos_for_integer:
|
||||
|
||||
imul eax,edi
|
||||
sub [v],eax
|
||||
add [integer_part],eax
|
||||
|
||||
dec esi
|
||||
jnz get_next_razryd_of_number_integer
|
||||
mov eax,[v]
|
||||
add [integer_part],eax
|
||||
|
||||
cmp [tochnost1],0
|
||||
jnz all_ok_with_tochnost
|
||||
|
||||
mov [tochnost1],1
|
||||
all_ok_with_tochnost:
|
||||
|
||||
;get float part of float number
|
||||
mov eax,[v2]
|
||||
mov [v],eax
|
||||
|
||||
mov eax,1
|
||||
mov edi,ecx
|
||||
pow_10_float__:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10_float__
|
||||
|
||||
mov [v2],eax ;v2=10^ecx
|
||||
|
||||
fild [v2]
|
||||
fild [v]
|
||||
fld [Number.number]
|
||||
fsub st0,st1
|
||||
fmul st0,st2
|
||||
fistp [v]
|
||||
fstp st0
|
||||
fstp st0
|
||||
|
||||
and [float_part],0
|
||||
|
||||
mov esi,ecx
|
||||
get_next_razryd_of_number_float:
|
||||
|
||||
mov eax,1
|
||||
|
||||
mov edi,esi
|
||||
pow_10_float:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10_float
|
||||
|
||||
mov edi,eax
|
||||
mov eax,[v]
|
||||
cdq
|
||||
idiv edi
|
||||
and eax,0xf
|
||||
imul eax,edi
|
||||
sub [v],eax
|
||||
add [float_part],eax
|
||||
|
||||
dec esi
|
||||
jnz get_next_razryd_of_number_float
|
||||
mov eax,[v]
|
||||
add [float_part],eax
|
||||
|
||||
mov [tochnost2],ecx
|
||||
cmp [signum_float_number],byte 1
|
||||
jne no_draw_signum_for_float_number
|
||||
|
||||
;draw signum
|
||||
mov eax,4
|
||||
mov ebx,[Number.x]
|
||||
mov ecx,[Number.color]
|
||||
mov edx,dword signum
|
||||
mov esi,1
|
||||
mov edi,[pointer2+8]
|
||||
shl ebx,16
|
||||
add ebx,[Number.y]
|
||||
mcall
|
||||
|
||||
add [Number.x],6
|
||||
mov [signum_float_number],0
|
||||
no_draw_signum_for_float_number:
|
||||
|
||||
;draw integer part of float number
|
||||
mov eax,47
|
||||
mov ebx,[tochnost1]
|
||||
mov ecx,[integer_part]
|
||||
mov edx,[Number.x]
|
||||
mov esi,[Number.color]
|
||||
mov edi,[pointer2+8]
|
||||
shl edx,16
|
||||
shl ebx,16
|
||||
add edx,[Number.y]
|
||||
mcall
|
||||
|
||||
mov edx,[tochnost1]
|
||||
add edx,1
|
||||
lea edx,[edx+edx*2]
|
||||
shl edx,1 ;edx=edx*6
|
||||
add edx,[Number.x]
|
||||
mov [x],edx
|
||||
|
||||
;draw float part of float number
|
||||
mov eax,47
|
||||
mov ebx,[tochnost2]
|
||||
mov ecx,[float_part]
|
||||
mov esi,[Number.color]
|
||||
mov edi,[pointer2+8]
|
||||
shl edx,16
|
||||
shl ebx,16
|
||||
add edx,[Number.y]
|
||||
mcall
|
||||
|
||||
;draw point betwen integer part of number and float part of number
|
||||
mov eax,4
|
||||
mov ebx,[x]
|
||||
mov ecx,[Number.color]
|
||||
mov edx,dword point
|
||||
mov esi,1
|
||||
mov edi,[pointer2+8]
|
||||
sub ebx,6
|
||||
shl ebx,16
|
||||
add ebx,[Number.y]
|
||||
mcall
|
||||
|
||||
no_redraw_number_:
|
||||
;-----------------------------------------
|
||||
|
||||
exit_number:
|
||||
|
||||
ret 8
|
459
programs/develop/libGUI/src/progress_bar.inc
Normal file
459
programs/develop/libGUI/src/progress_bar.inc
Normal file
@ -0,0 +1,459 @@
|
||||
|
||||
pb_control_data_size = 34
|
||||
pb_redraw_all = 10000000b
|
||||
pb_redraw_all_off = 01111111b
|
||||
pb_special_progress_on = 1b
|
||||
pb_special_progress_off = 11111110b
|
||||
|
||||
;****************************************************
|
||||
;****************craete ProgressBar********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to ProgressBar's structure
|
||||
;OUT
|
||||
;pointer to initialized control
|
||||
align 4
|
||||
|
||||
craete_progress_bar:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForProgressBar],eax
|
||||
|
||||
mov eax,control_header_size+pb_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all EditBox's parameters in control
|
||||
mov [eax],dword progress_bar
|
||||
|
||||
mov ecx,pb_control_data_size
|
||||
mov esi,[PointerToStructureForProgressBar]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForProgressBar]
|
||||
mov ecx,[ebx+10] ;x
|
||||
mov edx,[ebx+14] ;y
|
||||
mov esi,[ebx+18] ;size x
|
||||
mov edi,[ebx+22] ;size y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],edi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;*****************Draw ProgressBar********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of ProgressBar
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
progress_bar:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of button
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForProgressBar],esi
|
||||
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword ProgressBar
|
||||
mov ecx,pb_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
push eax
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForProgressBar]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size x
|
||||
mov esi,[eax+36] ;size y
|
||||
;set current coordinats and sizes in EeditBox
|
||||
mov [ProgressBar.x],ebx
|
||||
mov [ProgressBar.y],ecx
|
||||
mov [ProgressBar.sizex],edx
|
||||
mov [ProgressBar.sizey],esi
|
||||
|
||||
pop eax
|
||||
|
||||
|
||||
cmp [eax],dword -1
|
||||
jne no_destroy_progress_bar
|
||||
|
||||
jmp exit_progress_bar
|
||||
no_destroy_progress_bar:
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_progress_bar
|
||||
|
||||
or [ProgressBar.type],pb_redraw_all
|
||||
|
||||
no_redraw_all_progress_bar:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_progress_bar
|
||||
|
||||
or [ProgressBar.type],pb_special_progress_on
|
||||
|
||||
no_special_message_progress_bar:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ProgressBar.type]
|
||||
and al,pb_redraw_all
|
||||
test al,al
|
||||
jz no_draw_all_progress_bar
|
||||
|
||||
and [ProgressBar.type],pb_redraw_all_off
|
||||
|
||||
call draw_all_progress_bar
|
||||
|
||||
jmp exit_progress_bar
|
||||
|
||||
no_draw_all_progress_bar:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ProgressBar.type]
|
||||
and al,pb_special_progress_on
|
||||
test al,al
|
||||
jz no_draw_progress_bar
|
||||
|
||||
and [ProgressBar.type],pb_special_progress_off
|
||||
|
||||
call draw_progress
|
||||
|
||||
no_draw_progress_bar:
|
||||
|
||||
exit_progress_bar:
|
||||
|
||||
ret 8
|
||||
|
||||
draw_all_progress_bar:
|
||||
|
||||
mov eax,[ProgressBar.color3]
|
||||
mov ebx,dword 0xffffff
|
||||
mov ecx,20
|
||||
mov edx,dword colors_table1
|
||||
call gradient
|
||||
|
||||
mov eax,13
|
||||
mov ebx,[ProgressBar.x]
|
||||
mov ecx,[ProgressBar.y]
|
||||
mov edx,[ProgressBar.color1]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[ProgressBar.sizex]
|
||||
add ecx,[ProgressBar.sizey]
|
||||
mcall
|
||||
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
add eax,[ProgressBar.sizex]
|
||||
add ebx,[ProgressBar.sizey]
|
||||
mov [v],eax ;v=x+sizex
|
||||
mov [v2],ebx ;v2=y+sizey
|
||||
|
||||
;dark lines
|
||||
mov eax,[ProgressBar.color3]
|
||||
and eax,0xffffff
|
||||
mov [Line.color],eax
|
||||
mov [Pixel.color],eax
|
||||
|
||||
;(x+1,y)-(x+sizex-1,y)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,[v]
|
||||
add eax,1
|
||||
sub ecx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ecx
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ebx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex,y+1)-(x+sizex,y+sizey-1)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
mov ecx,[ProgressBar.y]
|
||||
add ecx,1
|
||||
sub ebx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ebx
|
||||
call DrawLine
|
||||
|
||||
;(x+1,y+sizey)-(x+sizex-1,y+sizey)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v]
|
||||
mov ecx,[v2]
|
||||
add eax,1
|
||||
sub ebx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ebx
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x,y+1)-(x,y_sizey-1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,[v2]
|
||||
add ebx,1
|
||||
sub ecx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+1,y+1)-(x+1,y+2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,ebx
|
||||
add eax,1
|
||||
add ebx,1
|
||||
add ecx,2
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
add eax,2
|
||||
add ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+1,y+sizey-1)-(x+1,y+sizey-2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v2]
|
||||
mov ecx,ebx
|
||||
add eax,1
|
||||
sub ebx,1
|
||||
sub ecx,2
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+sizey-1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v2]
|
||||
add eax,2
|
||||
sub ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+sizex-1,y+1)-(x+sizex-1,y+2)
|
||||
mov eax,[v]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,ebx
|
||||
sub eax,1
|
||||
add ebx,1
|
||||
add ecx,2
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+1)
|
||||
mov eax,[v]
|
||||
mov ebx,[ProgressBar.y]
|
||||
sub eax,2
|
||||
add ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+sizex-1,y+sizey-2)-(x+sizex-1,y+sizey-1)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
mov ecx,ebx
|
||||
sub eax,1
|
||||
sub ebx,2
|
||||
sub ecx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+sizey-1)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
sub eax,2
|
||||
sub ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
mov eax,[colors_table1+10*3]
|
||||
and eax,0xffffff
|
||||
mov [Line.color],eax
|
||||
mov [Pixel.color],eax
|
||||
|
||||
;(x+3,y+1)-(x+sizex-3,y+1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v]
|
||||
mov ecx,[ProgressBar.y]
|
||||
add ecx,1
|
||||
add eax,3
|
||||
sub ebx,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ebx
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
add eax,2
|
||||
add ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+sizex-1,y+3)-(x+sizex-1,y+sizey-3)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
mov ecx,[ProgressBar.y]
|
||||
sub eax,1
|
||||
sub ebx,3
|
||||
add ecx,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ebx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+2)
|
||||
mov eax,[v]
|
||||
mov ebx,[ProgressBar.y]
|
||||
sub eax,2
|
||||
add ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+3,y+sizey-1)-(x+sizex-3,y+sizey-1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v]
|
||||
mov ecx,[v2]
|
||||
sub ebx,3
|
||||
sub ecx,1
|
||||
add eax,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ebx
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+sizey-2)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
sub eax,2
|
||||
sub ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+1,y+3)-(x+1,y+sizey-3)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,[v2]
|
||||
add eax,1
|
||||
add ebx,3
|
||||
sub ecx,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+sizey-2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v2]
|
||||
add eax,2
|
||||
sub ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
ret
|
||||
|
||||
draw_progress:
|
||||
|
||||
cmp [ProgressBar.progress],dword 0.02
|
||||
jae min_size_ok
|
||||
|
||||
mov [ProgressBar.progress],dword 0.02
|
||||
min_size_ok:
|
||||
|
||||
cmp [ProgressBar.progress],dword 1.0
|
||||
jle max_size_ok
|
||||
|
||||
mov [ProgressBar.progress],dword 1.0
|
||||
max_size_ok:
|
||||
|
||||
mov eax,[ProgressBar.sizex]
|
||||
sub eax,6
|
||||
mov [v2],eax
|
||||
|
||||
fld [ProgressBar.progress]
|
||||
fild [v2]
|
||||
fmul st0,st1
|
||||
fistp [v3]
|
||||
fstp st0
|
||||
|
||||
mov eax,[ProgressBar.color2]
|
||||
mov ebx,0xffffff
|
||||
mov ecx,[ProgressBar.x]
|
||||
mov edx,[ProgressBar.y]
|
||||
mov esi,[v3]
|
||||
mov edi,[ProgressBar.sizey]
|
||||
sub edi,4
|
||||
shr edi,1
|
||||
add ecx,3
|
||||
add edx,1
|
||||
|
||||
call rectangle_gradient_up
|
||||
|
||||
mov eax,[ProgressBar.color2]
|
||||
mov ebx,0xffffff
|
||||
mov ecx,[ProgressBar.x]
|
||||
mov edx,[ProgressBar.y]
|
||||
mov esi,[v3]
|
||||
mov edi,[ProgressBar.sizey]
|
||||
sub edi,4
|
||||
shr edi,1
|
||||
add ecx,3
|
||||
add edx,2
|
||||
add edx,edi
|
||||
|
||||
call rectangle_gradient_down
|
||||
|
||||
ret
|
24
programs/develop/libGUI/src/remove_component.inc
Normal file
24
programs/develop/libGUI/src/remove_component.inc
Normal file
@ -0,0 +1,24 @@
|
||||
;****************************************************
|
||||
;***************Resize of GUI component**************
|
||||
;****************************************************
|
||||
;IN
|
||||
;ResizeComponent(dword Parend,dword Control,dword newx,dword newy)
|
||||
;newy
|
||||
;newx
|
||||
;Control
|
||||
;Parend
|
||||
;OUT
|
||||
;not
|
||||
|
||||
align 4
|
||||
|
||||
remove_component:
|
||||
|
||||
mov ebx,[esp+4] ;Control
|
||||
mov ecx,[esp+8] ;new x
|
||||
mov edx,[esp+12] ;new y
|
||||
|
||||
mov [ebx+24],ecx
|
||||
mov [ebx+28],edx
|
||||
|
||||
ret 12
|
24
programs/develop/libGUI/src/resize_component.inc
Normal file
24
programs/develop/libGUI/src/resize_component.inc
Normal file
@ -0,0 +1,24 @@
|
||||
;****************************************************
|
||||
;***************Resize of GUI component**************
|
||||
;****************************************************
|
||||
;IN
|
||||
;ResizeComponent(dword Parend,dword Control,dword newx,dword newy)
|
||||
;newy
|
||||
;newx
|
||||
;Control
|
||||
;Parend
|
||||
;OUT
|
||||
;not
|
||||
|
||||
align 4
|
||||
|
||||
resize_component:
|
||||
|
||||
mov ebx,[esp+4] ;Control
|
||||
mov ecx,[esp+8] ;new size x
|
||||
mov edx,[esp+12] ;new size y
|
||||
|
||||
mov [ebx+32],ecx
|
||||
mov [ebx+36],edx
|
||||
|
||||
ret 12
|
4195
programs/develop/libGUI/src/scroller.inc
Normal file
4195
programs/develop/libGUI/src/scroller.inc
Normal file
File diff suppressed because it is too large
Load Diff
19
programs/develop/libGUI/src/string.inc
Normal file
19
programs/develop/libGUI/src/string.inc
Normal file
@ -0,0 +1,19 @@
|
||||
;ebx - pointer to string
|
||||
GetLengthString:
|
||||
|
||||
xor ecx,ecx
|
||||
|
||||
next_simvol:
|
||||
inc ecx
|
||||
xor eax,eax
|
||||
mov al,[ebx]
|
||||
test al,al
|
||||
jz null
|
||||
inc ebx
|
||||
jmp next_simvol
|
||||
|
||||
null:
|
||||
mov eax,ecx
|
||||
dec eax
|
||||
|
||||
ret
|
180
programs/develop/libGUI/src/struct.inc
Normal file
180
programs/develop/libGUI/src/struct.inc
Normal file
@ -0,0 +1,180 @@
|
||||
|
||||
; Macroinstructions for defining data structures
|
||||
|
||||
macro struct name
|
||||
{ fields@struct equ name
|
||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||
sub@struct equ
|
||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
||||
macro db [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
||||
macro dw [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
||||
macro du [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
||||
macro dd [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
||||
macro dp [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
||||
macro dq [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
||||
macro dt [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
||||
macro rb count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
||||
macro rw count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
||||
macro rd count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
||||
macro rp count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
||||
macro rq count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
||||
macro rt count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
||||
macro union \{ fields@struct equ fields@struct,,union,<
|
||||
sub@struct equ union \}
|
||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||
sub@struct equ substruct \}
|
||||
virtual at 0 }
|
||||
|
||||
macro ends
|
||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||
restruc rb,rw,rd,rp,rq,rt
|
||||
purge db,dw,du,dd,dp,dq,dt
|
||||
purge rb,rw,rd,rp,rq,rt
|
||||
purge union,struct
|
||||
match name=,fields,fields@struct \\{ fields@struct equ
|
||||
make@struct name,fields
|
||||
fields@\\#name equ fields \\}
|
||||
end virtual \}
|
||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||
restore sub@struct }
|
||||
|
||||
macro make@struct name,[field,type,def]
|
||||
{ common
|
||||
if $
|
||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
||||
err
|
||||
end if
|
||||
local define
|
||||
define equ name
|
||||
forward
|
||||
local sub
|
||||
match , field \{ make@substruct type,name,sub def
|
||||
define equ define,.,sub, \}
|
||||
match any, field \{ define equ define,.#field,type,<def> \}
|
||||
common
|
||||
match fields, define \{ define@struct fields \} }
|
||||
|
||||
macro define@struct name,[field,type,def]
|
||||
{ common
|
||||
local list
|
||||
list equ
|
||||
forward
|
||||
if ~ field eq .
|
||||
name#field type def
|
||||
sizeof.#name#field = $ - name#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
match any, list \{ list equ list, \}
|
||||
list equ list <value>
|
||||
common
|
||||
sizeof.#name = $
|
||||
restruc name
|
||||
match values, list \{
|
||||
struc name value \\{
|
||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||
match , fields@struct \\\{ label .
|
||||
forward
|
||||
match , value \\\\{ field type def \\\\}
|
||||
match any, value \\\\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#name#field - ($-field)
|
||||
end if \\\\}
|
||||
common \\\} \\} \} }
|
||||
|
||||
macro enable@substruct
|
||||
{ macro make@substruct substruct,parent,name,[field,type,def]
|
||||
\{ \common
|
||||
\local define
|
||||
define equ parent,name
|
||||
\forward
|
||||
\local sub
|
||||
match , field \\{ match any, type \\\{ enable@substruct
|
||||
make@substruct type,name,sub def
|
||||
purge make@substruct
|
||||
define equ define,.,sub, \\\} \\}
|
||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||
\common
|
||||
match fields, define \\{ define@\#substruct fields \\} \} }
|
||||
|
||||
enable@substruct
|
||||
|
||||
macro define@union parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
virtual at 0
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
end virtual
|
||||
if sizeof.#parent#field > $
|
||||
rb sizeof.#parent#field - $
|
||||
end if
|
||||
else if sizeof.#type > $
|
||||
rb sizeof.#type - $
|
||||
end if
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name [value] \{ \common
|
||||
label .\#name
|
||||
last@union equ
|
||||
forward
|
||||
match any, last@union \\{ virtual at .\#name
|
||||
field type def
|
||||
end virtual \\}
|
||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||
match any, value \\\{ field type value \\\} \\}
|
||||
last@union equ field
|
||||
common rb sizeof.#name - ($ - .\#name) \} }
|
||||
|
||||
macro define@substruct parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name value \{
|
||||
label .\#name
|
||||
forward
|
||||
match , value \\{ field type def \\}
|
||||
match any, value \\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#parent#field - ($-field)
|
||||
end if \\}
|
||||
common \} }
|
150
programs/develop/libGUI/src/text.inc
Normal file
150
programs/develop/libGUI/src/text.inc
Normal file
@ -0,0 +1,150 @@
|
||||
|
||||
tx_control_data_size = 22
|
||||
tx_no_show_text = 1b
|
||||
tx_redraw_all = 10000000b
|
||||
tx_redraw_all_off = 01111111b
|
||||
tx_special_redraw_on = 100b
|
||||
tx_special_redraw_off = 11111011b
|
||||
|
||||
;****************************************************
|
||||
;********************craete Text**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to Text's structure
|
||||
;OUT
|
||||
;pointer to initialized Texr's structure
|
||||
align 4
|
||||
|
||||
craete_text:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForText],eax
|
||||
|
||||
mov eax,control_header_size+tx_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all image's parameters in control
|
||||
mov [eax],dword text
|
||||
|
||||
mov ecx,tx_control_data_size
|
||||
mov esi,[PointerToStructureForText]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForText]
|
||||
mov ecx,[ebx+6] ;x
|
||||
mov edx,[ebx+10] ;y
|
||||
mov esi,[ebx+14] ;length x
|
||||
imul esi,6
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],dword 9
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;********************Draw Text**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of text
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
text:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of image
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForText],esi
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword Text
|
||||
mov ecx,tx_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_text
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Text.type]
|
||||
and bl,tx_no_show_text
|
||||
test bl,bl
|
||||
jnz no_redraw_all_text
|
||||
|
||||
or [Text.type],tx_redraw_all
|
||||
|
||||
no_redraw_all_text:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_for_text
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Text.type]
|
||||
and bl,tx_special_redraw_on
|
||||
test bl,bl
|
||||
jz no_special_message_for_text
|
||||
|
||||
or [Text.type],tx_redraw_all
|
||||
and [Text.type],tx_special_redraw_off
|
||||
|
||||
no_special_message_for_text:
|
||||
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForText]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
;set current coordinats and sizes in zakladka
|
||||
mov [Text.x],ebx
|
||||
mov [Text.y],ecx
|
||||
|
||||
;get standart colors table
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,dword pointer2
|
||||
mov edx,40
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Text.type]
|
||||
and al,tx_redraw_all
|
||||
test al,al
|
||||
jz no_redraw_text_
|
||||
|
||||
and [Text.type],tx_redraw_all_off
|
||||
|
||||
mov esi,dword Text
|
||||
mov edi,[PointerForText]
|
||||
add edi,control_header_size
|
||||
mov ecx,2
|
||||
rep movsb
|
||||
|
||||
mov eax,4
|
||||
mov ebx,[Text.x]
|
||||
shl ebx,16
|
||||
add ebx,[Text.y]
|
||||
mov ecx,[Text.color]
|
||||
mov edx,[Text.pointer]
|
||||
mov esi,[Text.length]
|
||||
mov edi,[pointer2+8]
|
||||
mcall
|
||||
|
||||
no_redraw_text_:
|
||||
|
||||
exit_text:
|
||||
|
||||
ret 8
|
Loading…
Reference in New Issue
Block a user