mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-12 01:53:58 +03:00
58193e0151
git-svn-id: svn://kolibrios.org@6693 a494cfbc-eb01-0410-851d-a64ba20cac60
188 lines
5.8 KiB
NASM
188 lines
5.8 KiB
NASM
; <20>à®á⮩ ¯à¨¬¥à ¯à®£à ¬¬ë ¤«ï KolibriOS
|
||
; ®§¢ã稢 ¥â ª®¤ ¦ ⮩ ª« ¢¨è¨
|
||
; - ¯¥à¥¤¥« ª ª ¯à¨¬¥à ¨á¯®«ì§®¢ ¨ï tooltip
|
||
|
||
use32 ; ¢ª«îç¨âì 32-¡¨âë© à¥¦¨¬ áᥬ¡«¥à
|
||
org 0x0 ; ¤à¥á æ¨ï á ã«ï
|
||
|
||
db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS
|
||
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1)
|
||
dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë
|
||
dd CODE_END ; à §¬¥à ¯à®£à ¬¬ë
|
||
dd DATA_END ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
||
dd STACK_END ; ¤à¥á ¢¥àè¨ë áâíª
|
||
dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢
|
||
dd cur_dir_path ; 㪠§ â¥«ì ¤à¥á, ªã¤ ¯®¬¥é ¥âáï áâப , ᮤ¥à¦ é ï ¯ãâì ¤® ¯à®£à ¬¬ë ¢ ¬®¬¥â § ¯ã᪠.
|
||
|
||
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>€—€‹Ž <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||
;---------------------------------------------------------------------
|
||
; íâ®â ¬ ªà®á ®¡ï§ ⥫¥ ¤«ï ¢á¥å ª®¬¯®¥â®¢, ¨á¯®«ì§ãîé¨å heap
|
||
; ªà®¬¥ ⮣®, ®¡ï§ â¥«ì® ¨¬®àâ¨à®¢ âì lib_init - ¯à¨ ¨¬¯®à⥠®¯à¥¤¥«ïîâáï
|
||
; äãªæ¨¨ 娯 ¤«ï ¡¨¡«¨®â¥ª¨
|
||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||
|
||
START:
|
||
;---------------------------------------------------------------------
|
||
;--- ˆ<>ˆ–ˆ€‹ˆ‡€–ˆŸ ----------------------------------------
|
||
;---------------------------------------------------------------------
|
||
;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 ; ¬ ᪠ᮡë⨩ - ¬ëèì ⮫쪮 ¢ ªâ¨¢®¬ ®ª¥
|
||
|
||
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: ; ¯¥à¥à¨á®¢ âì ®ª®
|
||
|
||
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª
|
||
|
||
;---------------------------------------------------------------------
|
||
;--- –ˆŠ‹ Ž<><C5BD>€<EFBFBD>Ž’Šˆ ‘Ž<E28098>›’ˆ‰ ----------------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
still:
|
||
mcall 23, 5 ; äãªæ¨ï 23 - ¦¤ âì ᮡëâ¨ï <20>¥ ¡®«¥¥ 祬 0.05á
|
||
test eax, eax ; ¥â ᮡë⨩ - ¯à®¢¥à¨âì à¨á®¢ ¨¥ âã«â¨¯®¢ ¯® â ©¬¥àã
|
||
je yield
|
||
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª® ?
|
||
je red ; ¥á«¨ ¤ - ¬¥âªã red
|
||
cmp eax,2 ; ¦ â ª« ¢¨è ?
|
||
je key ; ¥á«¨ ¤ - key
|
||
cmp eax,3 ; ¦ â ª®¯ª ?
|
||
je button ; ¥á«¨ ¤ - button
|
||
cmp eax,6 ; ᮡë⨥ ¬ëè¨
|
||
je mouse ; ¥á«¨ ¤ - mouse
|
||
|
||
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ç «® 横«
|
||
|
||
|
||
;---------------------------------------------------------------------
|
||
yield:
|
||
invoke tooltip_test_show, redbox_tt
|
||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
||
|
||
mouse:
|
||
invoke tooltip_mouse, redbox_tt
|
||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
||
|
||
key: ; ¦ â ª« ¢¨è ª« ¢¨ âãà¥
|
||
mcall 2 ; äãªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®« (¢ ah)
|
||
|
||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
||
|
||
;---------------------------------------------------------------------
|
||
|
||
button:
|
||
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨
|
||
|
||
cmp ah, 1 ; ¥á«¨ <20>… ¦ â ª®¯ª á ®¬¥à®¬ 1,
|
||
jne still ; ¢¥àãâìáï
|
||
|
||
pexit:
|
||
invoke tooltip_delete, redbox_tt ; ®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||
mcall -1 ; ¨ ç¥ ª®¥æ ¯à®£à ¬¬ë
|
||
|
||
|
||
;---------------------------------------------------------------------
|
||
;--- Ž<><C5BD>…„…‹…<E280B9>ˆ… ˆ Ž’<C5BD>ˆ‘Ž‚Š€ ŽŠ<C5BD>€ ----------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
draw_window:
|
||
|
||
mcall 12, 1 ; äãªæ¨ï 12: á®®¡é¨âì Ž‘ ® ç «¥ ®âà¨á®¢ª¨
|
||
|
||
mcall 48, 3, sc,sizeof.system_colors
|
||
|
||
mov edx, [sc.work] ; 梥â ä®
|
||
or edx, 0x33000000 ; ¨ ⨯ ®ª 3
|
||
mcall 0, <200,300>, <200,150>, , ,title
|
||
|
||
; ¢ë¢®¤ ª¢ ¤à ⨪®¢
|
||
mcall 13, <60,50>, <50,50>, $FF0000
|
||
mcall 13, <140,50>, <50,50>, $FF
|
||
|
||
|
||
mcall 12, 2 ; äãªæ¨ï 12.2, § ª®ç¨«¨ à¨á®¢ âì
|
||
|
||
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
|
||
|
||
|
||
CODE_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë; --------------------------------------------;
|
||
|
||
; ---------------------------------------------------------------------------- ;
|
||
;---------------------------------------------------------------------
|
||
;--- „€<E2809E><E282AC>›… <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||
;---------------------------------------------------------------------
|
||
|
||
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 ;äãªæ¨ï § ¯ã᪠¥âáï ¬ ªà®á®¬ 1 à § ¯à¨ ¯®¤ª«î票¨
|
||
;¡¨¡«¨®â¥ª¨, ¯®â®¬ã ¢ ¯à®£à ¬¬¥ ¬¥âª ¥¥ ¥ ã¦
|
||
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: ; ¬¥âª ª®æ ¤ ëå ¯à®£à ¬¬ë; ------------------------------------ ;
|