Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;-----------------------------------------------------------------------
  2. ;                    assembler SDK for libGUI
  3. ;-----------------------------------------------------------------------
  4.  
  5. HEADER_SIZE                                   =  18*4
  6. NULL                                          =  0
  7.  
  8. ;///////////////////////////////////////////////////////////////////////
  9. ;//               libGUI system messages types
  10. ;///////////////////////////////////////////////////////////////////////
  11. MESSAGE_FULL_REDRAW_ALL                       =  1
  12. MESSAGE_KEYS_EVENT                            =  2
  13. MESSAGE_SPECIALIZED                           =  3
  14. MESSAGE_SET_FOCUSE                            =  4
  15. MESSAGE_CHANGE_FOCUSE                         =  5
  16. MESSAGE_MOUSE_EVENT                           =  6
  17. MESSAGE_CHANGE_POSITION_EVENT                 =  7
  18. MESSAGE_CHANGESIZE_EVENT                      =  8
  19. MESSAGE_CALL_TIMER_EVENT                      =  9
  20. MESSAGE_FULL_REDRAW_ALL_WITH_FINITION         =  10
  21. MESSAGE_SET_MAIN_PARENT                       =  11
  22. MESSAGE_DESTROY_CONTROL                       =  -1
  23.  
  24. ;///////////////////////////////////////////////////////////////////////
  25. ;//                         system keys states
  26. ;///////////////////////////////////////////////////////////////////////
  27. KEY_DOWN                                      =  16
  28. KEY_UP                                        =  17
  29. KEY_HOTKEY                                    =  18
  30. ;///////////////////////////////////////////////////////////////////////
  31. ;//                       system mouse buttons states
  32. ;///////////////////////////////////////////////////////////////////////
  33. MOUSE_LEFT_BUTTON_DOWN                        =  19
  34. MOUSE_LEFT_BUTTON_UP                          =  20
  35. MOUSE_RIGHT_BUTTON_DOWN                       =  21
  36. MOUSE_RIGHT_BUTTON_UP                         =  22
  37. MOUSE_MIDDLE_BUTTON_DOWN                      =  23
  38. MOUSE_MIDDLE_BUTTON_UP                        =  24
  39. MOUSE_4_BUTTON_DOWN                           =  25
  40. MOUSE_4_BUTTON_UP                             =  26
  41. MOUSE_5_BUTTON_DOWN                           =  27
  42. MOUSE_5_BUTTON_UP                             =  28
  43.  
  44. ;---------------------------------------------------------------------
  45. ;                 CONNECT EVENTS FOR CALLBACKs
  46. ;---------------------------------------------------------------------
  47.  
  48. ;////////////////////////////////////////////////////////////////
  49. ;//                 connect events for button
  50. ;////////////////////////////////////////////////////////////////
  51. BUTTON_ENTER_EVENT                            =  29
  52. BUTTON_LEAVE_EVENT                            =  30
  53. BUTTON_PRESSED_EVENT                          =  31
  54. BUTTON_RELEASED_EVENT                         =  32
  55.  
  56. ;////////////////////////////////////////////////////////////////
  57. ;//                connect events for scroll bar
  58. ;////////////////////////////////////////////////////////////////
  59. SCROLLBAR_CHANGED_EVENT                       =  33
  60.  
  61. ;////////////////////////////////////////////////////////////////
  62. ;//            connect events for main parent window
  63. ;////////////////////////////////////////////////////////////////
  64. DELETE_EVENT                                  =  36
  65.  
  66. ;-----------------------------------------------------------------------
  67. ;------------------------libGUI functions-------------------------------
  68. ;-----------------------------------------------------------------------
  69.  
  70. ;DWORD LibGUIversion(void);
  71. macro LibGUIversion
  72. {
  73.         call [imp_LibGUIversion]
  74. }
  75. ;char InitLibGUI(void);
  76. macro InitLibGUI
  77. {
  78.         call [imp_InitLibGUI]
  79. }
  80.  
  81. ;void LibGUImain(parent_t *WindowParent);
  82. macro LibGUImain WindowParent
  83. {
  84.         pushd WindowParent
  85.         call [imp_LibGUImain]
  86.         add esp,1*4
  87. }
  88.  
  89. ;void QuitLibGUI(parent_t *window);
  90. macro QuitLibGUI window
  91. {
  92.         pushd window
  93.         call [imp_QuitLibGUI]
  94.         add esp,1*4
  95. }
  96. ;void* CreateWindow(void)
  97. macro CreateWindow
  98. {
  99.         call [imp_CreateWindow]
  100. }
  101. ;void SetWindowSizeRequest(parent_t *WindowParent,int size_x,int size_y)
  102. macro SetWindowSizeRequest WindowParent,sizex,sizey
  103. {
  104.         pushd sizey
  105.         pushd sizex
  106.         pushd WindowParent
  107.         call [imp_SetWindowSizeRequest]
  108.         add esp,3*4
  109. }
  110. ;void PackControls(void *Parent,void *control);
  111. macro PackControls Parent,control
  112. {
  113.         pushd control
  114.         pushd Parent
  115.         call [imp_PackControls]
  116.         add esp,2*4
  117. }
  118. ;void DestroyControl(void *control);
  119. macro DestroyControl control
  120. {
  121.         pushd control
  122.         call [imp_DestroyControl]
  123.         add esp,1*4
  124. }
  125. ;void SetControlSizeRequest(void *Control,int new_size_x,int new_size_y);
  126. macro SetControlSizeRequest Control,new_size_x,new_size_y
  127. {
  128.         pushd new_size_y
  129.         pushd new_size_x
  130.         pushd Control
  131.         call [imp_SetControlSizeRequest]
  132.         add esp 3*4
  133. }
  134. ;int GetControlSizeX(void *Control);
  135. macro GetControlSizeX Control
  136. {
  137.         pushd Control
  138.         call [imp_GetControlSizeX]
  139.         add esp 1*4
  140. }
  141. ;int GetControlSizeY(void *Control);
  142. macro GetControlSizeY Control
  143. {
  144.         pushd Control
  145.         call [imp_GetControlSizeY]
  146.         add esp 1*4
  147. }
  148. ;void SetControlNewPosition(void *Control,int new_x,int new_y)
  149. macro SetControlNewPosition Control,new_x,new_y
  150. {
  151.         pushd new_y
  152.         pushd new_x
  153.         pushd Control
  154.         call [imp_SetControlNewPosition]
  155.         add esp,3*4
  156. }
  157. ;int GetControlPositionX(void *Control);
  158. macro GetControlPositionX Control
  159. {
  160.         pushd Control
  161.         call [imp_GetControlPositionX]
  162.         add esp,1*4
  163. }
  164. ;int GetControlPositionY(void *Control);
  165. macro GetControlPositionY Control
  166. {
  167.         pushd Control
  168.         call [imp_GetControlPositionY]
  169.         add esp,1*4
  170. }
  171. ;void* SetFocuse(void *Control);
  172. macro SetFocuse Control
  173. {
  174.         pushd Control
  175.         call [imp_SetFocuse]
  176.         add esp,1*4
  177. }
  178. ;void RedrawControl(void *Control)
  179. macro RedrawControl Control
  180. {
  181.         pushd Control
  182.         call [imp_RedrawControl]
  183.         add esp,1*4
  184. }
  185. ;void SpecialRedrawControl(void *Control)
  186. macro SpecialRedrawControl Control
  187. {
  188.         pushd Control
  189.         call [imp_SpecialRedrawControl]
  190.         add esp,1*4
  191. }
  192. ;SetCallbackFunction(void *Control,int event_name,void *callback_func,void *callback_func_data);
  193. macro SetCallbackFunction Control,event_name,callback_func,callback_func_data
  194. {
  195.         pushd callback_func_data
  196.         pushd callback_func
  197.         pushd event_name
  198.         pushd Control
  199.         call [imp_SetCallbackFunction]
  200.         add esp,4*4
  201. }
  202. ;BlockCallbackFunction(void *Control,gui_callback_t *callback_ID)
  203. macro BlockCallbackFunction Control,callback_ID
  204. {
  205.         pushd callback_ID
  206.         pushd Control
  207.         call [imp_BlockCallbackFunction]
  208.         add esp,2*4
  209. }
  210. ;void UnblockCallbackFunction(void *Control,gui_callback_t *callback_ID)
  211. macro UnblockCallbackFunction Control,callback_ID
  212. {
  213.         pushd callback_ID
  214.         pushd Control
  215.         call [imp_UnblockCallbackFunction]
  216.         add esp,2*4
  217. }
  218. ;void SetIDL_Function(parent_t *Parent,void *function,void *function_data)
  219. macro SetIDL_Function Parent,function,function_data
  220. {
  221.         pushd function_data
  222.         pushd function
  223.         pushd Parent
  224.         call [imp_SetIDL_Function]
  225.         add esp,3*4
  226. }
  227. ;void DestroyIDL_Function(parent_t *Parent)
  228. macro DestroyIDL_Function Parent
  229. {
  230.         pushd Parent
  231.         call [imp_DestroyIDL_Function]
  232.         add eso,1*4
  233. }
  234. ;SetTimerCallbackForFunction(parent_t *parent_window,int time_tick,void *func,void *func_data)
  235. macro SetTimerCallbackForFunction parent_window,time_tick,func,func_data
  236. {
  237.         pushd func_data
  238.         pushd func
  239.         pushd time_tick
  240.         pushd parent_window
  241.         call [imp_SetTimerCallbackForFunction]
  242.         add esp,4*4
  243. }
  244. ;DestroyTimerCallbackForFunction(gui_timer_t *timer)
  245. macro DestroyTimerCallbackForFunction timer
  246. {
  247.         pushd timer
  248.         call [imp_DestroyTimerCallbackForFunction]
  249.         add esp,1*4
  250. }
  251. ;SetCallbackFunctionForEvent)(parent_t *parent_window,int event_type,void *func,void *func_data)
  252. macro SetCallbackFunctionForEvent parent_window,event_type,func,func_data
  253. {
  254.         pushd func_data
  255.         pushd func
  256.         pushd event_type
  257.         pushd parent_window
  258.         call [imp_SetCallbackFunctionForEvent]
  259.         add esp,4*4
  260. }
  261. ;DestroyCallbackFunctionForEvent(gui_callbackevent_t *callback_event)
  262. macro DestroyCallbackFunctionForEvent callback_event
  263. {
  264.         pushd callback_event
  265.         call [imp_DestroyCallbackFunctionForEvent]
  266.         add esp,1*4
  267. }
  268. ;CreateButton(gui_button_data_t *info_for_control)
  269. macro CreateButton info_for_control
  270. {
  271.         pushd info_for_control
  272.         call [imp_CreateButton]
  273.         add esp,1*4
  274. }
  275. ;CreateButtonWithText(gui_button_data_t *info,char *txt)
  276. macro CreateButtonWithText info,txt
  277. {
  278.         pushd txt
  279.         pushd info
  280.         call [imp_CreateButtonWithText]
  281.         add esp,2*4
  282. }
  283. ;CreateProgressBar(gui_progress_bar_data_t *info_for_control)
  284. macro CreateProgressBar info_for_control
  285. {
  286.         pushd info_for_control
  287.         call [imp_CreateProgressBar]
  288.         add esp,1*4
  289. }
  290. ;SetProgressBarPulse)(gui_progress_bar_t *ProgressBar,int time_update)
  291. macro SetProgressBarPulse ProgressBar,time_update
  292. {
  293.         pushd time_update
  294.         pushd ProgressBar
  295.         call [imp_SetProgressBarPulse]
  296.         add esp,2*4
  297. }
  298. ;ProgressBarSetText(gui_progress_bar_t *pbar,char *txt)
  299. macro ProgressBarSetText pbar,txt
  300. {
  301.         pushd txt
  302.         pushd pbar
  303.         call [imp_ProgressBarSetText]
  304.         add esp,2*4
  305. }
  306. ;ProgressBarGetText(gui_progress_bar_t *pbar)
  307. macro ProgressBarGetText pbar
  308. {
  309.         pushd pbar
  310.         call [imp_ProgressBarGetText]
  311.         add esp,1*4
  312. }
  313. ;CreateHorizontalScrollBar(gui_scroll_bar_data_t *info_for_control)
  314. macro CreateHorizontalScrollBar info_for_control
  315. {
  316.         pushd info_for_control
  317.         call [imp_CreateHorizontalScrollBar]
  318.         add esp,1*4
  319. }
  320. ;CreateVerticalScrollBar(gui_scroll_bar_data_t *info_for_control)
  321. macro CreateVerticalScrollBar info_for_control
  322. {
  323.         pushd info_for_control
  324.         call [imp_CreateVerticalScrollBar]
  325.         add esp,1*4
  326. }
  327. ;CreateScrolledWindow)(gui_scrolled_window_data_t *info_for_control)
  328. macro CreateScrolledWindow info_for_control
  329. {
  330.         pushd info_for_control
  331.         call [imp_CreateScrolledWindow]
  332.         add esp,1*4
  333. }
  334. ;ScrolledWindowPackControls(gui_scrolled_window_t *parent,void *Control)
  335. macro ScrolledWindowPackControls parent,Control
  336. {
  337.         pushd Control
  338.         pushd parent
  339.         call [imp_ScrolledWindowPackControls]
  340.         add esp,2*4
  341. }
  342. ;CreateImage(gui_image_data_t *info_for_control)
  343. macro CreateImage info_for_control
  344. {
  345.         pushd info_for_control
  346.         call [imp_CreateImage]
  347.         add esp,1*4
  348. }
  349. ;CreateText(gui_text_data_t *info_for_control)
  350. macro CreateText info_for_control
  351. {
  352.         pushd info_for_control
  353.         call [imp_CreateText]
  354.         add esp,1*4
  355. }
  356. ;TextBackgroundOn(gui_text_t *Text)
  357. macro TextBackgroundOn Txt
  358. {
  359.         pushd Txt
  360.         call [imp_TextBackgroundOn]
  361.         add esp,1*4
  362. }
  363. ;TextBackgroundOff(gui_text_t *Text)
  364. macro TextBackgroundOff Txt
  365. {
  366.         pushd Txt
  367.         call [imp_TextBackgroundOff]
  368.         add esp,1*4
  369. }
  370. ;LoadFont(char *fullfontname)
  371. macro LoadFont fullfontname
  372. {
  373.         pushd fullfontname
  374.         call [imp_LoadFont]
  375.         add esp,1*4
  376. }
  377. ;FreeFont(font_t *font)
  378. macro FreeFont font
  379. {
  380.         pushd font
  381.         call [imp_FreeFont]
  382.         add esp,1*4
  383. }
  384.  
  385. ;----------------------------------------------------------------
  386. ;----------------------debug output------------------------------
  387. ;----------------------------------------------------------------
  388. ;IN
  389. ;esi=stirng
  390. align 4
  391. gui_ksys_debug_out_str:
  392.  
  393.        pushad
  394.        mov eax,63
  395.        mov ebx,1
  396.  
  397.        next_simbol_print:
  398.  
  399.               xor edx,edx
  400.               mov dl,[esi]
  401.               test dl,dl
  402.               jz exit_print_str
  403.  
  404.               cmp dl,10
  405.               jne no_new_line
  406.                      mov ecx,13
  407.                      int 0x40
  408.               no_new_line:
  409.  
  410.               xor ecx,ecx
  411.               mov cl, dl
  412.               int 0x40
  413.  
  414.               add esi,1
  415.  
  416.        jmp next_simbol_print
  417.  
  418.        exit_print_str:
  419.        popad
  420.  
  421.        ret
  422.  
  423. ;-------------------------------------------------------------------
  424. ;-------------------get proc from export table----------------------
  425. ;-------------------------------------------------------------------
  426. ;INPUT
  427. ;ebx=pointer to export table
  428. ;esi=pointer to function name
  429. ;OUTPUT
  430. ;eax=pointer to function
  431. align 4
  432. gui_ksys_cofflib_getproc:
  433.  
  434.         next_name_check:
  435.  
  436.         mov ecx,[ebx]
  437.  
  438.         test ecx,ecx
  439.         jz end_export
  440.  
  441.                 push esi
  442.                 ;cmp export string with name
  443.                 next_simbol_check:
  444.  
  445.                 xor eax,eax
  446.                 mov al,[ecx];load byte of func name from export
  447.                 xor edx,edx
  448.                 mov dl,[esi]
  449.  
  450.                 cmp al,dl
  451.                 jne exit_check_simbol
  452.                 test al,al
  453.                 jne no_end_string
  454.                         mov eax,[ebx+4]
  455.                         pop esi
  456.                         jmp end_export
  457.                  no_end_string:
  458.  
  459.                 add ecx,1
  460.                 add esi,1
  461.                 jmp next_simbol_check
  462.  
  463.                 exit_check_simbol:
  464.                 pop esi
  465.  
  466.         add ebx,8
  467.         jmp next_name_check
  468.  
  469.         end_export:
  470.  
  471.         ret
  472.  
  473. ;-------------------------------------------------------------------
  474. ;-----------------------Link libGUI---------------------------------
  475. ;-------------------------------------------------------------------
  476.  
  477. link_libGUI:
  478.  
  479.         mov edi,eax;save export table pointer
  480.         mov esi,libGUI_imp
  481.  
  482.         next_libGUI_func_link:
  483.  
  484.                 push esi
  485.                 mov eax,esi
  486.                 mov esi,[eax]
  487.  
  488.                 mov ebx,edi;pointer to export table
  489.                 call gui_ksys_cofflib_getproc
  490.                 pop esi
  491.                 mov [esi],eax ;func proc
  492.  
  493.         add esi,4
  494.         cmp [esi],dword 0
  495.         jne next_libGUI_func_link
  496.  
  497.         ret
  498.  
  499. ;////////////////////////////////////////////////////////////////
  500. ;//                     Load libGUI
  501. ;////////////////////////////////////////////////////////////////
  502. ;IN
  503. ;pointer to path or
  504. LoadLibGUI:
  505.  
  506.         push eax
  507.         push ebx
  508.         push ecx
  509.         push edx
  510.         push esi
  511.         push edi
  512.  
  513.         mov ecx,[esp+28];path
  514.  
  515.         test ecx,ecx
  516.         jnz have_other_path
  517.                 mov ecx,sys_libGUI_path
  518.         have_other_path:
  519.  
  520.         ;try to load libGUI library
  521.         mov eax,68
  522.         mov ebx,19
  523.         int 0x40
  524.  
  525.         test eax,eax
  526.         jnz libGUI_loaded_successfully
  527.                 mov esi,message_cant_load_lib
  528.                 call gui_ksys_debug_out_str
  529.  
  530.                 xor eax,eax
  531.                 dec eax
  532.                 int 0x40;system exit program
  533.         libGUI_loaded_successfully:
  534.  
  535.         call link_libGUI
  536.  
  537.         mov eax,68
  538.         mov ebx,11
  539.         int 0x40
  540.  
  541.         InitLibGUI
  542.  
  543.         test eax,eax
  544.         jz libGUI_initialized_successfully
  545.                 mov esi,message_cant_initialize_lib
  546.                 call gui_ksys_debug_out_str
  547.  
  548.                 xor eax,eax
  549.                 dec eax
  550.                 int 0x40;system exit program
  551.         libGUI_initialized_successfully:
  552.  
  553.         pop edi
  554.         pop esi
  555.         pop edx
  556.         pop ecx
  557.         pop ebx
  558.         pop eax
  559.  
  560.         ret 4
  561.  
  562. ;////////////////////////////////////////////////////////////////
  563. ;//                     font type structure
  564. ;////////////////////////////////////////////////////////////////
  565. struc font_t
  566. {
  567.  .fnt_draw                      rd 1;pointer
  568.  .fnt_unpacker                  rd 1;pointer
  569.  .fnt_fd                        rd 1;pointer
  570.  .fnt_bk                        rd 1;pointer
  571.  .sizex                         rd 1;
  572.  .sizey                         rd 1;
  573.  .size                          rd 1;
  574.  .encoding_type                 rd 1;
  575.  .font                          rd 1;pointer
  576.  .fnt_name                      rd 1;pointer
  577.  .type                          rd 1;
  578.  .flags                         rd 1;
  579. }
  580.  
  581. ;////////////////////////////////////////////////////////////////
  582. ;//                    header of parent of control
  583. ;////////////////////////////////////////////////////////////////
  584. struc parent_t
  585. {
  586.  .ctrl_proc                      rd 1;pointer
  587.  .ctrl_fd                        rd 1;pointer
  588.  .ctrl_bk                        rd 1;pointer
  589.  .child_fd                       rd 1;pointer
  590.  .child_bk                       rd 1;pointer
  591.  .parent                         rd 1;pointer
  592.  .main_parent                    rd 1;pointer
  593.  .ctrl_x                         rd 1;
  594.  .ctrl_y                         rd 1;
  595.  .ctrl_sizex                     rd 1;
  596.  .ctrl_sizey                     rd 1;
  597.  .ctrl_ID                        rd 1;
  598.  .active_control_for_keys        rd 1;pointer
  599.  .active_control_for_mouse       rd 1;pointer
  600.  .callback                       rd 1;pointer
  601.  .finition                       rd 1;pointer
  602.  .timer                          rd 1;pointer
  603.  .flags                          rd 1;
  604.  
  605.  .control_for_callback_function  rd 1;array of pointers
  606.  .callback_for_control_callback  rd 1;array of pointers
  607.  .number_callbacks               rd 1;
  608.  .global_active_control_for_keys rd 1;pointer
  609.  .message                        rd 1;pointer
  610.  .timer_bk                       rd 1;pointer
  611.  .timer_fd                       rd 1;pointer
  612.  .number_timers_for_controls     rd 1;
  613.  .calev_bk                       rd 1;pointer
  614.  .calev_fd                       rd 1;pointer
  615.  .IDL_func                       rd 1;pointer
  616.  .IDL_func_data                  rd 1;pointer
  617. }
  618.  
  619. ;////////////////////////////////////////////////////////////////
  620. ;//                     header of control
  621. ;////////////////////////////////////////////////////////////////
  622. struc header_t
  623. {
  624.  .ctrl_proc                     rd 1;pointer
  625.  .ctrl_fd                       rd 1;pointer
  626.  .ctrl_bk                       rd 1;pointer
  627.  .child_fd                      rd 1;pointer
  628.  .child_bk                      rd 1;pointer
  629.  .parent                        rd 1;pointer
  630.  .main_parent                   rd 1;pointer
  631.  .ctrl_x                        rd 1;
  632.  .ctrl_y                        rd 1;
  633.  .ctrl_sizex                    rd 1;
  634.  .ctrl_sizey                    rd 1;
  635.  .ctrl_ID                       rd 1;
  636.  .active_control_for_keys       rd 1;pointer
  637.  .active_control_for_mouse      rd 1;pointer
  638.  .callback                      rd 1;pointer
  639.  .finition                      rd 1;pointer
  640.  .timer                         rd 1;pointer
  641.  .flags                         rd 1;
  642. }
  643.  
  644. ;////////////////////////////////////////////////////////////////
  645. ;//      callback structure for callback function of control
  646. ;////////////////////////////////////////////////////////////////
  647. struc gui_callback_t
  648. {
  649.  .clb_bk                        rd 1;pointer
  650.  .clb_fd                        rd 1;pointer
  651.  .clb_control                   rd 1;pointer
  652.  .func                          rd 1;pointer
  653.  .func_data                     rd 1;pointer
  654.  .connect_event                 rd 1;
  655.  .flags                         rd 1;
  656. }
  657.  
  658. ;////////////////////////////////////////////////////////////////
  659. ;//                         timer
  660. ;////////////////////////////////////////////////////////////////
  661. struc gui_timer_t
  662. {
  663.  .tmr_bk                        rd 1;pointer
  664.  .tmr_fd                        rd 1;pointer
  665.  .tmr_parent                    rd 1;pointer
  666.  .func                          rd 1;pointer
  667.  .func_data                     rd 1;pointer
  668.  .last_time                     rd 1;
  669.  .time_tick                     rd 1;
  670.  .flags                         rd 1;
  671. }
  672.  
  673. ;////////////////////////////////////////////////////////////////
  674. ;//               structure for callback events
  675. ;////////////////////////////////////////////////////////////////
  676. struc gui_callbackevent_t
  677. {
  678.  .calev_bk                      rd 1;pointer
  679.  .calev_fd                      rd 1;pointer
  680.  .calev_parent                  rd 1;pointer
  681.  .func                          rd 1;pointer
  682.  .func_data                     rd 1;pointer
  683.  .event_type                    rd 1;
  684. }
  685.  
  686. ;////////////////////////////////////////////////////////////////
  687. ;//               type of data - structure message
  688. ;////////////////////////////////////////////////////////////////
  689. struc gui_message_t
  690. {
  691.  .type                          rd 1;
  692.  .arg1                          rd 1;
  693.  .arg2                          rd 1;
  694.  .arg3                          rd 1;
  695.  .arg4                          rd 1;
  696. }
  697.  
  698. ;////////////////////////////////////////////////////////////////
  699. ;//                         button
  700. ;////////////////////////////////////////////////////////////////
  701.  
  702. struc gui_button_t
  703. {
  704.  .ctrl_proc                     rd 1;pointer
  705.  .ctrl_fd                       rd 1;pointer
  706.  .ctrl_bk                       rd 1;pointer
  707.  .child_fd                      rd 1;pointer
  708.  .child_bk                      rd 1;pointer
  709.  .parent                        rd 1;pointer
  710.  .main_parent                   rd 1;pointer
  711.  .ctrl_x                        rd 1;
  712.  .ctrl_y                        rd 1;
  713.  .ctrl_sizex                    rd 1;
  714.  .ctrl_sizey                    rd 1;
  715.  .ctrl_ID                       rd 1;
  716.  .active_control_for_keys       rd 1;pointer
  717.  .active_control_for_mouse      rd 1;pointer
  718.  .callback                      rd 1;pointer
  719.  .finition                      rd 1;pointer
  720.  .timer                         rd 1;pointer
  721.  .flags                         rd 1;
  722.  
  723.  .btn_flags                     rb 1;
  724. }
  725.  
  726. ;information for creating control Button
  727.  
  728. struc gui_button_data_t
  729. {
  730.  .x                             rd 1;
  731.  .y                             rd 1;
  732.  .wight                         rd 1;
  733.  .height                        rd 1;
  734. }
  735.  
  736. ;////////////////////////////////////////////////////////////////
  737. ;//                      scroll bar
  738. ;////////////////////////////////////////////////////////////////
  739.  
  740. struc gui_scroll_bar_t
  741. {
  742.  .ctrl_proc                     rd 1;pointer
  743.  .ctrl_fd                       rd 1;pointer
  744.  .ctrl_bk                       rd 1;pointer
  745.  .child_fd                      rd 1;pointer
  746.  .child_bk                      rd 1;pointer
  747.  .parent                        rd 1;pointer
  748.  .main_parent                   rd 1;pointer
  749.  .ctrl_x                        rd 1;
  750.  .ctrl_y                        rd 1;
  751.  .ctrl_sizex                    rd 1;
  752.  .ctrl_sizey                    rd 1;
  753.  .ctrl_ID                       rd 1;
  754.  .active_control_for_keys       rd 1;pointer
  755.  .active_control_for_mouse      rd 1;pointer
  756.  .callback                      rd 1;pointer
  757.  .finition                      rd 1;pointer
  758.  .timer                         rd 1;pointer
  759.  .flags                         rd 1;
  760.  
  761.  .ruller_size                   rd 1;float
  762.  .ruller_pos                    rd 1;float
  763.  .ruller_step                   rd 1;float
  764.  .scb_flags                     rb 1;
  765. }
  766.  
  767. struc gui_scroll_bar_data_t
  768. {
  769.  .x                             rd 1;
  770.  .y                             rd 1;
  771.  .wight                         rd 1;
  772.  .height                        rd 1;
  773.  .ruller_size                   rd 1;float
  774.  .ruller_pos                    rd 1;float
  775.  .ruller_step                   rd 1;float
  776. }
  777.  
  778. ;////////////////////////////////////////////////////////////////
  779. ;//                     progressbar
  780. ;////////////////////////////////////////////////////////////////
  781.  
  782. struc gui_progress_bar_t
  783. {
  784.  .ctrl_proc                     rd 1;pointer
  785.  .ctrl_fd                       rd 1;pointer
  786.  .ctrl_bk                       rd 1;pointer
  787.  .child_fd                      rd 1;pointer
  788.  .child_bk                      rd 1;pointer
  789.  .parent                        rd 1;pointer
  790.  .main_parent                   rd 1;pointer
  791.  .ctrl_x                        rd 1;
  792.  .ctrl_y                        rd 1;
  793.  .ctrl_sizex                    rd 1;
  794.  .ctrl_sizey                    rd 1;
  795.  .ctrl_ID                       rd 1;
  796.  .active_control_for_keys       rd 1;pointer
  797.  .active_control_for_mouse      rd 1;pointer
  798.  .callback                      rd 1;pointer
  799.  .finition                      rd 1;pointer
  800.  .timer                         rd 1;pointer
  801.  .flags                         rd 1;
  802.  
  803.  .progress                      rd 1;float
  804.  .prb_flags                     rb 1;
  805. }
  806.  
  807. struc gui_progress_bar_data_t
  808. {
  809.  .x                             rd 1;
  810.  .y                             rd 1;
  811.  .wight                         rd 1;
  812.  .height                        rd 1;
  813.  .progress                      rd 1;float
  814. }
  815.  
  816. ;////////////////////////////////////////////////////////////////
  817. ;//                  scrolled window
  818. ;////////////////////////////////////////////////////////////////
  819.  
  820. struc gui_scrolled_window_t
  821. {
  822.  .ctrl_proc                     rd 1;pointer
  823.  .ctrl_fd                       rd 1;pointer
  824.  .ctrl_bk                       rd 1;pointer
  825.  .child_fd                      rd 1;pointer
  826.  .child_bk                      rd 1;pointer
  827.  .parent                        rd 1;pointer
  828.  .main_parent                   rd 1;pointer
  829.  .ctrl_x                        rd 1;
  830.  .ctrl_y                        rd 1;
  831.  .ctrl_sizex                    rd 1;
  832.  .ctrl_sizey                    rd 1;
  833.  .ctrl_ID                       rd 1;
  834.  .active_control_for_keys       rd 1;pointer
  835.  .active_control_for_mouse      rd 1;pointer
  836.  .callback                      rd 1;pointer
  837.  .finition                      rd 1;pointer
  838.  .timer                         rd 1;pointer
  839.  .flags                         rd 1;
  840.  
  841.  .virtual_x                     rd 1;
  842.  .virtual_y                     rd 1;
  843.  .virtual_sizex                 rd 1;
  844.  .virtual_sizey                 rd 1;
  845.  .virtual_controls_x            rd 1;pointer
  846.  .virtual_controls_y            rd 1;pointer
  847.  .number_virtual_controls       rd 1;
  848.  .scroll_arrea_sizex            rd 1;
  849.  .scroll_arrea_sizey            rd 1;
  850.  .horizontal_scroll             rd 1;pointer
  851.  .vertical_scroll               rd 1;pointer
  852.  .scw_flags                     rb 1;
  853. }
  854.  
  855. struc gui_scrolled_window_data_t
  856. {
  857.  .x                             rd 1;
  858.  .y                             rd 1;
  859.  .wight                         rd 1;
  860.  .height                        rd 1;
  861. }
  862.  
  863. ;////////////////////////////////////////////////////////////////
  864. ;//                           image
  865. ;////////////////////////////////////////////////////////////////
  866.  
  867. struc gui_image_t
  868. {
  869.  .ctrl_proc                     rd 1;pointer
  870.  .ctrl_fd                       rd 1;pointer
  871.  .ctrl_bk                       rd 1;pointer
  872.  .child_fd                      rd 1;pointer
  873.  .child_bk                      rd 1;pointer
  874.  .parent                        rd 1;pointer
  875.  .main_parent                   rd 1;pointer
  876.  .ctrl_x                        rd 1;
  877.  .ctrl_y                        rd 1;
  878.  .ctrl_sizex                    rd 1;
  879.  .ctrl_sizey                    rd 1;
  880.  .ctrl_ID                       rd 1;
  881.  .active_control_for_keys       rd 1;pointer
  882.  .active_control_for_mouse      rd 1;pointer
  883.  .callback                      rd 1;pointer
  884.  .finition                      rd 1;pointer
  885.  .timer                         rd 1;pointer
  886.  .flags                         rd 1;
  887.  
  888.  .bits_per_pixel                rb 1;
  889.  .bytes_per_pixel               rb 1;
  890.  .img                           rd 1;pointer
  891. }
  892.  
  893.  
  894. struc gui_image_data_t
  895. {
  896.  .x                             rd 1;
  897.  .y                             rd 1;
  898.  .wight                         rd 1;
  899.  .height                        rd 1;
  900.  .bits_per_pixel                rb 1;
  901. }
  902.  
  903. ;////////////////////////////////////////////////////////////////
  904. ;//                         text
  905. ;////////////////////////////////////////////////////////////////
  906.  
  907. struc gui_text_t
  908. {
  909.  .ctrl_proc                     rd 1;pointer
  910.  .ctrl_fd                       rd 1;pointer
  911.  .ctrl_bk                       rd 1;pointer
  912.  .child_fd                      rd 1;pointer
  913.  .child_bk                      rd 1;pointer
  914.  .parent                        rd 1;pointer
  915.  .main_parent                   rd 1;pointer
  916.  .ctrl_x                        rd 1;
  917.  .ctrl_y                        rd 1;
  918.  .ctrl_sizex                    rd 1;
  919.  .ctrl_sizey                    rd 1;
  920.  .ctrl_ID                       rd 1;
  921.  .active_control_for_keys       rd 1;pointer
  922.  .active_control_for_mouse      rd 1;pointer
  923.  .callback                      rd 1;pointer
  924.  .finition                      rd 1;pointer
  925.  .timer                         rd 1;pointer
  926.  .flags                         rd 1;
  927.  
  928.  .font                          rd 1;pointer
  929.  .color                         rd 1;
  930.  .background_color              rd 1;
  931.  .text                          rd 1;pointer
  932.  .txt_flags                     rb 1;
  933. }
  934.  
  935. struc gui_text_data_t
  936. {
  937.  .x                             rd 1;
  938.  .y                             rd 1;
  939.  .font                          rd 1;pointer
  940.  .color                         rd 1;
  941.  .background_color              rd 1;
  942.  .background                    rb 1;
  943.  .text                          rd 1;pointer
  944. }
  945.  
  946. ;//**********************************************************************
  947. ;//                   libGUI service functions
  948. ;//**********************************************************************
  949.  
  950. ;default system path to libGUI
  951. sys_libGUI_path                         db '/sys/lib/libGUI.obj',0
  952. message_cant_load_lib                   db 'cant load lib',13,10,0
  953. message_cant_initialize_lib             db 'cant initialize libGUI',13,10,0
  954.  
  955. szLibGUIversion                         db 'LibGUIversion',0
  956. szInitLibGUI                            db 'InitLibGUI',0
  957. szLibGUImain                            db 'LibGUImain',0
  958. szQuitLibGUI                            db 'QuitLibGUI',0
  959.  
  960. szCreateWindow                          db 'CreateWindow',0
  961. szSetWindowSizeRequest                  db 'SetWindowSizeRequest',0
  962.  
  963. szPackControls                          db 'PackControls',0
  964. szDestroyControl                        db 'DestroyControl',0
  965. szSetControlSizeRequest                 db 'SetControlSizeRequest',0
  966. szGetControlSizeX                       db 'GetControlSizeX',0
  967. szGetControlSizeY                       db 'GetControlSizeY',0
  968. szSetControlNewPosition                 db 'SetControlNewPosition',0
  969. szGetControlPositionX                   db 'GetControlPositionX',0
  970. szGetControlPositionY                   db 'GetControlPositionY',0
  971. szSetFocuse                             db 'SetFocuse',0
  972. szRedrawControl                         db 'RedrawControl',0
  973. szSpecialRedrawControl                  db 'SpecialRedrawControl',0
  974.  
  975. szSetCallbackFunction                   db 'SetCallbackFunction',0
  976. szBlockCallbackFunction                 db 'BlockCallbackFunction',0
  977. szUnblockCallbackFunction               db 'UnblockCallbackFunction',0
  978.  
  979. szSetIDL_Function                       db 'SetIDL_Function',0
  980. szDestroyIDL_Function                   db 'DestroyIDL_Function',0
  981.  
  982. szSetTimerCallbackForFunction           db 'SetTimerCallbackForFunction',0
  983. szDestroyTimerCallbackForFunction       db 'DestroyTimerCallbackForFunction',0
  984.  
  985. szSetCallbackFunctionForEvent           db 'SetCallbackFunctionForEvent',0
  986. szDestroyCallbackFunctionForEvent       db 'DestroyCallbackFunctionForEvent',0
  987.  
  988. szCreateButton                          db 'CreateButton',0
  989. szCreateButtonWithText                  db 'CreateButtonWithText',0
  990.  
  991. szCreateProgressBar                     db 'CreateProgressBar',0
  992. szSetProgressBarPulse                   db 'SetProgressBarPulse',0
  993. szProgressBarSetText                    db 'ProgressBarSetText',0
  994. szProgressBarGetText                    db 'ProgressBarGetText',0
  995.  
  996. szCreateHorizontalScrollBar             db 'CreateHorizontalScrollBar',0
  997. szCreateVerticalScrollBar               db 'CreateVerticalScrollBar',0
  998.  
  999. szCreateScrolledWindow                  db 'CreateScrolledWindow',0
  1000. szScrolledWindowPackControls            db 'ScrolledWindowPackControls',0
  1001.  
  1002. szCreateImage                           db 'CreateImage',0
  1003.  
  1004. szCreateText                            db 'CreateText',0
  1005. szTextBackgroundOn                      db 'TextBackgroundOn',0
  1006. szTextBackgroundOff                     db 'TextBackgroundOff',0
  1007.  
  1008. szLoadFont                              db 'LoadFont',0
  1009. szFreeFont                              db 'FreeFont',0
  1010.  
  1011. libGUI_imp:
  1012.  
  1013. imp_LibGUIversion                           dd szLibGUIversion
  1014. imp_InitLibGUI                              dd szInitLibGUI
  1015. imp_LibGUImain                              dd szLibGUImain
  1016. imp_QuitLibGUI                              dd szQuitLibGUI
  1017.  
  1018. imp_CreateWindow                            dd szCreateWindow
  1019. imp_SetWindowSizeRequest                    dd szSetWindowSizeRequest
  1020.  
  1021. imp_PackControls                            dd szPackControls
  1022. imp_DestroyControl                          dd szDestroyControl
  1023. imp_SetControlSizeRequest                   dd szSetControlSizeRequest
  1024. imp_GetControlSizeX                         dd szGetControlSizeX
  1025. imp_GetControlSizeY                         dd szGetControlSizeY
  1026. imp_SetControlNewPosition                   dd szSetControlNewPosition
  1027. imp_GetControlPositionX                     dd szGetControlPositionX
  1028. imp_GetControlPositionY                     dd szGetControlPositionY
  1029. imp_SetFocuse                               dd szSetFocuse
  1030. imp_RedrawControl                           dd szRedrawControl
  1031. imp_SpecialRedrawControl                    dd szSpecialRedrawControl
  1032.  
  1033. imp_SetCallbackFunction                     dd szSetCallbackFunction
  1034. imp_BlockCallbackFunction                   dd szBlockCallbackFunction
  1035. imp_UnblockCallbackFunction                 dd szUnblockCallbackFunction
  1036.  
  1037. imp_SetIDL_Function                         dd szSetIDL_Function
  1038. imp_DestroyIDL_Function                     dd szDestroyIDL_Function
  1039.  
  1040. imp_SetTimerCallbackForFunction             dd szSetTimerCallbackForFunction
  1041. imp_DestroyTimerCallbackForFunction         dd szDestroyTimerCallbackForFunction
  1042.  
  1043. imp_SetCallbackFunctionForEvent             dd szSetCallbackFunctionForEvent
  1044. imp_DestroyCallbackFunctionForEvent         dd szDestroyCallbackFunctionForEvent
  1045.  
  1046. imp_CreateButton                            dd szCreateButton
  1047. imp_CreateButtonWithText                    dd szCreateButtonWithText
  1048.  
  1049. imp_CreateProgressBar                       dd szCreateProgressBar
  1050. imp_SetProgressBarPulse                     dd szSetProgressBarPulse
  1051. imp_ProgressBarSetText                      dd szProgressBarSetText
  1052. imp_ProgressBarGetText                      dd szProgressBarGetText
  1053.  
  1054. imp_CreateHorizontalScrollBar               dd szCreateHorizontalScrollBar
  1055. imp_CreateVerticalScrollBar                 dd szCreateVerticalScrollBar
  1056.  
  1057. imp_CreateScrolledWindow                    dd szCreateScrolledWindow
  1058. imp_ScrolledWindowPackControls              dd szScrolledWindowPackControls
  1059.  
  1060. imp_CreateImage                             dd szCreateImage
  1061.  
  1062. imp_CreateText                              dd szCreateText
  1063. imp_TextBackgroundOn                        dd szTextBackgroundOn
  1064. imp_TextBackgroundOff                       dd szTextBackgroundOff
  1065.  
  1066. imp_LoadFont                                dd szLoadFont
  1067. imp_FreeFont                                dd szFreeFont
  1068.  
  1069.                                             dd 0
  1070.  
  1071.