kolibrios/programs/develop/libraries/box_lib/asm/trunk/tooltip_demo.asm

188 lines
5.8 KiB
NASM
Raw Normal View History

; <20><><EFBFBD><EFBFBD><20><EFBFBD><E0A8AC> <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD> KolibriOS
; <20><><EFBFBD><EFBFBD><EFBFBD><E7A8A2><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; - <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A8AC> <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD> tooltip
use32 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E0A5A6> <20><><EFBFBD><E1A5AC><EFBFBD><EFBFBD><EFBFBD>
org 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
db 'MENUET01' ; 8-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> MenuetOS
dd 0x01 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><EFBFBD><E1A5A3> 1)
dd START ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd CODE_END ; ࠧ<><E0A0A7><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
dd DATA_END ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd STACK_END ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
dd 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E0A0AC>
dd cur_dir_path ; 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><20><><EFBFBD><EFBFBD><EFBFBD><E9A0A5><EFBFBD> <20><><EFBFBD>, ᮤ<><EFBFBD><E0A6A0><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ணࠬ<E0AEA3><E0A0AC> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>᪠.
include '../../../../../proc32.inc'
include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../Dll.inc' ; malloc fn
include '../../trunk/box_lib.mac'
include '../../load_lib.mac'
;include 'proc32.inc'
;include 'macros.inc'
;include 'KOSfuncs.inc'
;---------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ----------------------------------------------
;---------------------------------------------------------------------
; <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>易⥫<EFA7A0><E2A5AB> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⮢, <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> heap
; <20><EFBFBD><>, <20><>易⥫쭮 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD> lib_init - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; <20>㭪樨 娯<> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
START:
;---------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ----------------------------------------
;---------------------------------------------------------------------
;mov eax, mem_alloc
;mov [mem.alloc], eax
;mov eax, mem_realloc
;mov [mem.realloc], eax
;mov eax, mem_free
;mov [mem.free], eax
mcall 68, 11
mcall 40, $C0000027 ; <20><>᪠ ᮡ<>⨩ - <20><><EFBFBD><EFBFBD> ⮫쪮 <20> <20><><EFBFBD><E2A8A2><EFBFBD> <20><><EFBFBD><EFBFBD>
sys_load_library lib_name, cur_dir_path, lib_path, sys_path, \
e_notfound_lib, head_f_l, myimport, e_import, head_f_i
test eax,eax
jz @f
mcall -1 ; alarm exit
@@:
invoke tooltip_init, redbox_tt ; only begin of list
red: ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD>
call draw_window ; <20><><EFBFBD><EFBFBD><EBA2A0> <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>
;---------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ----------------------------------------
;---------------------------------------------------------------------
still:
mcall 23, 5 ; <20><EFBFBD><E3ADAA><EFBFBD> 23 - <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> 祬 0.05<EFBFBD>
test eax, eax ; <20><><EFBFBD><>⨩ - <20><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E1AEA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E2A8AF> <20><><><E2A0A9><EFBFBD><EFBFBD>
je yield
cmp eax,1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD> ?
je red ; <20><20><> - <20><> <20><><EFBFBD><EFBFBD><EFBFBD> red
cmp eax,2 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
je key ; <20><20><> - <20><> key
cmp eax,3 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
je button ; <20><20><> - <20><> button
cmp eax,6 ; ᮡ<><20><><EFBFBD><EFBFBD>
je mouse ; <20><20><> - <20><> mouse
jmp still ; <20><20><><EFBFBD><>⨥ - <20> <20><><EFBFBD><><E6A8AA>
;---------------------------------------------------------------------
yield:
invoke tooltip_test_show, redbox_tt
jmp still ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><><E6A8AA>
mouse:
invoke tooltip_mouse, redbox_tt
jmp still ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><><E6A8AA>
key: ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall 2 ; <20><EFBFBD><E3ADAA><EFBFBD> 2 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><><E1A8AC><EFBFBD><EFBFBD> (<28> ah)
jmp still ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><><E6A8AA>
;---------------------------------------------------------------------
button:
mcall 17 ; 17 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp ah, 1 ; <20><20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>஬ 1,
jne still ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
pexit:
invoke tooltip_delete, redbox_tt ; <20><EFBFBD><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall -1 ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
;---------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ----------------------------------
;---------------------------------------------------------------------
draw_window:
mcall 12, 1 ; <20><EFBFBD><E3ADAA><EFBFBD> 12: ᮮ<><E1AEAE><EFBFBD><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2>
mcall 48, 3, sc,sizeof.system_colors
mov edx, [sc.work] ; 梥<><>
or edx, 0x33000000 ; <20> <20><><EFBFBD><EFBFBD> 3
mcall 0, <200,300>, <200,150>, , ,title
; <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A8AA>
mcall 13, <60,50>, <50,50>, $FF0000
mcall 13, <140,50>, <50,50>, $FF
mcall 12, 2 ; <20><EFBFBD><E3ADAA><EFBFBD> 12.2, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E1AEA2><EFBFBD>
ret ; <20><><EFBFBD><E5AEA4> <20><> <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD>
CODE_END: ; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>; --------------------------------------------;
; ---------------------------------------------------------------------------- ;
;---------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ----------------------------------------------
;---------------------------------------------------------------------
sys_path db '/sys/lib/'
;sys_path db '/tmp0/1/'
lib_name db 'box_lib.obj',0
cur_dir_path rb 4096
lib_path rb 4096
e_notfound_lib db 'Sorry I cannot load library box_lib.obj',0
head_f_i:
head_f_l db 'System error',0
e_import db 'Error on load import library box_lib.obj',0
myimport:
dd sz_lib_init ;<3B><EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AAA0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ᮬ 1 ࠧ <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A5AD>
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20> <20>ணࠬ<E0AEA3><E0A0AC> <20><><20><> <20><><EFBFBD> <20><> <20><EFBFBD>
tooltip_init dd sz_tooltip_init
tooltip_delete dd sz_tooltip_delete
tooltip_test_show dd sz_tooltip_test_show
tooltip_mouse dd sz_tooltip_mouse
get_font_size dd sz_get_font_size
dd 0
dd 0
sz_lib_init db 'lib_init',0
sz_tooltip_init db 'tooltip_init', 0
sz_tooltip_delete db 'tooltip_delete', 0
sz_tooltip_test_show db 'tooltip_test_show', 0
sz_tooltip_mouse db 'tooltip_mouse', 0
sz_get_font_size db 'get_font_size', 0
;tooltip txt, next, zone_x, zone_w, zone_y, zone_h, col_txt, col_bkg, tm_wait
redbox_tt tooltip redboxtxt, blubox_tt, 60, 50, 50, 50, 0, $FFF473, 100
blubox_tt tooltip bluboxtxt, 0, 140, 50, 50, 50, $110000FF, $FFF473, 100
redboxtxt db 'Red Box Tooltip', 13, 'May be multilined', 13, 13, 'Even with empty lines', 0
bluboxtxt db 'Blue Box Tooltip', 0
sc system_colors
title db 'Toooltip demo',0
; stack----------------------------------------------------------------------- ;
rb 4096
STACK_END dd ?
DATA_END: ; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>; ------------------------------------ ;