ctrl_checkbox.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef CTRL_CHECKBOX_HPP
00026 #define CTRL_CHECKBOX_HPP
00027
00028 #include "ctrl_generic.hpp"
00029 #include "../utils/fsm.hpp"
00030 #include "../utils/observer.hpp"
00031 #include "../src/anim_bitmap.hpp"
00032
00033 class GenericBitmap;
00034 class OSGraphics;
00035 class CmdGeneric;
00036
00037
00038
00039 class CtrlCheckbox: public CtrlGeneric, public Observer<AnimBitmap>
00040 {
00041 public:
00042
00043 CtrlCheckbox( intf_thread_t *pIntf,
00044 const GenericBitmap &rBmpUp1,
00045 const GenericBitmap &rBmpOver1,
00046 const GenericBitmap &rBmpDown1,
00047 const GenericBitmap &rBmpUp2,
00048 const GenericBitmap &rBmpOver2,
00049 const GenericBitmap &rBmpDown2,
00050 CmdGeneric &rCommand1, CmdGeneric &rCommand2,
00051 const UString &rTooltip1, const UString &rTooltip2,
00052 VarBool &rVariable, const UString &rHelp,
00053 VarBool *pVisible);
00054
00055 virtual ~CtrlCheckbox();
00056
00057
00058 virtual void handleEvent( EvtGeneric &rEvent );
00059
00060
00061 virtual bool mouseOver( int x, int y ) const;
00062
00063
00064 virtual void draw( OSGraphics &rImage, int xDest, int yDest );
00065
00066
00067 virtual UString getTooltipText() const { return *m_pTooltip; }
00068
00069
00070 virtual string getType() const { return "checkbox"; }
00071
00072 private:
00073
00074 FSM m_fsm;
00075
00076 VarBool &m_rVariable;
00077
00078 CmdGeneric &m_rCommand1, &m_rCommand2;
00079
00080 CmdGeneric *m_pCommand;
00081
00082 const UString m_tooltip1, m_tooltip2;
00083
00084 const UString *m_pTooltip;
00085
00086 AnimBitmap m_imgUp1, m_imgOver1, m_imgDown1;
00087 AnimBitmap m_imgUp2, m_imgOver2, m_imgDown2;
00088
00089
00090
00091
00092
00093 AnimBitmap *m_pImgUp, *m_pImgOver, *m_pImgDown;
00094
00095 AnimBitmap *m_pImgCurrent;
00096
00097
00098 DEFINE_CALLBACK( CtrlCheckbox, UpOverDownOver )
00099 DEFINE_CALLBACK( CtrlCheckbox, DownOverUpOver )
00100 DEFINE_CALLBACK( CtrlCheckbox, DownOverDown )
00101 DEFINE_CALLBACK( CtrlCheckbox, DownDownOver )
00102 DEFINE_CALLBACK( CtrlCheckbox, UpOverUp )
00103 DEFINE_CALLBACK( CtrlCheckbox, UpUpOver )
00104 DEFINE_CALLBACK( CtrlCheckbox, DownUp )
00105 DEFINE_CALLBACK( CtrlCheckbox, UpHidden )
00106 DEFINE_CALLBACK( CtrlCheckbox, HiddenUp )
00107
00108
00109 virtual void onVarBoolUpdate( VarBool &rVariable );
00110
00111
00112 virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
00113
00114
00115 void setImage( AnimBitmap *pImg );
00116
00117
00118 void changeButton();
00119 };
00120
00121
00122 #endif