Subversion Repositories Kolibri OS

Rev

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