Rev 7227 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7225 | leency | 1 | :struct more_less_box |
2 | { |
||
3 | signed x,y; |
||
4 | unsigned value, min, max; |
||
5 | unsigned bt_id_more, bt_id_less; |
||
6 | dword text; |
||
7 | bool click(); |
||
8 | void draw(); |
||
9 | }; |
||
10 | |||
11 | :bool more_less_box::click(unsigned id) |
||
12 | { |
||
13 | if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; } |
||
14 | if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; } |
||
15 | return 0; |
||
16 | } |
||
17 | |||
18 | :void more_less_box::draw() |
||
19 | { |
||
20 | #define VALUE_FIELD_W 34 |
||
21 | #define SIZE 18 |
||
22 | dword value_text = itoa(value); |
||
23 | |||
24 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
||
25 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
||
26 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
||
27 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
||
28 | |||
29 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
||
30 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
||
31 | EDI = system.color.work; |
||
32 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
||
33 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
||
34 | } |
||
35 | |||
36 | //OUTDATED: to be removed |
||
37 | :void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text) |
||
38 | { |
||
39 | #define VALUE_FIELD_W 34 |
||
40 | #define SIZE 18 |
||
41 | dword value_text = itoa(value); |
||
42 | |||
43 | DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph); |
||
44 | DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff); |
||
45 | DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff); |
||
46 | WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text); |
||
47 | |||
48 | DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+"); |
||
49 | DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-"); |
||
50 | EDI = system.color.work; |
||
51 | WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); |
||
52 | DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); |
||
53 | } |