[49] | 1 | #ifndef __GUI_HPP_ |
---|
| 2 | #define __GUI_HPP_ |
---|
| 3 | #include "jwindow.hpp" |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | class ico_button : public ifield |
---|
| 7 | { |
---|
| 8 | int up,act,u,d,ua,da; // up, down, up active, down active |
---|
| 9 | int activate_id; // sent when if not -1 when object receives a draw actove |
---|
| 10 | char key[16]; |
---|
| 11 | public : |
---|
| 12 | ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id=-1, char *help_key=NULL); |
---|
| 13 | |
---|
| 14 | virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm); |
---|
| 15 | virtual void draw_first(image *screen, window_manager *wm) { draw(0,screen,wm); } |
---|
| 16 | virtual void draw(int active, image *screen, window_manager *wm); |
---|
| 17 | virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im); |
---|
| 18 | |
---|
| 19 | virtual char *read() { return (char *)&up; } |
---|
| 20 | void set_xy(int X, int Y) { x=X; y=Y; } |
---|
| 21 | int X() { return x; } |
---|
| 22 | int Y() { return y; } |
---|
| 23 | int status() { return up; } |
---|
| 24 | void set_act_id(int id); |
---|
| 25 | } ; |
---|
| 26 | |
---|
| 27 | class ico_switch_button : public ifield |
---|
| 28 | { |
---|
| 29 | ifield *blist,*cur_but; |
---|
| 30 | int act; |
---|
| 31 | public : |
---|
| 32 | ico_switch_button(int X, int Y, int ID, int start_on, ifield *butts, ifield *Next); |
---|
| 33 | virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm); |
---|
| 34 | virtual void draw_first(image *screen, window_manager *wm) { cur_but->draw_first(screen,wm); } |
---|
| 35 | virtual void draw(int active, image *screen, window_manager *wm) { cur_but->draw(active,screen,wm); act=active; } |
---|
| 36 | virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im); |
---|
| 37 | virtual ifield *unlink(int id); |
---|
| 38 | virtual char *read() { return cur_but->read(); } |
---|
| 39 | ~ico_switch_button(); |
---|
| 40 | } ; |
---|
| 41 | |
---|
| 42 | #endif |
---|
| 43 | |
---|
| 44 | |
---|