Subversion Repositories Kolibri OS

Rev

Rev 1660 | Go to most recent revision | 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.         push    dword check4
  72.         call    [init_checkbox]
  73.  
  74.         push    dword check5
  75.         call    [init_checkbox]
  76.  
  77.         push    dword check6
  78.         call    [init_checkbox]
  79.  
  80.        
  81. window:
  82.         call draw_window                ;ïåðâîíà÷àëüíî íåîáõîäèìî íàðèñîâàòü îêíî
  83. align 4
  84. still:                          ;îñíîâíîé îáðàáîò÷èê
  85.         mcall   10              ;Îæèäàòü ñîáûòèÿ
  86.         dec  eax
  87.         jz   window
  88.         dec  eax
  89.         jz   key
  90.         dec  eax
  91.         jz   button
  92.  
  93.         push    dword check1
  94.         call    [check_box_mouse]
  95.  
  96.         push    dword check2
  97.         call    [check_box_mouse]
  98.  
  99.         push    dword check3
  100.         call    [check_box_mouse]
  101.  
  102.  
  103.         push    dword check4
  104.         call    [check_box_mouse]
  105.  
  106.         push    dword check5
  107.         call    [check_box_mouse]
  108.  
  109.         push    dword check6
  110.         call    [check_box_mouse]
  111.  
  112.  
  113.         jmp still    ;åñëè íè÷åãî èç ïåðå÷èñëåííîãî òî ñíîâà â öèêë
  114. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115. button:
  116.         mcall   17      ;ïîëó÷èòü èäåíòèôèêàòîð íàæàòîé êëàâèøè
  117.         test ah,ah      ;åñëè â ah 0, òî ïåðåéòè íà îáðàáîò÷èê ñîáûòèé still
  118.         jz  still
  119. exit:   mcall   -1
  120. key:
  121.         mcall   2       ;çàãðóçèì çíà÷åíèå 2 â ðåãèñòîð eax è ïîëó÷èì êîä íàæàòîé êëàâèøè
  122.  
  123.         jmp still
  124.  
  125. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  126. align 4
  127. draw_window:            ;ðèñîâàíèå îêíà ïðèëîæåíèÿ
  128.         mcall   12,1
  129.         mcall   0,(50*65536+390),(30*65536+200),0x33AABBCC,0x805080DD,hed
  130.  
  131.         push    dword check1
  132.         call    [check_box_draw]
  133.  
  134.         push    dword check2
  135.         call    [check_box_draw]
  136.  
  137.         push    dword check3
  138.         call    [check_box_draw]
  139.  
  140.         push    dword check4
  141.         call    [check_box_draw]
  142.  
  143.         push    dword check5
  144.         call    [check_box_draw]
  145.  
  146.         push    dword check6
  147.         call    [check_box_draw]
  148.  
  149.  
  150.         mcall   12,2
  151.         ret
  152. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  153. ;DATA äàííûå
  154. ;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
  155. system_path      db '/sys/lib/'
  156. library_name     db 'box_lib.obj',0
  157. ; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
  158. ;system_path      db '/sys/lib/box_lib.obj',0
  159. ;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
  160. ;library_name     db 'box_lib.obj',0
  161. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  162.  
  163. err_message_found_lib   db 'Sorry I cannot load library box_lib.obj',0
  164. head_f_i:
  165. head_f_l                db 'System error',0
  166. err_message_import      db 'Error on load import library box_lib.obj',0
  167.  
  168. myimport:  
  169.  
  170. init_checkbox   dd      aInit_checkbox
  171. check_box_draw  dd      aCheck_box_draw
  172. check_box_mouse dd      aCheck_box_mouse
  173. version_ch      dd      aVersion_ch
  174.                 dd      0,0
  175.  
  176.  
  177. aInit_checkbox   db 'init_checkbox2',0
  178. aCheck_box_draw  db 'check_box_draw2',0
  179. aCheck_box_mouse db 'check_box_mouse2',0
  180. aVersion_ch      db 'version_ch2',0
  181. ;---------------------------------------------------------------------
  182. check1 check_box2 (10 shl 16 + 12),(10 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en
  183. check2 check_box2 (10 shl 16 + 22),(25 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2
  184. check3 check_box2 (10 shl 16 + 12),(40 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3
  185. check4 check_box2 (10 shl 16 + 12),(70 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text4,ch_flag_top
  186. check5 check_box2 (10 shl 16 + 12),(100 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text5,ch_flag_middle
  187. check6 check_box2 (10 shl 16 + 12),(130 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text6,ch_flag_bottom
  188. ;---------------------------------------------------------------------
  189. hed             db 'CheckBox Exemples <Lrz> date 15.10.2010',0
  190. hed_end:
  191. ;---------------------------------------------------------------------
  192. check_text      db 'First checkbox, set flag ch_flag_en',0
  193. check_text2     db 'Second checkbox,not set any flag',0
  194. check_text3     db 'Number 3 checkbox, not set any flag',0
  195. check_text4     db 'Set flag is ch_flag_top',0
  196. check_text5     db 'Set flag is ch_flag_middle',0
  197. check_text6     db 'Set flag is ch_flag_bottom',0
  198. ;---------------------------------------------------------------------
  199. MEM_END:
  200. cur_dir_path    rb 1024
  201. library_path    rb 1024
  202.                 rb 1024         ;for stack
  203. PRIL_END:
  204.  
  205.  
  206.