00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef header_button
00012 #define header_button
00013
00014 #include "component.h"
00015
00016 class CL_Surface;
00017
00018 class CL_Button : public CL_Component
00019
00020 {
00022 public:
00023 CL_Button(
00024 const CL_ComponentOptions &options,
00025 CL_Component *parent,
00026 CL_StyleManager *style = NULL);
00027
00028 CL_Button(
00029 const CL_Rect &pos,
00030 const std::string &text,
00031 CL_Component *parent,
00032 CL_StyleManager *style = NULL);
00033
00034 CL_Button(
00035 const CL_Point &pos,
00036 const std::string &text,
00037 CL_Surface *surface_up,
00038 CL_Surface *surface_down,
00039 CL_Component *parent,
00040 CL_StyleManager *style = NULL);
00041
00042 CL_Button(
00043 const CL_Point &pos,
00044 const std::string &text,
00045 CL_Surface *surface_up,
00046 CL_Surface *surface_down,
00047 CL_Surface *surface_disabled,
00048 CL_Surface *surface_highlighted,
00049 CL_Component *parent,
00050 CL_StyleManager *style = NULL);
00051
00052 virtual ~CL_Button();
00053
00055 public:
00056 const std::string &get_text() const;
00057
00058
00059 bool is_toggle_button() const;
00060
00061
00062 bool is_down() const;
00063
00064
00065 CL_Surface *get_surface_up() const;
00066
00067
00068 CL_Surface *get_surface_down() const;
00069
00070
00071 CL_Surface *get_surface_highlighted() const;
00072
00073
00074 CL_Surface *get_surface_disabled() const;
00075
00076
00078 public:
00079 void set_text(const std::string &text);
00080
00081
00082 void set_toggle_mode(bool toggle = true);
00083
00084
00085
00086 void set_down(bool enable = true);
00087
00088
00089
00090 void toggle();
00091
00092
00093
00094 void set_surface_up(CL_Surface *surface);
00095
00096
00097 void set_surface_down(CL_Surface *surface);
00098
00099
00100 void set_surface_highlighted(CL_Surface *surface);
00101
00102
00103 void set_surface_disabled(CL_Surface *surface);
00104
00105
00107 public:
00108 CL_Signal_v1<bool> &sig_toggled();
00109
00111
00112 CL_Signal_v0 &sig_clicked();
00113
00114
00115 CL_Signal_v0 &sig_pressed();
00116
00117
00118 CL_Signal_v0 &sig_released();
00119
00120
00122 private:
00123 CL_Button(const CL_Button ©) : CL_Component(NULL, NULL) { return; }
00124 class CL_Button_Generic *impl;
00125 };
00126
00127 #endif