Rev 8107 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8108 | maxcodehac | 1 | // BOXLIB EXAMPLE (scrollbar) |
2 | // Writed by maxcodehack |
||
8106 | maxcodehac | 3 | #include |
8104 | maxcodehac | 4 | #include |
5 | #include |
||
6 | |||
8106 | maxcodehac | 7 | #define evReDraw 1 |
8 | #define evKey 2 |
||
9 | #define evButton 3 |
||
10 | #define evExit 4 |
||
11 | #define evDesktop 5 |
||
12 | #define evMouse 6 |
||
13 | #define evIPC 7 |
||
14 | #define evNetwork 8 |
||
15 | #define evDebug 9 |
||
8104 | maxcodehac | 16 | |
8106 | maxcodehac | 17 | #define WIN_W 640 |
18 | #define WIN_H 563 |
||
8104 | maxcodehac | 19 | |
8106 | maxcodehac | 20 | char* title = "Boxlib example"; |
21 | int win_bg_color = 0x858585; |
||
22 | scrollbar scroll = {15, WIN_W - 26, WIN_H - 29, 0, 0, 2, 115, 15, 0,0x707070,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
||
8104 | maxcodehac | 23 | |
8106 | maxcodehac | 24 | void draw_window(){ |
25 | begin_draw(); |
||
26 | sys_create_window(215,100,WIN_W,WIN_H,title,win_bg_color,0x34); |
||
27 | scrollbar_v_draw(&scroll); |
||
28 | end_draw(); |
||
29 | } |
||
8104 | maxcodehac | 30 | |
8106 | maxcodehac | 31 | //// EVENTMASK |
32 | #define EVM_REDRAW 1 |
||
33 | #define EVM_KEY 2 |
||
34 | #define EVM_BUTTON 4 |
||
35 | #define EVM_EXIT 8 |
||
36 | #define EVM_BACKGROUND 16 |
||
37 | #define EVM_MOUSE 32 |
||
38 | #define EVM_IPC 64 |
||
39 | #define EVM_STACK 128 |
||
40 | #define EVM_DEBUG 256 |
||
41 | #define EVM_STACK2 512 |
||
42 | #define EVM_MOUSE_FILTER 0x80000000 |
||
43 | #define EVM_CURSOR_FILTER 0x40000000 |
||
44 | //// EVENTMASK |
||
8104 | maxcodehac | 45 | |
46 | |||
8106 | maxcodehac | 47 | int main() |
48 | { |
||
49 | kolibri_boxlib_init(); |
||
50 | |||
51 | set_event_mask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
||
52 | while(1) |
||
53 | { |
||
54 | switch(get_os_event()) |
||
55 | { |
||
56 | case evButton: |
||
57 | if (get_os_button() == 1) exit(0); |
||
58 | break; |
||
59 | |||
60 | case evKey: |
||
61 | get_key(); |
||
62 | break; |
||
63 | |||
64 | case evReDraw: |
||
65 | draw_window(); |
||
66 | break; |
||
67 | case evMouse: |
||
68 | scrollbar_v_mouse(&scroll); |
||
69 | break; |
||
70 | } |
||
71 | } |
||
8104 | maxcodehac | 72 | } |