Subversion Repositories Kolibri OS

Rev

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

  1. include 'proc32.inc'
  2.  
  3. macro start_draw_window x,y,xsize,ysize,areacolor,caption;,capsize
  4. {
  5.         mov     eax, 12                 ; function 12:tell os about windowdraw
  6.         mov     ebx, 1                  ; 1, start of draw
  7.         int     0x40
  8.         ; DRAW WINDOW
  9.         mov     eax, 48                 ; function 48.4 : get skin height
  10.         mov     ebx, 4
  11.         int     0x40
  12.         push    eax
  13.         lea     ecx, [y*65536+ysize+eax]; [y start] *65536 + [y size] + [skin_height]
  14.         xor     eax, eax                ; function 0 : define and draw window
  15.         mov     ebx, x*65536+xsize      ; [x start] *65536 + [x size]
  16.         mov     edx, areacolor          ; color of work area RRGGBB
  17.         ;mov     esi, 0x00334455        ; color of grab bar  RRGGBB
  18.         mov     edi, caption;0x00ddeeff          ; color of frames    RRGGBB
  19.         int     0x40
  20.         ; WINDOW LABEL
  21.         ;mov     eax, 4                  ; function 4 : write text to window
  22.         ;mov     ebx, 8*65536+8          ; [x start] *65536 + [y start]
  23.         ;mov     ecx, 0x00ffffff         ; color of text RRGGBB
  24.         ;mov     edx, caption            ; pointer to text beginning
  25.         ;mov     esi, capsize    ; text length
  26.         ;mov     eax, 71                  ; function 71.1
  27.         ;mov     ebx, 1                   ; set window caption
  28.         ;mov     ecx, caption             ; pointer to text
  29.         ;int     0x40
  30.         pop     eax
  31. }
  32.  
  33. macro end_draw_window
  34. {
  35.         mov     eax, 12                 ; end of redraw
  36.         mov     ebx, 2
  37.         int     0x40
  38. }
  39.  
  40. proc draw_button stdcall, x:dword, y:dword, xsize:dword, ysize:dword, \
  41.         id:dword, butcolor:dword, text:dword, textlen:byte, textcolor:dword
  42.  
  43.         ;pusha
  44.         mov     ebx, dword [x]
  45.         shl     ebx, 16
  46.         add     ebx, dword [xsize]        ; [x start] *65536 + [x size]
  47.  
  48.         mov     ecx, dword [y]
  49.         shl     ecx, 16
  50.         add     ecx, dword [ysize]        ; [y start] *65536 + [y size]
  51.  
  52.         mov     edx, dword [id]                 ; button id
  53.         mov     esi, dword [butcolor]           ; button color RRGGBB
  54.         mov     eax, 8                  ; function 8 : define and draw button
  55.         int     0x40
  56.  
  57.         mov     ebx, dword [x]
  58.         add     ebx, 5
  59.         shl     ebx, 16
  60.         mov     eax, dword [ysize]
  61.         sub     eax, 5
  62.         shr     eax, 1
  63.         add     ebx, eax
  64.         add     ebx, dword [y]  ;mov    ebx, (x+5)*65536+y+(ysize-5)/2  ; Draw button text
  65.  
  66.         mov     ecx, dword [textcolor]
  67.         mov     edx, dword [text]
  68.         xor     eax, eax
  69.         mov     al,  byte [textlen]
  70.         mov     esi, eax
  71.         mov     eax, 4
  72.         int     0x40
  73.         ;popa
  74. ret
  75. endp
  76.  
  77. macro outtextxy x,y,prompt,prompt_len,color
  78. {
  79.         pusha
  80.         mov     ebx, x*65536+y         ; draw info text with function 4
  81.         mov     ecx, color
  82.         mov     edx, prompt
  83.         xor     eax, eax
  84.         mov     al,  prompt_len
  85.         mov     esi, eax
  86.         mov     eax, 4
  87.         int     0x40
  88.         popa
  89. }
  90.  
  91. ;proc bar x:dword, y:dword, xsize:dword, ysize:dword, color:dword
  92. macro bar x, y, xsize, ysize, color
  93. {
  94.         pusha
  95.         mov eax, 13
  96.         ;mov ebx, [x]
  97.         ;shl ebx, 16
  98.         ;add ebx, [xsize]
  99.         ;mov ecx, [y]
  100.         ;shl ecx, 16
  101.         ;add ecx, [ysize]
  102.         ;mov edx, [color]
  103.         mov     ebx, x*65536+xsize
  104.         mov     ecx, y*65536+ysize
  105.         mov edx, color
  106.  
  107.         int 0x40
  108.         popa
  109. ;ret
  110. ;endp
  111. }
  112.  
  113. macro line x1,y1,x2,y2,color
  114. {
  115.   pusha
  116.   mov eax, 38
  117.   mov ebx, x1*65536+x2
  118.   mov ecx, y1*65536+y2
  119.   mov edx, color
  120.   int 0x40
  121.   popa
  122. }
  123.  
  124. macro rectangle x,y,xsize,ysize,color
  125. {
  126.   x2=x+xsize
  127.   y2=y+ysize
  128.   line x,y,x2,y,color
  129.   line x,y,x,y2,color
  130.   line x,y2,x2,y2,color
  131.   line x2,y,x2,y2,color
  132. }
  133.  
  134. macro putpixel x,y,color
  135. {
  136.   mov eax, 1
  137.   mov ebx, x
  138.   mov ecx, y
  139.   mov edx, color
  140.   int 0x40
  141. }
  142.  
  143.