Rev 9455 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9455 | Rev 9516 | ||
---|---|---|---|
1 | #ifndef TAB_PADDING |
1 | #ifndef TAB_P |
2 | #define TAB_PADDING 15 |
2 | #define TAB_P 15 //Tab padding |
3 | #endif |
3 | #endif |
4 | 4 | ||
5 | #define TAB_HEIGHT 28 |
5 | #define TAB_HEIGHT 28 |
6 | #define NAME_SIZE 64 |
6 | #define NAME_SIZE 64 |
7 | 7 | ||
8 | :struct _tabs |
8 | :struct _tabs |
9 | { |
9 | { |
10 | int x,y,w; |
10 | int x,y,w; |
11 | int base_id; |
11 | int base_id; |
12 | 12 | ||
13 | int active_tab; |
13 | int active_tab; |
14 | int count; |
14 | int count; |
15 | dword events[10]; |
15 | dword events[10]; |
16 | dword names[10]; |
16 | dword names[10]; |
17 | 17 | ||
18 | int click(); |
18 | int click(); |
19 | void draw(); |
19 | void draw(); |
20 | void draw_active_tab(); |
20 | void draw_active_tab(); |
21 | void add(); |
21 | void add(); |
22 | 22 | ||
23 | dword draw_button(); |
23 | dword draw_button(); |
24 | }; |
24 | }; |
25 | 25 | ||
26 | :void _tabs::draw() |
26 | :void _tabs::draw() |
27 | { |
27 | { |
28 | int i, xx=x; |
28 | int i, xx=x; |
29 | 29 | ||
30 | if (w) { |
30 | if (w) { |
31 | DrawBar(x+1,y+0+TAB_HEIGHT,w,1, sc.work_graph); |
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); |
32 | DrawBar(x+1,y+1+TAB_HEIGHT,w,1, sc.work_light); |
33 | } |
33 | } |
34 | 34 | ||
35 | for (i=0; i |
35 | for (i=0; i |
36 | xx += draw_button(xx + TAB_PADDING, i, names[i]) + TAB_PADDING; |
36 | xx += draw_button(xx + TAB_P, i, names[i]) + TAB_P; |
37 | } |
37 | } |
38 | } |
38 | } |
39 | 39 | ||
40 | :void _tabs::draw_active_tab() |
40 | :void _tabs::draw_active_tab() |
41 | { |
41 | { |
42 | events[active_tab](); |
42 | events[active_tab](); |
43 | } |
43 | } |
44 | 44 | ||
45 | :void _tabs::add(dword text, event) |
45 | :void _tabs::add(dword text, event) |
46 | { |
46 | { |
47 | names[count] = text; |
47 | names[count] = text; |
48 | events[count] = event; |
48 | events[count] = event; |
49 | count++; |
49 | count++; |
50 | } |
50 | } |
51 | 51 | ||
52 | :dword _tabs::draw_button(dword xx, _id, text) |
52 | :dword _tabs::draw_button(dword xx, _id, text) |
53 | { |
53 | { |
54 | dword col_bg, col_text; |
54 | dword col_bg, col_text; |
55 | dword ww=strlen(text)*8; |
55 | dword ww=strlen(text)*8; |
56 | 56 | ||
57 | if (_id==active_tab) |
57 | if (_id==active_tab) |
58 | { |
58 | { |
59 | col_bg = 0xE44C9C; |
59 | col_bg = 0xE44C9C; |
60 | col_text = sc.work_text; |
60 | col_text = sc.work_text; |
61 | } |
61 | } |
62 | else |
62 | else |
63 | { |
63 | { |
64 | col_bg = 0xC3A1B7; |
64 | col_bg = 0xC3A1B7; |
65 | col_text = MixColors(sc.work, sc.work_text, 120); |
65 | col_text = MixColors(sc.work, sc.work_text, 120); |
66 | } |
66 | } |
67 | DefineHiddenButton(xx-2,y, ww-1+4,TAB_HEIGHT-1, _id + base_id); |
67 | DefineHiddenButton(xx-2,y, ww-1+4,TAB_HEIGHT-1, _id + base_id); |
68 | WriteTextWithBg(xx, y+6, 0xD0, col_text, text, sc.work); |
68 | WriteTextWithBg(xx, y+6, 0xD0, col_text, text, sc.work); |
69 | DrawBar(xx, y+TAB_HEIGHT-3, ww, 3, col_bg); |
69 | DrawBar(xx, y+TAB_HEIGHT-3, ww, 3, col_bg); |
70 | return ww; |
70 | return ww; |
71 | } |
71 | } |
72 | 72 | ||
73 | :int _tabs::click(int _id) |
73 | :int _tabs::click(int _id) |
74 | { |
74 | { |
75 | if (_id < base_id) || (_id > base_id + count) || (_id == active_tab) { |
75 | if (_id < base_id) || (_id > base_id + count) || (_id == active_tab) { |
76 | return false; |
76 | return false; |
77 | } |
77 | } |
78 | active_tab = _id - base_id; |
78 | active_tab = _id - base_id; |
79 | events[active_tab](); |
79 | events[active_tab](); |
80 | return true; |
80 | return true; |
81 | }> |
81 | }> |