Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1805 yogev_ezra 1
;#***************
2
;#*  BNC.MAIN()
3
;#***************
4
cTxt   equ  0x10000000
5
cTxtW  equ  0x10FFFFFF
6
 
7
macro main_loop
8
{
9
draw_window:
10
        redraw_begin
11
;------------------------------
12
        ;--- MainWindow
13
        mcall 0,100*65536+250,100*65536+250,0x02FFFFFF ,0x808899AA ,0xFFAAcc
14
        ;--- MainWindow TitleBar
15
        mcall 4,8*65536+8,0x00224422,header,20
16
        ;--- Button - Close MainWindow
17
        mcall 8,230*65536+12, 5*65536+12, 100 ,0xFF6611
18
        ;--- Button - "New" ...
19
        mcall 8,190*65536+50,25*65536+15, 200 ,0xAA66CC
20
        mcall 4,205*65536+30,cTxtW,new,3
21
        ;--- Button - "Turn" ...
22
        ;mcall 8,190*65536+50,50*65536+15, 150 ,0x116611
23
;-----------------------------1234-secret-number---show
24
  ;     mcall 4, 50*65536+30,cTxt ,nA,4
25
;-----------------------------9-lines-
26
        call    paint_list
27
        redraw_end
28
;=============================
29
 event_wait:
30
        mcall 23,100
31
;-------------------------------------------------------------------------------
32
;    event in eax   -  and  what will happen
33
;-------------------------------------------------------------------------------
34
     EventIs EV_REDRAW,draw_window    ; redraw window
35
     EventIs EV_KEY,key               ; pressed key
36
     EventIs EV_BUTTON,button         ; one clicks button
37
        jmp     event_wait   ; returns at point of waiting for
38
;-------------------------------------------------------------------------------
39
;     Events handler
40
;-------------------------------------------------------------------------------
41
key:                         ;
42
        mov     eax,2        ; key code in ah.
43
        int     0x40         ;
44
        cmp     ah,27        ; ESC?
45
        je      close        ; exit on ESC
46
 
47
        call    input        ; input 0-9,Enter,<_BackSpace
48
 
49
        jmp    draw_window ; event_wait   ;
50
button:                      ;
51
        mov     eax,17       ; button ID in ah
52
        int     0x40         ;
53
;-------------------------------------------------------------------------------
54
;     Buttons handler
55
;-------------------------------------------------------------------------------
56
        cmp     ah,100        ; id=100("Close window")?
57
        jne     noclose       ;
58
  close:                      ;
59
        mov     eax,-1        ; CLOSE all
60
        int     0x40          ;
61
  noclose:                    ;
62
        cmp     ah,150        ; id=150 "Turn"
63
        je      @F
64
        call    rnew          ; id=200 "New"      ->nA
65
 
66
        call    clears
67
        jmp     draw_window    ;event_wait
68
 
69
  @@:
70
        call    paint_list
71
        jmp     event_wait
72
;
73
}
74