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_GENERIC_HPP
00026 #define CTRL_GENERIC_HPP
00027
00028 #include "../src/skin_common.hpp"
00029 #include "../utils/pointer.hpp"
00030 #include "../utils/fsm.hpp"
00031 #include "../utils/ustring.hpp"
00032 #include "../utils/observer.hpp"
00033 #include "../commands/cmd_generic.hpp"
00034
00035 class EvtGeneric;
00036 class OSGraphics;
00037 class GenericLayout;
00038 class Position;
00039 class TopWindow;
00040 class VarBool;
00041
00042
00044 class CtrlGeneric: public SkinObject, public Observer<VarBool>
00045 {
00046 public:
00047 virtual ~CtrlGeneric();
00048
00050 virtual void handleEvent( EvtGeneric &rEvent ) {}
00051
00053 virtual bool mouseOver( int x, int y ) const { return false; }
00054
00056 virtual void draw( OSGraphics &rImage, int xDest, int yDest ) {}
00057
00059 virtual void setLayout( GenericLayout *pLayout,
00060 const Position &rPosition );
00061
00063 virtual const Position *getPosition() const { return m_pPosition; }
00064
00066 virtual UString getTooltipText() const
00067 { return UString( getIntf(), "" ); }
00068
00071 virtual void onResize() {}
00072
00074 virtual const UString &getHelpText() const { return m_help; }
00075
00077 virtual bool isFocusable() const { return false; }
00078
00080 virtual bool isVisible() const;
00081
00083 virtual string getType() const { return ""; }
00084
00085 protected:
00086
00087 CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
00088 VarBool *pVisible = NULL );
00089
00093 virtual void notifyLayout( int witdh = -1, int height = -1,
00094 int xOffSet = 0, int yOffSet = 0 ) const;
00095
00098 void notifyLayoutMaxSize( const OSGraphics *pImg1 = NULL,
00099 const OSGraphics *pImg2 = NULL );
00100
00102 virtual void captureMouse() const;
00103
00105 virtual void releaseMouse() const;
00106
00108 virtual void notifyTooltipChange() const;
00109
00111 virtual TopWindow *getWindow() const;
00112
00115 virtual void onPositionChange() {}
00116
00118 virtual void onVarBoolUpdate( VarBool &rVar ) {}
00119
00120 private:
00122 GenericLayout *m_pLayout;
00124 Position *m_pPosition;
00126 UString m_help;
00128 VarBool *m_pVisible;
00129
00131 virtual void onUpdate( Subject<VarBool> &rVariable );
00132 };
00133
00134 typedef CountedPtr<CtrlGeneric> CtrlGenericPtr;
00135
00136
00137 #endif