* ctrl_button.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_button.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_button.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlButton::CtrlButton( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown, CmdGeneric &rCommand,
- const UString &rTooltip, const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rCommand( rCommand ),
- m_tooltip( rTooltip ),
+ const UString &rTooltip, const UString &rHelp,
+ VarBool *pVisible ):
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
+ m_rCommand( rCommand ), m_tooltip( rTooltip ),
m_cmdUpOverDownOver( this, &transUpOverDownOver ),
m_cmdDownOverUpOver( this, &transDownOverUpOver ),
m_cmdDownOverDown( this, &transDownOverDown ),
* ctrl_button.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_button.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_button.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
const GenericBitmap &rBmpOver,
const GenericBitmap &rBmpDown,
CmdGeneric &rCommand, const UString &rTooltip,
- const UString &rHelp );
+ const UString &rHelp, VarBool *pVisible );
virtual ~CtrlButton();
* ctrl_checkbox.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_checkbox.cpp,v 1.2 2004/01/18 19:54:46 asmax Exp $
+ * $Id: ctrl_checkbox.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CmdGeneric &rCommand1, CmdGeneric &rCommand2,
const UString &rTooltip1,
const UString &rTooltip2,
- VarBool &rVariable, const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rVariable( rVariable ),
+ VarBool &rVariable, const UString &rHelp,
+ VarBool *pVisible ):
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
+ m_rVariable( rVariable ),
m_rCommand1( rCommand1 ), m_rCommand2( rCommand2 ),
m_tooltip1( rTooltip1 ), m_tooltip2( rTooltip2 ),
m_cmdUpOverDownOver( this, &transUpOverDownOver ),
}
-void CtrlCheckbox::onUpdate( Subject<VarBool> &rVariable )
+void CtrlCheckbox::onVarBoolUpdate( VarBool &rVariable )
{
changeButton();
}
* ctrl_checkbox.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_checkbox.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_checkbox.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
class GenericBitmap;
class OSGraphics;
class CmdGeneric;
-class VarBool;
/// Base class for checkbox controls
-class CtrlCheckbox: public CtrlGeneric, public Observer<VarBool>
+class CtrlCheckbox: public CtrlGeneric
{
public:
/// Create a checkbox with 6 images
const GenericBitmap &rBmpDown2,
CmdGeneric &rCommand1, CmdGeneric &rCommand2,
const UString &rTooltip1, const UString &rTooltip2,
- VarBool &rVariable, const UString &rHelp );
+ VarBool &rVariable, const UString &rHelp,
+ VarBool *pVisible);
virtual ~CtrlCheckbox();
static void transHiddenUp( SkinObject *pCtrl );
/// Method called when the observed variable is modified
- virtual void onUpdate( Subject<VarBool> &rVariable );
+ virtual void onVarBoolUpdate( VarBool &rVariable );
/// Helper function to update the current state of images
void changeButton();
* ctrl_flat.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_flat.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_flat.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
class CtrlFlat: public CtrlGeneric
{
protected:
- CtrlFlat( intf_thread_t *pIntf, const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ) {}
+ CtrlFlat( intf_thread_t *pIntf, const UString &rHelp,
+ VarBool *pVisible ):
+ CtrlGeneric( pIntf, rHelp, pVisible ) {}
+
virtual ~CtrlFlat() {}
};
* ctrl_generic.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_generic.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_generic.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#include "../src/generic_window.hpp"
#include "../src/os_graphics.hpp"
#include "../utils/position.hpp"
+#include "../utils/var_bool.hpp"
-CtrlGeneric::CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp ):
+CtrlGeneric::CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
+ VarBool *pVisible):
SkinObject( pIntf ), m_pLayout( NULL ), m_pPosition( NULL ),
- m_help( rHelp )
+ m_help( rHelp ), m_pVisible( pVisible )
{
+ // Observe the visibility variable
+ if( m_pVisible )
+ {
+ m_pVisible->addObserver( this );
+ }
}
{
delete m_pPosition;
}
+ if( m_pVisible )
+ {
+ m_pVisible->delObserver( this );
+ }
}
return NULL;
}
+
+bool CtrlGeneric::isVisible() const
+{
+ return !m_pVisible || m_pVisible->get();
+}
+
+
+void CtrlGeneric::onUpdate( Subject<VarBool> &rVariable )
+{
+ // Is it the visibily variable ?
+ if( &rVariable == m_pVisible )
+ {
+ // Redraw the layout
+ notifyLayout();
+ }
+ else
+ {
+ // Call the user-defined callback
+ onVarBoolUpdate( (VarBool&)rVariable );
+ }
+}
+
* ctrl_generic.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_generic.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_generic.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#include "../utils/pointer.hpp"
#include "../utils/fsm.hpp"
#include "../utils/ustring.hpp"
+#include "../utils/observer.hpp"
class EvtGeneric;
class OSGraphics;
class GenericLayout;
class Position;
class GenericWindow;
+class VarBool;
/// Base class for controls
-class CtrlGeneric: public SkinObject
+class CtrlGeneric: public SkinObject, public Observer<VarBool>
{
public:
virtual ~CtrlGeneric();
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return false; }
+ /// Return true if the control is visible
+ virtual bool isVisible() const;
+
protected:
- CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp );
+ // If pVisible is NULL, the control is always visible
+ CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
+ VarBool *pVisible = NULL );
/// Tell the layout when the image has changed
virtual void notifyLayout() const;
/// the Position object is set
virtual void onPositionChange() {}
+ /// Overload this method to get notified of bool variable changes
+ virtual void onVarBoolUpdate( VarBool &rVar ) {}
+
private:
/// Associated layout
GenericLayout *m_pLayout;
Position *m_pPosition;
/// Help text
UString m_help;
+ /// Visibilty variable
+ VarBool *m_pVisible;
+
+ /// Method called when an observed bool variable is changed
+ virtual void onUpdate( Subject<VarBool> &rVariable );
};
typedef CountedPtr<CtrlGeneric> CtrlGenericPtr;
* ctrl_image.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_image.cpp,v 1.2 2004/02/01 14:44:11 asmax Exp $
+ * $Id: ctrl_image.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlImage::CtrlImage( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
- const UString &rHelp ):
- CtrlFlat( pIntf, rHelp ), m_rBitmap( rBitmap )
+ const UString &rHelp, VarBool *pVisible ):
+ CtrlFlat( pIntf, rHelp, pVisible ), m_rBitmap( rBitmap )
{
OSFactory *pOsFactory = OSFactory::instance( pIntf );
// Create an initial unscaled image in the buffer
* ctrl_image.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_image.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_image.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
public:
// Create an image with the given bitmap (which is NOT copied)
CtrlImage( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
- const UString &rHelp );
+ const UString &rHelp, VarBool *pVisible );
virtual ~CtrlImage();
/// Handle an event on the control
* ctrl_list.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_list.cpp,v 1.2 2004/02/27 13:24:12 gbazin Exp $
+ * $Id: ctrl_list.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlList::CtrlList( intf_thread_t *pIntf, VarList &rList, GenericFont &rFont,
uint32_t fgColor, uint32_t playColor, uint32_t bgColor1,
uint32_t bgColor2, uint32_t selColor,
- const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ), m_rList( rList ), m_rFont( rFont ),
+ const UString &rHelp, VarBool *pVisible ):
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_rList( rList ), m_rFont( rFont ),
m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ),
m_bgColor2( bgColor2 ), m_selColor( selColor ), m_pLastSelected( NULL ),
m_pImage( NULL ), m_lastPos( 0 )
* ctrl_list.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_list.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_list.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlList( intf_thread_t *pIntf, VarList &rList, GenericFont &rFont,
uint32_t fgcolor, uint32_t playcolor, uint32_t bgcolor1,
uint32_t bgcolor2, uint32_t selColor,
- const UString &rHelp );
+ const UString &rHelp, VarBool *pVisible );
virtual ~CtrlList();
/// Handle an event on the control.
* ctrl_move.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_move.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_move.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlMove::CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericWindow &rWindow,
- const UString &rHelp ):
- CtrlFlat( pIntf, rHelp ), m_fsm( pIntf ),
+ const UString &rHelp, VarBool *pVisible ):
+ CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
m_rWindowManager( rWindowManager ),
m_rCtrl( rCtrl ), m_rWindow( rWindow ),
m_cmdMovingMoving( this, &transMovingMoving ),
* ctrl_move.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_move.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_move.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
public:
CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat &rCtrl, GenericWindow &rWindow,
- const UString &rHelp );
+ const UString &rHelp, VarBool *pVisible );
virtual ~CtrlMove() {}
/// Handle an event
* ctrl_radialslider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_radialslider.cpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
+ * $Id: ctrl_radialslider.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf,
const GenericBitmap &rBmpSeq, int numImg,
VarPercent &rVariable, float minAngle,
- float maxAngle, const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_numImg( numImg ),
+ float maxAngle, const UString &rHelp,
+ VarBool *pVisible ):
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_numImg( numImg ),
m_rVariable( rVariable ), m_minAngle( minAngle ), m_maxAngle( maxAngle ),
m_cmdUpDown( this, &transUpDown ), m_cmdDownUp( this, &transDownUp ),
m_cmdMove( this, &transMove ), m_position( 0 ), m_lastPos( 0 )
* ctrl_radialslider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_radialslider.hpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
+ * $Id: ctrl_radialslider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// composed of numImg subimages of the same size
CtrlRadialSlider( intf_thread_t *pIntf, const GenericBitmap &rBmpSeq,
int numImg, VarPercent &rVariable, float minAngle,
- float maxAngle, const UString &rHelp );
+ float maxAngle, const UString &rHelp,
+ VarBool *pVisible );
virtual ~CtrlRadialSlider();
* ctrl_resize.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_resize.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_resize.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlResize::CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl,
- GenericLayout &rLayout, const UString &rHelp ):
- CtrlFlat( pIntf, rHelp ), m_fsm( pIntf ), m_rCtrl( rCtrl ),
+ GenericLayout &rLayout, const UString &rHelp,
+ VarBool *pVisible ):
+ CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_rCtrl( rCtrl ),
m_rLayout( rLayout ), m_cmdResizeResize( this, &transResizeResize ),
m_cmdStillResize( this, &transStillResize ),
m_cmdResizeStill( this, &transResizeStill )
* ctrl_resize.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_resize.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_resize.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
{
public:
CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl,
- GenericLayout &rLayout, const UString &rHelp );
+ GenericLayout &rLayout, const UString &rHelp,
+ VarBool *pVisible );
virtual ~CtrlResize() {}
/// Handle an event
* ctrl_slider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_slider.cpp,v 1.3 2004/02/01 21:13:04 ipkiss Exp $
+ * $Id: ctrl_slider.cpp,v 1.4 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
VarBool *pVisible,
const UString &rTooltip,
const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rVariable( rVariable ),
- m_pVisible( pVisible ), m_tooltip( rTooltip ),
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
+ m_rVariable( rVariable ), m_tooltip( rTooltip ),
m_width( rCurve.getWidth() ), m_height( rCurve.getHeight() ),
m_cmdOverDown( this, &transOverDown ),
m_cmdDownOver( this, &transDownOver ), m_cmdOverUp( this, &transOverUp ),
// Observe the position variable
m_rVariable.addObserver( this );
- // Observe the visibility variable
- if( m_pVisible )
- {
- m_pVisible->addObserver( this );
- }
-
// Initial position of the cursor
m_lastPercentage = m_rVariable.get();
}
CtrlSliderCursor::~CtrlSliderCursor()
{
m_rVariable.delObserver( this );
- if( m_pVisible )
- {
- m_pVisible->delObserver( this );
- }
SKINS_DELETE( m_pImgUp );
SKINS_DELETE( m_pImgDown );
SKINS_DELETE( m_pImgOver );
void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest )
{
- if( m_pImg && (!m_pVisible || m_pVisible->get()) )
+ if( m_pImg )
{
// Compute the position of the cursor
int xPos, yPos;
}
-void CtrlSliderCursor::onUpdate( Subject<VarBool> &rVariable )
-{
- // The visibility variable has changed
- notifyLayout();
-}
-
-
void CtrlSliderCursor::transOverDown( SkinObject *pCtrl )
{
CtrlSliderCursor *pThis = (CtrlSliderCursor*)pCtrl;
const Bezier &rCurve, VarPercent &rVariable,
int thickness, VarBool *pVisible,
const UString &rHelp ):
- CtrlGeneric( pIntf, rHelp ), m_rCursor( rCursor ), m_rVariable( rVariable ),
- m_thickness( thickness ), m_pVisible( pVisible ), m_curve( rCurve ),
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_rCursor( rCursor ),
+ m_rVariable( rVariable ), m_thickness( thickness ), m_curve( rCurve ),
m_width( rCurve.getWidth() ), m_height( rCurve.getHeight() )
{
}
bool CtrlSliderBg::mouseOver( int x, int y ) const
{
- if( m_pVisible && !m_pVisible->get() )
- {
- return false;
- }
-
// Compute the resize factors
float factorX, factorY;
getResizeFactors( factorX, factorY );
}
-void CtrlSliderBg::onUpdate( Subject<VarBool> &rVariable )
-{
- // The visibility variable has changed
- notifyLayout();
-}
-
-
void CtrlSliderBg::getResizeFactors( float &rFactorX, float &rFactorY ) const
{
// Get the position of the control
* ctrl_slider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_slider.hpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
+ * $Id: ctrl_slider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
class GenericBitmap;
class OSGraphics;
class VarPercent;
-class VarBool;
/// Cursor of a slider
-class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>,
- public Observer<VarBool>
+class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
{
public:
/// Create a cursor with 3 images (which are NOT copied, be careful)
FSM m_fsm;
/// Variable associated to the cursor
VarPercent &m_rVariable;
- /// Visibility variable
- VarBool *m_pVisible;
/// Tooltip text
const UString m_tooltip;
/// Initial size of the control
/// Method called when the position variable is modified
virtual void onUpdate( Subject<VarPercent> &rVariable );
- /// Method called when the visibility variable is modified
- virtual void onUpdate( Subject<VarBool> &rVariable );
-
/// Methode to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
};
class CtrlSliderBg: public CtrlGeneric
{
public:
- /// If pVisible is NULL, the control is always visible
CtrlSliderBg( intf_thread_t *pIntf, CtrlSliderCursor &rCursor,
const Bezier &rCurve, VarPercent &rVariable,
int thickness, VarBool *pVisible, const UString &rHelp );
VarPercent &m_rVariable;
/// Thickness of the curve
int m_thickness;
- /// Visibility variable
- VarBool *m_pVisible;
/// Bezier curve of the slider
const Bezier m_curve;
/// Initial size of the control
/// Methode to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
-
- /// Method called when the visibility variable is modified
- virtual void onUpdate( Subject<VarBool> &rVariable );
};
* ctrl_text.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_text.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_text.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlText::CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const GenericFont &rFont, const UString &rHelp,
- uint32_t color ):
- CtrlGeneric( pIntf, rHelp ), m_fsm( pIntf ), m_rVariable( rVariable ),
- m_cmdToManual( this, &transToManual ),
+ uint32_t color, VarBool *pVisible ):
+ CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ),
+ m_rVariable( rVariable ), m_cmdToManual( this, &transToManual ),
m_cmdManualMoving( this, &transManualMoving ),
m_cmdManualStill( this, &transManualStill ),
m_cmdMove( this, &transMove ),
* ctrl_text.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_text.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: ctrl_text.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
/// Create a text control with the optional given color
CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const GenericFont &rFont, const UString &rHelp,
- uint32_t color = 0 );
+ uint32_t color, VarBool *pVisible );
virtual ~CtrlText();
/// Handle an event
* builder.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: builder.cpp,v 1.6 2004/02/27 13:24:12 gbazin Exp $
+ * $Id: builder.cpp,v 1.7 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
CtrlButton *pButton = new CtrlButton( getIntf(), *pBmpUp, *pBmpOver,
*pBmpDown, *pCommand, UString( getIntf(), rData.m_tooltip.c_str() ),
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ), NULL );
// Compute the position of the control
// XXX (we suppose all the images have the same size...)
*pBmpOver1, *pBmpDown1, *pBmpUp2, *pBmpOver2, *pBmpDown2, *pCommand1,
*pCommand2, UString( getIntf(), rData.m_tooltip1.c_str() ),
UString( getIntf(), rData.m_tooltip2.c_str() ), *pVar,
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ), NULL );
// Compute the position of the control
// XXX (we suppose all the images have the same size...)
}
CtrlImage *pImage = new CtrlImage( getIntf(), *pBmp,
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ),
+ NULL);
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
if( rData.m_onclickId == "move" )
{
CtrlMove *pMove = new CtrlMove( getIntf(), m_pTheme->getWindowManager(),
- *pImage, *pWindow, UString( getIntf(), rData.m_help.c_str() ) );
+ *pImage, *pWindow, UString( getIntf(), rData.m_help.c_str() ),
+ NULL);
pLayout->addControl( pMove, pos, rData.m_layer );
}
else if( rData.m_onclickId == "resize" )
{
CtrlResize *pResize = new CtrlResize( getIntf(), *pImage, *pLayout,
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ), NULL );
pLayout->addControl( pResize, pos, rData.m_layer );
}
else
m_pTheme->m_vars.push_back( VariablePtr( pVar ) );
CtrlText *pText = new CtrlText( getIntf(), *pVar, *pFont,
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ), rData.m_color, NULL );
int height = pFont->getSize();
CtrlRadialSlider *pRadial =
new CtrlRadialSlider( getIntf(), *pSeq, rData.m_nbImages, *pVar,
rData.m_minAngle, rData.m_maxAngle,
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ),
+ NULL );
// XXX: resizing is not supported
// Compute the position of the control
CtrlList *pList = new CtrlList( getIntf(), *pVar, *pFont,
rData.m_fgColor, rData.m_playColor, rData.m_bgColor1,
rData.m_bgColor2, rData.m_selColor,
- UString( getIntf(), rData.m_help.c_str() ) );
+ UString( getIntf(), rData.m_help.c_str() ), NULL );
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
Button id:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string visible:bool bmpId:string onclickId:string help:string layer:int windowId:string layoutId:string
-Text id:string xPos:int yPos:int fontId:string text:string width:int help:string layer:int windowId:string layoutId:string
+Text id:string xPos:int yPos:int fontId:string text:string width:int color:uint32_t help:string layer:int windowId:string layoutId:string
RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string
Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string points:string thickness:int value:string tooltip:string help:string layer:int windowId:string layoutId:string
List id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string fontId:string var:string fgColor:uint32_t playColor:uint32_t bgColor1:uint32_t bgColor2:uint32_t selColor:uint32_t help:string layer:int windowId:string layoutId:string
* builder_data.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: builder_data.hpp,v 1.4 2004/02/27 13:24:12 gbazin Exp $
+ * $Id: builder_data.hpp,v 1.5 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#ifndef BUILDER_DATA_HPP
#define BUILDER_DATA_HPP
+using namespace std;
+
#include <vlc/vlc.h>
#include <list>
+#include <map>
#include <string>
-using namespace std;
-
/// Structure for mapping data from XML file
struct BuilderData
{
/// Type definition
struct Text
{
- Text( const string & id, int xPos, int yPos, const string & fontId, const string & text, int width, const string & help, int layer, const string & windowId, const string & layoutId ):
-m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_fontId( fontId ), m_text( text ), m_width( width ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
+ Text( const string & id, int xPos, int yPos, const string & fontId, const string & text, int width, uint32_t color, const string & help, int layer, const string & windowId, const string & layoutId ):
+m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_fontId( fontId ), m_text( text ), m_width( width ), m_color( color ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
const string m_id;
int m_xPos;
const string m_fontId;
const string m_text;
int m_width;
+ uint32_t m_color;
const string m_help;
int m_layer;
const string m_windowId;
* skin_parser.cpp
*****************************************************************************
* Copyright (C) 2004 VideoLAN
- * $Id: skin_parser.cpp,v 1.1 2004/01/25 11:44:19 asmax Exp $
+ * $Id: skin_parser.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
{
const BuilderData::Text textData( attr["id"], atoi( attr["x"] ) +
m_xOffset, atoi( attr["y"] ) + m_yOffset, attr["font"],
- attr["text"], atoi( attr["width"] ), attr["help"], m_curLayer,
+ attr["text"], atoi( attr["width"] ),
+ ConvertColor( attr["color"] ), attr["help"], m_curLayer,
m_curWindowId, m_curLayoutId );
m_curLayer++;
m_data.m_listText.push_back( textData );
* generic_layout.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: generic_layout.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id: generic_layout.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
void GenericLayout::onControlUpdate( const CtrlGeneric &rCtrl )
{
+ // TODO: refresh only the needed area if possible
refreshAll();
}
list<LayeredControl>::const_iterator iter;
for( iter = m_controlList.begin(); iter != m_controlList.end(); iter++ )
{
- const Position *pPos = (*iter).m_pControl->getPosition();
- if( pPos )
+ CtrlGeneric *pCtrl = (*iter).m_pControl;
+ const Position *pPos = pCtrl->getPosition();
+ if( pCtrl->isVisible() && pPos )
{
- (*iter).m_pControl->draw( *m_pImage, pPos->getLeft(),
- pPos->getTop() );
+ pCtrl->draw( *m_pImage, pPos->getLeft(), pPos->getTop() );
}
}
* generic_window.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: generic_window.cpp,v 1.2 2004/01/25 21:38:57 asmax Exp $
+ * $Id: generic_window.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
int xRel = xPos - pos->getLeft();
int yRel = yPos - pos->getTop();
+ CtrlGeneric *pCtrl = (*iter).m_pControl;
// Control hit ?
- if( (*iter).m_pControl->mouseOver( xRel, yRel ) )
+ if( pCtrl->isVisible() && pCtrl->mouseOver( xRel, yRel ) )
{
pNewHitControl = (*iter).m_pControl;
break;
y CDATA "0"
text CDATA "\0"
font CDATA #REQUIRED
- align CDATA "left"
+ color CDATA "#000000"
width CDATA "0"
- display CDATA "none"
- scroll CDATA "true"
- scrollspace CDATA "20"
help CDATA "\0"
>
<!ELEMENT Playlist (Slider)>
<Group x="0" y="0">\r
<Anchor x="7" y="151" priority="100"/>\r
<Image x="0" y="0" image="mainbody" onclick="move"/>\r
- <Text font="default_font" width="70" x="287" y="79" text="$T"/>\r
+ <Text font="default_font" width="70" x="287" y="79" text="$T" color="#000000"/>\r
<Button x="42" y="42" up="preferences" down="preferences_onclick" over="preferences" action="dialogs.prefs()" tooltiptext="Preferences"/>\r
<Button x="17" y="64" up="stop" down="stop_onclick" over="stop" action="vlc.stop()" tooltiptext="Stop"/>\r
<CheckBox x="42" y="87" up1="playlist_button" down1="playlist_button_onclick" up2="playlist_button2" down2="playlist_button_onclick2" state="playlist_window.isVisible" action1="playlist_window.show()" action2="playlist_window.hide()" tooltiptext1="Show Playlist" tooltiptext2="Hide Playlist"/>\r