Rev 7906 | Rev 9453 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7906 | Rev 7909 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef TAB_PADDING |
1 | #ifndef TAB_PADDING |
2 | #define TAB_PADDING 15 |
2 | #define TAB_PADDING 15 |
3 | #endif |
3 | #endif |
Line 4... | Line 4... | ||
4 | 4 | ||
- | 5 | #define TAB_HEIGHT 28 |
|
Line 5... | Line 6... | ||
5 | #define TAB_HEIGHT 28 |
6 | #define NAME_SIZE 64 |
6 | 7 | ||
- | 8 | :struct _tabs |
|
- | 9 | { |
|
- | 10 | int x,y,w; |
|
7 | :struct _tabs |
11 | int base_id; |
- | 12 | ||
8 | { |
13 | int active_tab; |
9 | int active_tab; |
14 | char names[640]; |
- | 15 | int count; |
|
10 | int x,y,w,h; |
16 | dword events[10]; |
- | 17 | ||
11 | dword draw_button(); |
18 | int click(); |
- | 19 | void draw(); |
|
- | 20 | void draw_active_tab(); |
|
- | 21 | void add(); |
|
12 | int click(); |
22 | |
Line -... | Line 23... | ||
- | 23 | dword draw_button(); |
|
- | 24 | }; |
|
- | 25 | ||
- | 26 | :void _tabs::draw() |
|
- | 27 | { |
|
- | 28 | int i, xx=x; |
|
- | 29 | ||
- | 30 | if (w) { |
|
- | 31 | DrawBar(x+1,y+0+TAB_HEIGHT,w,1, sc.work_graph); |
|
- | 32 | DrawBar(x+1,y+1+TAB_HEIGHT,w,1, sc.work_light); |
|
- | 33 | } |
|
- | 34 | ||
- | 35 | for (i=0; i |
|
- | 36 | xx += draw_button(xx + TAB_PADDING, i, i*NAME_SIZE + #names) + TAB_PADDING; |
|
13 | void draw_wrapper(); |
37 | } |
14 | }; |
38 | } |
15 | - | ||
16 | :void _tabs::draw_wrapper() |
39 | |
17 | { |
40 | :void _tabs::draw_active_tab() |
Line -... | Line 41... | ||
- | 41 | { |
|
- | 42 | events[active_tab](); |
|
- | 43 | } |
|
- | 44 | ||
- | 45 | :void _tabs::add(dword text, event) |
|
- | 46 | { |
|
- | 47 | strcpy(count*NAME_SIZE + #names, text); |
|
18 | DrawRectangle(x,y+TAB_HEIGHT,w-1,h-TAB_HEIGHT, sc.work_graph); |
48 | events[count] = event; |
19 | DrawBar(x+1,y+1+TAB_HEIGHT,w-3,1, sc.work_light); |
49 | count++; |
20 | } |
50 | } |
21 | 51 | ||
Line 22... | Line 52... | ||
22 | :dword _tabs::draw_button(dword xx, but_id, text) |
52 | :dword _tabs::draw_button(dword xx, _id, text) |
23 | { |
53 | { |
24 | dword col_bg, col_text; |
54 | dword col_bg, col_text; |
25 | dword ww=strlen(text)*8, hh=TAB_HEIGHT; |
55 | dword ww=strlen(text)*8; |
26 | 56 | ||
27 | if (but_id==active_tab) |
57 | if (_id==active_tab) |
28 | { |
58 | { |
29 | col_bg=0xE44C9C; |
59 | col_bg = 0xE44C9C; |
30 | col_text=sc.work_text; |
60 | col_text = sc.work_text; |
31 | } |
61 | } |
32 | else |
62 | else |
33 | { |
63 | { |
34 | col_bg=0xC3A1B7; |
64 | col_bg = 0xC3A1B7; |
35 | col_text= MixColors(sc.work, sc.work_text, 120); |
- | |
36 | } |
65 | col_text = MixColors(sc.work, sc.work_text, 120); |
37 | DefineHiddenButton(xx-2,y, ww-1+4,hh-1, but_id); |
66 | } |
Line 38... | Line 67... | ||
38 | WriteText(xx, y+6, 0x90, col_text, text); |
67 | DefineHiddenButton(xx-2,y, ww-1+4,TAB_HEIGHT-1, _id + base_id); |
39 | DrawBar(xx, y+hh-3, ww, 3, col_bg); |
68 | WriteText(xx, y+6, 0x90, col_text, text); |
- | 69 | DrawBar(xx, y+TAB_HEIGHT-3, ww, 3, col_bg); |
|
- | 70 | return ww; |
|
- | 71 | } |
|
40 | //DrawStandartCaptButton(xx, y, but_id, text); //GetFreeButtonId() |
72 | |
41 | return xx; |
73 | :int _tabs::click(int _id) |
42 | } |
74 | { |
43 | 75 | if (_id < base_id) || (_id > base_id + count) || (_id == active_tab) { |
|
44 | :int _tabs::click(int N) |
76 | return false; |