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_TEXT_HPP
00026 #define CTRL_TEXT_HPP
00027
00028 #include "ctrl_generic.hpp"
00029 #include "../utils/fsm.hpp"
00030 #include "../utils/observer.hpp"
00031 #include <string>
00032
00033 class GenericFont;
00034 class GenericBitmap;
00035 class OSTimer;
00036 class UString;
00037 class VarText;
00038
00039
00041 class CtrlText: public CtrlGeneric, public Observer<VarText>
00042 {
00043 public:
00045 CtrlText( intf_thread_t *pIntf, VarText &rVariable,
00046 const GenericFont &rFont, const UString &rHelp,
00047 uint32_t color, VarBool *pVisible );
00048 virtual ~CtrlText();
00049
00051 virtual void handleEvent( EvtGeneric &rEvent );
00052
00054 virtual bool mouseOver( int x, int y ) const;
00055
00057 virtual void draw( OSGraphics &rImage, int xDest, int yDest );
00058
00061 void setText( const UString &rText, uint32_t color = 0xFFFFFFFF );
00062
00064 virtual string getType() const { return "text"; }
00065
00066 private:
00068 FSM m_fsm;
00070 VarText &m_rVariable;
00072 DEFINE_CALLBACK( CtrlText, ToManual )
00073 DEFINE_CALLBACK( CtrlText, ManualMoving )
00074 DEFINE_CALLBACK( CtrlText, ManualStill )
00075 DEFINE_CALLBACK( CtrlText, Move )
00077 EvtGeneric *m_pEvt;
00079 const GenericFont &m_rFont;
00081 uint32_t m_color;
00083 GenericBitmap *m_pImg;
00086 GenericBitmap *m_pImgDouble;
00088 GenericBitmap *m_pCurrImg;
00090 int m_xPos;
00093 int m_xOffset;
00095 OSTimer *m_pTimer;
00096
00098 DEFINE_CALLBACK( CtrlText, UpdateText );
00099
00101 virtual void onUpdate( Subject<VarText> &rVariable );
00102
00104 void displayText( const UString &rText );
00105
00107 void adjust( int &position );
00108
00110 virtual void onChangePosition();
00111 };
00112
00113
00114 #endif