00001 #ifndef BCBUTTON_H
00002 #define BCBUTTON_H
00003
00004 #include "bcbitmap.inc"
00005 #include "bcsubwindow.h"
00006 #include "vframe.inc"
00007
00008 #include <stdint.h>
00009
00010
00011 class BC_Button : public BC_SubWindow
00012 {
00013 public:
00014 BC_Button(int x, int y, VFrame **data);
00015 BC_Button(int x, int y, int w, VFrame **data);
00016 virtual ~BC_Button();
00017
00018 friend class BC_GenericButton;
00019
00020 virtual int handle_event() { return 0; };
00021 int repeat_event(int64_t repeat_id);
00022 virtual int draw_face();
00023 void disable();
00024 void enable();
00025
00026 int initialize();
00027 virtual int set_images(VFrame **data);
00028 int cursor_enter_event();
00029 int cursor_leave_event();
00030 int button_press_event();
00031 int button_release_event();
00032 int cursor_motion_event();
00033 int update_bitmaps(VFrame **data);
00034 int reposition_window(int x, int y);
00035 void set_underline(int number);
00036
00037
00038 private:
00039
00040 BC_Pixmap *images[3];
00041 VFrame **data;
00042 int status;
00043 int w_argument;
00044 int underline_number;
00045 int enabled;
00046 };
00047
00048
00049
00050
00051 class BC_GenericButton : public BC_Button
00052 {
00053 public:
00054 BC_GenericButton(int x, int y, char *text, VFrame **data = 0);
00055 BC_GenericButton(int x, int y, int w, char *text, VFrame **data = 0);
00056 int set_images(VFrame **data);
00057 int draw_face();
00058 static int calculate_w(BC_WindowBase *gui, char *text);
00059 static int calculate_h();
00060
00061 private:
00062 char text[BCTEXTLEN];
00063 };
00064
00065 class BC_OKTextButton : public BC_GenericButton
00066 {
00067 public:
00068 BC_OKTextButton(BC_WindowBase *parent_window);
00069 virtual int resize_event(int w, int h);
00070 virtual int handle_event();
00071 virtual int keypress_event();
00072 BC_WindowBase *parent_window;
00073 };
00074
00075 class BC_CancelTextButton : public BC_GenericButton
00076 {
00077 public:
00078 BC_CancelTextButton(BC_WindowBase *parent_window);
00079 virtual int resize_event(int w, int h);
00080 virtual int handle_event();
00081 virtual int keypress_event();
00082 BC_WindowBase *parent_window;
00083 };
00084
00085 class BC_OKButton : public BC_Button
00086 {
00087 public:
00088 BC_OKButton(int x, int y);
00089 BC_OKButton(BC_WindowBase *parent_window);
00090 BC_OKButton(BC_WindowBase *parent_window, VFrame **images);
00091 static int calculate_h();
00092 static int calculate_w();
00093 virtual int resize_event(int w, int h);
00094 virtual int handle_event();
00095 virtual int keypress_event();
00096 };
00097
00098 class BC_CancelButton : public BC_Button
00099 {
00100 public:
00101 BC_CancelButton(int x, int y);
00102 BC_CancelButton(BC_WindowBase *parent_window);
00103 BC_CancelButton(BC_WindowBase *parent_window, VFrame **images);
00104 static int calculate_h();
00105 static int calculate_w();
00106 virtual int resize_event(int w, int h);
00107 virtual int handle_event();
00108 virtual int keypress_event();
00109 };
00110
00111 #endif