Rev 8108 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8110 | maxcodehac | 1 | // BOXLIB EXAMPLE (scrollbar, progressbar) |
8108 | maxcodehac | 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; |
||
8110 | maxcodehac | 22 | scrollbar scroll = {15, WIN_W - 26, WIN_H - 29, 0, 0, 2, 215, 15, 0,0x707070,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
23 | progressbar pg = {0, 10, 10, 270, 35, 1, 0, 200, 0xB4B4B4, 0x2728FF, 0xA9A9A9}; |
||
8104 | maxcodehac | 24 | |
8106 | maxcodehac | 25 | void draw_window(){ |
26 | begin_draw(); |
||
27 | sys_create_window(215,100,WIN_W,WIN_H,title,win_bg_color,0x34); |
||
28 | scrollbar_v_draw(&scroll); |
||
8110 | maxcodehac | 29 | progressbar_draw(&pg); |
8106 | maxcodehac | 30 | end_draw(); |
31 | } |
||
8104 | maxcodehac | 32 | |
8106 | maxcodehac | 33 | //// EVENTMASK |
34 | #define EVM_REDRAW 1 |
||
35 | #define EVM_KEY 2 |
||
36 | #define EVM_BUTTON 4 |
||
37 | #define EVM_EXIT 8 |
||
38 | #define EVM_BACKGROUND 16 |
||
39 | #define EVM_MOUSE 32 |
||
40 | #define EVM_IPC 64 |
||
41 | #define EVM_STACK 128 |
||
42 | #define EVM_DEBUG 256 |
||
43 | #define EVM_STACK2 512 |
||
44 | #define EVM_MOUSE_FILTER 0x80000000 |
||
45 | #define EVM_CURSOR_FILTER 0x40000000 |
||
46 | //// EVENTMASK |
||
8104 | maxcodehac | 47 | |
48 | |||
8106 | maxcodehac | 49 | int main() |
50 | { |
||
51 | kolibri_boxlib_init(); |
||
52 | |||
53 | set_event_mask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
||
54 | while(1) |
||
55 | { |
||
56 | switch(get_os_event()) |
||
57 | { |
||
58 | case evButton: |
||
59 | if (get_os_button() == 1) exit(0); |
||
60 | break; |
||
61 | |||
62 | case evKey: |
||
63 | get_key(); |
||
64 | break; |
||
65 | |||
66 | case evReDraw: |
||
67 | draw_window(); |
||
68 | break; |
||
69 | case evMouse: |
||
70 | scrollbar_v_mouse(&scroll); |
||
8110 | maxcodehac | 71 | pg.value = scroll.position; |
72 | progressbar_draw(&pg); |
||
8106 | maxcodehac | 73 | break; |
74 | } |
||
75 | } |
||
8104 | maxcodehac | 76 | } |