Subversion Repositories Kolibri OS

Rev

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

  1. ;*****************************************************************************
  2. ; Example for Box_lib: checkbox
  3. ; Copyright (c) 2007-2010, Alexey  Teplov aka <Lrz>
  4. ; All rights reserved.
  5. ;
  6. ; Redistribution and use in source and binary forms, with or without
  7. ; modification, are permitted provided that the following conditions are met:
  8. ;        * Redistributions of source code must retain the above copyright
  9. ;          notice, this list of conditions and the following disclaimer.
  10. ;        * Redistributions in binary form must reproduce the above copyright
  11. ;          notice, this list of conditions and the following disclaimer in the
  12. ;          documentation and/or other materials provided with the distribution.
  13. ;        * Neither the name of the <organization> nor the
  14. ;          names of its contributors may be used to endorse or promote products
  15. ;          derived from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov ''AS IS'' AND ANY
  18. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  21. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. ;******************************************************************************
  28.  
  29. use32
  30.         org 0x0
  31. ;------------ <head> from kolibrios programm
  32.         db 'MENUET01'
  33.         dd 0x01
  34.         dd START
  35.         dd MEM_END
  36.         dd PRIL_END
  37.         dd PRIL_END
  38.         dd 0x0
  39.         dd cur_dir_path
  40. ;------------ </head>
  41. ;------------ <include macros>
  42. include '../../../../macros.inc'
  43. include '../load_lib.mac'
  44. include 'box_lib.mac'
  45. ;include 'macros.inc'
  46. ;include 'load_lib.mac'
  47. ;------------ </include macros>
  48. ;------------ <init library>
  49. @use_library
  50. ;------------ </init library>
  51. ;---------------------------------------------------------------------
  52. ;--- Start of program ----------------------------------------------
  53. ;---------------------------------------------------------------------
  54. START:
  55.         mcall   40,0x27
  56.  
  57. sys_load_library  library_name, cur_dir_path, library_path, system_path, \
  58. err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
  59.         test    eax,eax
  60.         jnz     exit
  61. ;init checkboxes
  62.         push    dword check1
  63.         call    [init_checkbox]
  64.  
  65.         push    dword check2
  66.         call    [init_checkbox]
  67.  
  68.         push    dword check3
  69.         call    [init_checkbox]
  70.  
  71.        
  72. window:
  73.         call draw_window                ;ïåðâîíà÷àëüíî íåîáõîäèìî íàðèñîâàòü îêíî
  74. align 4
  75. still:                          ;îñíîâíîé îáðàáîò÷èê
  76.         mcall   10              ;Îæèäàòü ñîáûòèÿ
  77.         dec  eax
  78.         jz   window
  79.         dec  eax
  80.         jz   key
  81.         dec  eax
  82.         jz   button
  83.  
  84.         push    dword check1
  85.         call    [check_box_mouse]
  86.  
  87.         push    dword check2
  88.         call    [check_box_mouse]
  89.  
  90.         push    dword check3
  91.         call    [check_box_mouse]
  92.  
  93.  
  94.         jmp still    ;åñëè íè÷åãî èç ïåðå÷èñëåííîãî òî ñíîâà â öèêë
  95. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  96. button:
  97.         mcall   17      ;ïîëó÷èòü èäåíòèôèêàòîð íàæàòîé êëàâèøè
  98.         test ah,ah      ;åñëè â ah 0, òî ïåðåéòè íà îáðàáîò÷èê ñîáûòèé still
  99.         jz  still
  100. exit:   mcall   -1
  101. key:
  102.         mcall   2       ;çàãðóçèì çíà÷åíèå 2 â ðåãèñòîð eax è ïîëó÷èì êîä íàæàòîé êëàâèøè
  103.  
  104.         jmp still
  105.  
  106. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  107. align 4
  108. draw_window:            ;ðèñîâàíèå îêíà ïðèëîæåíèÿ
  109.         mcall   12,1
  110.         mcall   0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
  111.  
  112.         push    dword check1
  113.         call    [check_box_draw]
  114.  
  115.         push    dword check2
  116.         call    [check_box_draw]
  117.  
  118.         push    dword check3
  119.         call    [check_box_draw]
  120.  
  121.  
  122.         mcall   12,2
  123.         ret
  124. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  125. ;DATA äàííûå
  126. ;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
  127. system_path      db '/sys/lib/'
  128. library_name     db 'box_lib.obj',0
  129. ; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
  130. ;system_path      db '/sys/lib/box_lib.obj',0
  131. ;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
  132. ;library_name     db 'box_lib.obj',0
  133. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  134.  
  135. err_message_found_lib   db 'Sorry I cannot load library box_lib.obj',0
  136. head_f_i:
  137. head_f_l                db 'System error',0
  138. err_message_import      db 'Error on load import library box_lib.obj',0
  139.  
  140. myimport:  
  141.  
  142. init_checkbox   dd      aInit_checkbox
  143. check_box_draw  dd      aCheck_box_draw
  144. check_box_mouse dd      aCheck_box_mouse
  145. version_ch      dd      aVersion_ch
  146.                 dd      0,0
  147.  
  148.  
  149. aInit_checkbox   db 'init_checkbox',0
  150. aCheck_box_draw  db 'check_box_draw',0
  151. aCheck_box_mouse db 'check_box_mouse',0
  152. aVersion_ch      db 'version_ch',0
  153. ;---------------------------------------------------------------------
  154. check1 check_box (20 shl 16 + 12),(45 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en
  155. check2 check_box (20 shl 16 + 22),(60 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2
  156. check3 check_box (20 shl 16 + 12),(75 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3
  157. ;---------------------------------------------------------------------
  158. hed             db 'CheckBox Exemples <Lrz> date 12.10.2010',0
  159. hed_end:
  160. ;---------------------------------------------------------------------
  161. check_text      db 'First checkbox',0
  162. check_text2     db 'Second checkbox',0
  163. check_text3     db 'Number 3 checkbox',0
  164. ;---------------------------------------------------------------------
  165. MEM_END:
  166. cur_dir_path    rb 1024
  167. library_path    rb 1024
  168.                 rb 1024         ;for stack
  169. PRIL_END:
  170.  
  171.  
  172.