Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

ctrl_slider.hpp

00001 /*****************************************************************************
00002  * ctrl_slider.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: ctrl_slider.hpp 12054 2005-08-06 23:45:34Z asmax $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef CTRL_SLIDER_HPP
00026 #define CTRL_SLIDER_HPP
00027 
00028 #include "ctrl_generic.hpp"
00029 #include "../utils/bezier.hpp"
00030 #include "../utils/fsm.hpp"
00031 #include "../utils/observer.hpp"
00032 
00033 
00034 class GenericBitmap;
00035 class OSGraphics;
00036 class VarPercent;
00037 
00038 
00040 class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
00041 {
00042     public:
00045         CtrlSliderCursor( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
00046                           const GenericBitmap &rBmpOver,
00047                           const GenericBitmap &rBmpDown,
00048                           const Bezier &rCurve, VarPercent &rVariable,
00049                           VarBool *pVisible, const UString &rTooltip,
00050                           const UString &rHelp );
00051 
00052         virtual ~CtrlSliderCursor();
00053 
00055         virtual void handleEvent( EvtGeneric &rEvent );
00056 
00058         virtual bool mouseOver( int x, int y ) const;
00059 
00061         virtual void draw( OSGraphics &rImage, int xDest, int yDest );
00062 
00064         virtual UString getTooltipText() const { return m_tooltip; }
00065 
00067         virtual string getType() const { return "slider_cursor"; }
00068 
00069     private:
00071         FSM m_fsm;
00073         VarPercent &m_rVariable;
00075         const UString m_tooltip;
00077         int m_width, m_height;
00079         int m_xPosition, m_yPosition;
00081         DEFINE_CALLBACK( CtrlSliderCursor, OverDown )
00082         DEFINE_CALLBACK( CtrlSliderCursor, DownOver )
00083         DEFINE_CALLBACK( CtrlSliderCursor, OverUp )
00084         DEFINE_CALLBACK( CtrlSliderCursor, UpOver )
00085         DEFINE_CALLBACK( CtrlSliderCursor, Move )
00086         DEFINE_CALLBACK( CtrlSliderCursor, Scroll )
00088         float m_lastPercentage;
00090         int m_xOffset, m_yOffset;
00092         EvtGeneric *m_pEvt;
00094         OSGraphics *m_pImgUp, *m_pImgOver, *m_pImgDown;
00096         OSGraphics *m_pImg;
00098         const Bezier &m_rCurve;
00099 
00101         virtual void onUpdate( Subject<VarPercent> &rVariable );
00102 
00104         void getResizeFactors( float &rFactorX, float &rFactorY ) const;
00105 };
00106 
00107 
00109 class CtrlSliderBg: public CtrlGeneric
00110 {
00111     public:
00112         CtrlSliderBg( intf_thread_t *pIntf, CtrlSliderCursor &rCursor,
00113                       const Bezier &rCurve, VarPercent &rVariable,
00114                       int thickness, VarBool *pVisible, const UString &rHelp );
00115         virtual ~CtrlSliderBg() {}
00116 
00118         virtual bool mouseOver( int x, int y ) const;
00119 
00121         virtual void handleEvent( EvtGeneric &rEvent );
00122 
00124         virtual string getType() const { return "slider_bg"; }
00125 
00126     private:
00128         CtrlSliderCursor &m_rCursor;
00130         VarPercent &m_rVariable;
00132         int m_thickness;
00134         const Bezier &m_rCurve;
00136         int m_width, m_height;
00137 
00139         void getResizeFactors( float &rFactorX, float &rFactorY ) const;
00140 };
00141 
00142 
00143 #endif

Generated on Tue Dec 20 10:14:41 2005 for vlc-0.8.4a by  doxygen 1.4.2