Subversion Repositories Kolibri OS

Rev

Rev 383 | Rev 1143 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 383 Rev 485
Line 7... Line 7...
7
; e-mail:       ivan-yar@bk.ru
7
; e-mail:       ivan-yar@bk.ru
8
;modified by: Heavyiron
8
;modified by: Heavyiron
Line 9... Line 9...
9
 
9
 
10
; <--- include all MeOS stuff --->
10
; <--- include all MeOS stuff --->
11
include "lang.inc"
11
include "lang.inc"
Line 12... Line 12...
12
include "macros.inc"
12
include "..\..\..\..\macros.inc"
13
 
13
 
Line 21... Line 21...
21
 
21
 
22
   mov  eax,48                      ; get system colors
22
   mov  eax,48                      ; get system colors
23
   mov  ebx,3
23
   mov  ebx,3
24
   mov  ecx,sc
24
   mov  ecx,sc
25
   mov  edx,sizeof.system_colors
25
   mov  edx,sizeof.system_colors
Line 26... Line 26...
26
   int  0x40
26
   mcall
27
 
27
 
Line 28... Line 28...
28
  redraw:                                ; redraw event handler
28
  redraw:                                ; redraw event handler
29
   call    draw_window            ; at first create and draw the window
29
   call    draw_window            ; at first create and draw the window
30
 
30
 
Line 31... Line 31...
31
  wait_event:                      ; main cycle
31
  wait_event:                      ; main cycle
32
    mov     eax, 10
32
    mov     eax, 10
33
    int     0x40
33
    mcall
34
 
34
 
Line 35... Line 35...
35
    dec   eax                    ;   if event = 1
35
    dec   eax                    ;   if event = 1
36
    jz      redraw               ;   jump to redraw handler
36
    jz      redraw               ;   jump to redraw handler
37
    dec   eax                    ;   else if event = 2
37
    dec   eax                    ;   else if event = 2
Line 38... Line 38...
38
    jz      key                    ;   jump to key handler
38
    jz      key                    ;   jump to key handler
39
 
39
 
Line 40... Line 40...
40
 
40
 
41
  button:                         ; button event handler
41
  button:                         ; button event handler
Line 42... Line 42...
42
    mov     al, 17               ;   get button identifier
42
    mov     al, 17               ;   get button identifier
43
    int     0x40
43
    mcall
44
 
44
 
Line 45... Line 45...
45
    cmp     ah, 1
45
    cmp     ah, 1
Line 46... Line 46...
46
    jne     wait_event        ;   return if button id != 1
46
    jne     wait_event        ;   return if button id != 1
47
 
47
 
48
    or      eax, -1               ;   exit application
48
    or      eax, -1               ;   exit application
49
    int     0x40
49
    mcall
Line 50... Line 50...
50
 
50
 
51
  key:                              ; key event handler
51
  key:                              ; key event handler
52
    mov     al, 2                 ;   get key code
52
    mov     al, 2                 ;   get key code
53
    int     0x40
53
    mcall
54
 
54
 
55
    jmp     wait_event
55
    jmp     wait_event
56
 
56
 
Line 57... Line 57...
57
  draw_window:
57
  draw_window:
58
    mov     eax, 12                ; start drawing
58
    mov     eax, 12                ; start drawing
59
    mov     ebx, 1
59
    mov     ebx, 1
Line 60... Line 60...
60
    int     0x40
60
    mcall
Line 61... Line 61...
61
 
61
 
62
    xor       eax, eax                      ; create and draw the window
62
    xor       eax, eax                      ; create and draw the window
Line 63... Line 63...
63
    mov     ebx, 100*65536+200 ; (window_cx)*65536+(window_sx)
63
    mov     ebx, 100*65536+200 ; (window_cx)*65536+(window_sx)
64
    mov     ecx, 100*65536+100  ; (window_cy)*65536+(window_sy)
64
    mov     ecx, 100*65536+100  ; (window_cy)*65536+(window_sy)
65
    mov     edx, [sc.work]              ; work area color 
65
    mov     edx, [sc.work]              ; work area color 
66
    or         edx, 0x33000000        ; & window type 3
66
    or         edx, 0x33000000        ; & window type 3
67
    mov     edi, header                    ; window header
67
    mov     edi, title                    ; window title
68
    int        0x40
68
    int        0x40
69
 
69
 
Line 70... Line 70...
70
    mov     eax, 12                ; finish drawing
70
    mov     eax, 12                ; finish drawing
71
    mov     ebx, 2
71
    mov     ebx, 2
72
    int     0x40
72
    mcall