Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. struct new_button
  2.     x       dw ?
  3.     y       dw ?
  4.     w       dw ?
  5.     h       dw ?
  6.     f       dw ?
  7.     face    dd ?
  8.     frame   dd ?
  9.     event   dd ?
  10. ends
  11.  
  12. button_event_next:
  13.     pusha
  14.     mov    eax,[edit_cnt]
  15.     cmp    eax,4
  16.     je     @f
  17.     inc    eax
  18.     jmp    ben_exit
  19.   @@:
  20.     mov    eax,1
  21.   ben_exit:
  22.     mov    [edit_cnt],eax
  23.     call    draw_edit
  24.     call    list_draw
  25.     popa
  26.     ret
  27.  
  28. button_event_back:
  29.     pusha
  30.     mov    eax,[edit_cnt]
  31.     cmp    eax,1
  32.     je     @f
  33.     dec    eax
  34.     jmp    ben_exit
  35.   @@:
  36.     mov    eax,4
  37.   beb_exit:
  38.     mov    [edit_cnt],eax
  39.     call    draw_edit
  40.     call    list_draw
  41.     popa
  42.     ret
  43.  
  44.  
  45. button_init:
  46.     ;;  nex init ------------
  47.     mov     ax, 36
  48.     mov     [bnext.x],ax
  49.     mov     ax, 8
  50.     mov     [bnext.y],ax
  51.     mov     ax, 26
  52.     mov     [bnext.w],ax
  53.     mov     ax, 19
  54.     mov     [bnext.h],ax
  55.     mov     ax, 0
  56.     mov     [bnext.f],ax
  57.     mov     eax,[sc.btn_face]
  58.     mov     [bnext.face],eax
  59.     mov     eax,[sc.btn_frame]
  60.     mov     [bnext.frame],eax
  61.     mov     eax,button_event_next
  62.     mov     [bnext.event],eax
  63.  
  64.     mov     ax, 7
  65.     mov     [bback.x],ax
  66.     mov     ax, 8
  67.     mov     [bback.y],ax
  68.     mov     ax, 26
  69.     mov     [bback.w],ax
  70.     mov     ax, 19
  71.     mov     [bback.h],ax
  72.     mov     ax, 0
  73.     mov     [bback.f],ax
  74.     mov     eax,[sc.btn_face]
  75.     mov     [bback.face],eax
  76.     mov     eax,[sc.btn_frame]
  77.     mov     [bback.frame],eax
  78.     mov     eax,button_event_back
  79.     mov     [bback.event],eax
  80.     ret
  81.  
  82. button_calc:
  83.     mov     eax, bnext
  84.     call    button_focus
  85.     mov     eax, bback
  86.     call    button_focus
  87.     ret
  88.  
  89. button_focus:
  90.     pusha
  91.     xor     ecx,ecx
  92.     xor     ebx,ebx
  93.     mov     edi,[mouse_x]
  94.     mov     bx, word [eax]
  95.     cmp     ebx,edi
  96.     jg      button_focus_out
  97.     add     bx, word [eax + 4]
  98.     cmp     ebx,edi
  99.     jb      button_focus_out
  100.     mov     edi,[mouse_y]
  101.     mov     bx,[eax + 2]
  102.     cmp     ebx,edi
  103.     jg      button_focus_out
  104.     add     bx,[eax + 6]
  105.     cmp     ebx,edi
  106.     jb      button_focus_out
  107.     ;----
  108.     push    eax
  109.     call    mouse_left
  110.     mov     ecx,[mouse_l]
  111.     cmp     ecx,0
  112.     je      button_focus_set
  113.     xor     ecx,ecx
  114.     mov     [mouse_l],ecx
  115.     call    dword [eax+18]
  116.    
  117.   button_focus_set:
  118.     pop     eax
  119.     ;----
  120.     mov     ecx,1
  121.   button_focus_out:
  122.     mov     word [eax + 8],cx
  123.     popa
  124.     ret
  125.  
  126. button_draw:
  127.     mov     eax, bnext
  128.     call    button_draw_all
  129.     mov     eax, bback
  130.     call    button_draw_all
  131.     ; arrow
  132.     pusha
  133.     mov     eax , 7
  134.     mov     ebx , arrowa
  135.     mov     ecx , 6 shl 16 + 10
  136.     mov     edx , 46 shl 16 + 13
  137.     int     0x40
  138.     mov     ebx , arrowb
  139.     mov     edx , 17 shl 16 + 13
  140.     int     0x40
  141.     popa
  142.     ret
  143.  
  144. button_draw_all:
  145.     pusha
  146.     mov     ebx,[win_slot]
  147.     cmp     ebx,1
  148.     je      @f
  149.     mov     ebx,[sc.btn_inface]
  150.     mov     dword [eax + 10],ebx
  151.     mov     ebx,[sc.btn_inframe]
  152.     mov     dword [eax + 14],ebx
  153.     jmp     button_draw_run
  154.   @@: ;act
  155.     xor     ebx,ebx
  156.     mov     bx,word [eax + 8]
  157.     cmp     ebx,1
  158.     je      @f
  159.     mov     ebx,[sc.btn_face]
  160.     mov     dword [eax + 10],ebx
  161.     mov     ebx,[sc.btn_frame]
  162.     mov     dword [eax + 14],ebx
  163.     jmp     button_draw_run
  164.   @@: ; foc
  165.     mov     ebx,[sc.btn_fcface]
  166.     mov     dword [eax + 10],ebx
  167.     mov     ebx,[sc.btn_fcframe]
  168.     mov     dword [eax + 14],ebx
  169.  
  170.   button_draw_run:
  171.  
  172.     ; ïðÿìîóãîëüíûé ôîí
  173.     mov     bx, word [eax]         ; x
  174.     add     bx, 2                  ; x+2
  175.     shl     ebx,16
  176.     mov     bx, word [eax+4]       ; w
  177.     sub     bx, 4                  ; w-4
  178.     mov     cx, word [eax+2]       ; y
  179.     add     cx,2                   ; y+2
  180.     shl     ecx,16
  181.     mov     cx, word [eax+6]       ; h
  182.     sub     cx, 4                  ; h-4
  183.     mov     edx, dword [eax + 10]  ; color
  184.     push    eax
  185.     mov     eax, 13                ; rect
  186.     int     0x40                   ; draw
  187.     pop     eax
  188.  
  189.     ; âåðõíÿÿ ëèíèÿ [frame]
  190.     mov     edx, dword [eax + 14]  ; color
  191.     mov     bx, word [eax]         ; x
  192.     inc     bx                     ; x+1
  193.     shl     ebx,16
  194.     mov     bx, word [eax]         ; x2=x
  195.     add     bx, word [eax + 4]     ; x2=x+w
  196.     sub     bx,2                   ; x2=x2-2
  197.     mov     cx, word [eax + 2]     ; y
  198.     shl     ecx,16
  199.     mov     cx, word [eax + 2]     ; y2=y
  200.     push    eax
  201.     mov     eax, 38                ; line
  202.     int     0x40                   ; draw
  203.     ; âåðõíÿÿ ëèíèÿ [3d]
  204.     mov     edx, [sc.3d_light]     ; color
  205.     add     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
  206.     int     0x40                   ; draw
  207.     pop     eax
  208.  
  209.     ; íèæíÿÿ ëèíèÿ [frame]
  210.  
  211.     mov     cx, word [eax + 2]     ; y
  212.     add     cx, word [eax + 6]     ; y = y+h
  213.     push    cx
  214.     shl     ecx,16
  215.     pop     cx
  216.     sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
  217.     mov     edx, dword [eax + 14]  ; color
  218.     push    eax
  219.     mov     eax, 38                ; line
  220.     int     0x40                   ; draw
  221.     ; íèæíÿÿ ëèíèÿ [3d]
  222.     sub     ebx, 1 shl 16          ; x = x-1
  223.     mov     edx, [sc.3d_dark]      ; color
  224.     sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
  225.     int     0x40                   ; draw
  226.     pop     eax
  227.  
  228.  
  229.     ; ïåðåäíÿÿ áîêîâàÿ [frame]
  230.     mov     edx, dword [eax + 14]  ; color
  231.     mov     bx, word [eax]         ; x
  232.     shl     ebx,16
  233.     mov     bx, word [eax]         ; x2=x
  234.     mov     cx, word [eax + 2]     ; y
  235.     inc     cx                     ; y=y+1
  236.     shl     ecx,16
  237.     mov     cx, word [eax + 2]     ; y2=y
  238.     add     cx, word [eax + 6]     ; y2=y+h
  239.     sub     cx,2                   ; y2=y2-2
  240.     push    eax
  241.     mov     eax, 38                ; line
  242.     int     0x40                   ; draw
  243.     ; ïåðåäíÿÿ áîêîâàÿ [3d]
  244.     mov     edx, [sc.3d_light]     ; color
  245.     add     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
  246.     sub     ecx,1                  ; y2=y2-1
  247.     int     0x40                   ; draw
  248.     pop     eax
  249.  
  250.     ; çàäíÿÿ áîêîâàÿ [frame]
  251.     mov     edx, dword [eax + 14]  ; color
  252.     mov     bx, word [eax]         ; x
  253.     add     bx, word [eax + 4]     ; x=x+w
  254.     dec     bx
  255.     push    bx
  256.     shl     ebx,16
  257.     pop     bx
  258.     inc     ecx
  259.     push    eax
  260.     mov     eax, 38                ; line
  261.     int     0x40                   ; draw
  262.     ; çàäíÿÿ áîêîâàÿ [3d]
  263.     mov     edx, [sc.3d_dark]     ; color
  264.     sub     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
  265.     int     0x40                   ; draw
  266.     pop     eax
  267.  
  268.     popa
  269.     ret
  270.