Commit e1670aca authored by Olivier Teulière's avatar Olivier Teulière

* modules/gui/skins2/*: The second template argument of the Subject and

   Observer classes now has a default value. This simplifies the code in many
   places.
parent 4a3d46bd
......@@ -131,7 +131,7 @@ void CtrlButton::setImage( AnimBitmap *pImg )
}
void CtrlButton::onUpdate( Subject<AnimBitmap, void*> &rBitmap, void *arg )
void CtrlButton::onUpdate( Subject<AnimBitmap> &rBitmap, void *arg )
{
notifyLayout();
}
......
......@@ -88,7 +88,7 @@ class CtrlButton: public CtrlGeneric, public Observer<AnimBitmap, void*>
void setImage( AnimBitmap *pImg );
/// Method called when an animated bitmap changes
virtual void onUpdate( Subject<AnimBitmap, void*> &rBitmap, void* );
virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
};
......
......@@ -246,7 +246,7 @@ void CtrlCheckbox::onVarBoolUpdate( VarBool &rVariable )
}
void CtrlCheckbox::onUpdate( Subject<AnimBitmap, void*> &rBitmap, void *arg )
void CtrlCheckbox::onUpdate( Subject<AnimBitmap> &rBitmap, void *arg )
{
notifyLayout();
}
......
......@@ -109,7 +109,7 @@ class CtrlCheckbox: public CtrlGeneric, public Observer<AnimBitmap, void*>
virtual void onVarBoolUpdate( VarBool &rVariable );
/// Method called when an animated bitmap changes
virtual void onUpdate( Subject<AnimBitmap, void*> &rBitmap, void* );
virtual void onUpdate( Subject<AnimBitmap> &rBitmap, void* );
/// Change the current image
void setImage( AnimBitmap *pImg );
......
......@@ -155,7 +155,7 @@ bool CtrlGeneric::isVisible() const
}
void CtrlGeneric::onUpdate( Subject<VarBool, void*> &rVariable, void *arg )
void CtrlGeneric::onUpdate( Subject<VarBool> &rVariable, void *arg )
{
// Is it the visibility variable ?
if( &rVariable == m_pVisible )
......
......@@ -128,7 +128,7 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool, void*>
VarBool *m_pVisible;
/// Method called when an observed bool variable is changed
virtual void onUpdate( Subject<VarBool, void*> &rVariable , void* );
virtual void onUpdate( Subject<VarBool> &rVariable , void* );
};
typedef CountedPtr<CtrlGeneric> CtrlGenericPtr;
......
......@@ -72,14 +72,14 @@ CtrlList::~CtrlList()
}
void CtrlList::onUpdate( Subject<VarList, void*> &rList, void *arg )
void CtrlList::onUpdate( Subject<VarList> &rList, void *arg )
{
autoScroll();
m_pLastSelected = NULL;
}
void CtrlList::onUpdate( Subject<VarPercent, void*> &rPercent, void *arg )
void CtrlList::onUpdate( Subject<VarPercent> &rPercent, void *arg )
{
// Get the size of the control
const Position *pPos = getPosition();
......
......@@ -88,10 +88,10 @@ class CtrlList: public CtrlGeneric, public Observer<VarList, void*>,
int m_lastPos;
/// Method called when the list variable is modified
virtual void onUpdate( Subject<VarList, void*> &rList, void* );
virtual void onUpdate( Subject<VarList> &rList, void* );
/// Method called when the position variable of the list is modified
virtual void onUpdate( Subject<VarPercent, void*> &rPercent, void* );
virtual void onUpdate( Subject<VarPercent> &rPercent, void* );
/// Called when the position is set
virtual void onPositionChange();
......
......@@ -98,7 +98,7 @@ void CtrlRadialSlider::draw( OSGraphics &rImage, int xDest, int yDest )
}
void CtrlRadialSlider::onUpdate( Subject<VarPercent,void*> &rVariable,
void CtrlRadialSlider::onUpdate( Subject<VarPercent> &rVariable,
void *arg )
{
m_position = (int)( m_rVariable.get() * m_numImg );
......
......@@ -86,7 +86,7 @@ class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent, void*>
DEFINE_CALLBACK( CtrlRadialSlider, Move )
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarPercent,void*> &rVariable, void* );
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
/// Change the position of the cursor, with the given position of
/// the mouse (relative to the layout). Is blocking is true, the
......
......@@ -159,7 +159,7 @@ void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest )
}
void CtrlSliderCursor::onUpdate( Subject<VarPercent,void*> &rVariable,
void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable,
void *arg )
{
// The position has changed
......@@ -426,7 +426,7 @@ void CtrlSliderBg::associateCursor( CtrlSliderCursor &rCursor )
}
void CtrlSliderBg::onUpdate( Subject<VarPercent, void*> &rVariable, void*arg )
void CtrlSliderBg::onUpdate( Subject<VarPercent> &rVariable, void*arg )
{
m_position = (int)( m_rVariable.get() * (m_nbHoriz * m_nbVert - 1) );
notifyLayout( m_bgWidth, m_bgHeight );
......
......@@ -98,7 +98,7 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent, void*>
const Bezier &m_rCurve;
/// Method called when the position variable is modified
virtual void onUpdate( Subject<VarPercent,void*> &rVariable, void * );
virtual void onUpdate( Subject<VarPercent> &rVariable, void * );
/// Method to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
......@@ -157,7 +157,7 @@ class CtrlSliderBg: public CtrlGeneric, public Observer<VarPercent, void*>
int m_position;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarPercent,void*> &rVariable, void* );
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
/// Method to compute the resize factors
void getResizeFactors( float &rFactorX, float &rFactorY ) const;
......
......@@ -211,7 +211,7 @@ void CtrlText::setText( const UString &rText, uint32_t color )
}
void CtrlText::onUpdate( Subject<VarText, void*> &rVariable, void* arg )
void CtrlText::onUpdate( Subject<VarText> &rVariable, void* arg )
{
if( isVisible() )
{
......
......@@ -122,7 +122,7 @@ class CtrlText: public CtrlGeneric, public Observer<VarText, void*>
DEFINE_CALLBACK( CtrlText, UpdateText );
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarText,void*> &rVariable, void* );
virtual void onUpdate( Subject<VarText> &rVariable, void* );
/// Display the text on the control
void displayText( const UString &rText );
......
......@@ -189,7 +189,7 @@ void CtrlTree::onUpdate( Subject<VarTree, tree_update*> &rTree,
notifyLayout();
}
void CtrlTree::onUpdate( Subject<VarPercent, void*> &rPercent, void* arg)
void CtrlTree::onUpdate( Subject<VarPercent> &rPercent, void* arg)
{
// Determine what is the first item to display
VarTree::Iterator it = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
......
......@@ -123,7 +123,7 @@ class CtrlTree: public CtrlGeneric, public Observer<VarTree, tree_update*>,
tree_update *);
// Method called when the position variable of the tree is modified
virtual void onUpdate( Subject<VarPercent, void *> &rPercent , void *);
virtual void onUpdate( Subject<VarPercent> &rPercent , void *);
/// Called when the position is set
virtual void onPositionChange();
......
......@@ -101,7 +101,7 @@ void CtrlVideo::draw( OSGraphics &rImage, int xDest, int yDest )
}
void CtrlVideo::onUpdate( Subject<VarBox, void *> &rVoutSize, void *arg )
void CtrlVideo::onUpdate( Subject<VarBox> &rVoutSize, void *arg )
{
int newWidth = ((VarBox&)rVoutSize).getWidth() + m_xShift;
int newHeight = ((VarBox&)rVoutSize).getHeight() + m_yShift;
......
......@@ -56,7 +56,7 @@ class CtrlVideo: public CtrlGeneric, public Observer<VarBox, void*>
virtual string getType() const { return "video"; }
/// Method called when the vout size is updated
virtual void onUpdate( Subject<VarBox,void*> &rVoutSize, void* );
virtual void onUpdate( Subject<VarBox> &rVoutSize, void* );
/// Called by the layout when the control is show/hidden
void setVisible( bool visible );
......
......@@ -35,7 +35,7 @@ class OSTimer;
/// Animated bitmap
class AnimBitmap: public SkinObject, public Box,
public Subject<AnimBitmap, void*>
public Subject<AnimBitmap>
{
public:
AnimBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap );
......
......@@ -127,7 +127,7 @@ void GenericWindow::toggleOnTop( bool onTop ) const
}
void GenericWindow::onUpdate( Subject<VarBool, void*> &rVariable, void*arg )
void GenericWindow::onUpdate( Subject<VarBool> &rVariable, void*arg )
{
if( m_pVarVisible->get() )
{
......
......@@ -122,7 +122,7 @@ class GenericWindow: public SkinObject, public Observer<VarBool, void*>
mutable VarBoolImpl *m_pVarVisible;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarBool, void*> &rVariable , void*);
virtual void onUpdate( Subject<VarBool> &rVariable , void*);
};
......
......@@ -74,7 +74,7 @@ void Tooltip::hide()
}
void Tooltip::onUpdate( Subject<VarText, void*> &rVariable , void *arg)
void Tooltip::onUpdate( Subject<VarText> &rVariable , void *arg)
{
// Redisplay the tooltip
displayText( ((VarText&)rVariable).get() );
......
......@@ -65,7 +65,7 @@ class Tooltip: public SkinObject, public Observer<VarText, void*>
int m_xPos, m_yPos;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarText,void*> &rVariable, void * );
virtual void onUpdate( Subject<VarText> &rVariable, void * );
/// Display text of the tooltip
void displayText( const UString &rText );
......
......@@ -32,7 +32,7 @@ template <class S, class ARG> class Observer;
/// Template for subjects in the Observer design pattern
template <class S, class ARG> class Subject
template <class S, class ARG = void*> class Subject
{
public:
virtual ~Subject() {}
......@@ -87,7 +87,7 @@ template <class S, class ARG> class Subject
/// Template for observers in the Observer design pattern
template <class S, class ARG> class Observer
template <class S, class ARG = void*> class Observer
{
public:
virtual ~Observer() {}
......
......@@ -112,7 +112,7 @@ class Position
/// Variable implementing the Box interface
class VarBox: public Variable, public Box, public Subject<VarBox, void*>
class VarBox: public Variable, public Box, public Subject<VarBox>
{
public:
VarBox( intf_thread_t *pIntf, int width = 0, int height = 0 );
......
......@@ -60,7 +60,7 @@ VarBoolAndBool::~VarBoolAndBool()
}
void VarBoolAndBool::onUpdate( Subject<VarBool,void *> &rVariable, void *arg )
void VarBoolAndBool::onUpdate( Subject<VarBool> &rVariable, void *arg )
{
notify();
}
......@@ -82,7 +82,7 @@ VarBoolOrBool::~VarBoolOrBool()
}
void VarBoolOrBool::onUpdate( Subject<VarBool,void*> &rVariable , void*arg)
void VarBoolOrBool::onUpdate( Subject<VarBool> &rVariable , void*arg)
{
notify();
}
......@@ -101,7 +101,7 @@ VarNotBool::~VarNotBool()
}
void VarNotBool::onUpdate( Subject<VarBool, void*> &rVariable, void*arg )
void VarNotBool::onUpdate( Subject<VarBool> &rVariable, void*arg )
{
notify();
}
......
......@@ -30,7 +30,7 @@
/// Interface for read-only boolean variable
class VarBool: public Variable, public Subject<VarBool, void *>
class VarBool: public Variable, public Subject<VarBool>
{
public:
/// Get the variable type
......@@ -99,7 +99,7 @@ class VarBoolAndBool: public VarBool, public Observer<VarBool, void*>
virtual bool get() const { return m_rVar1.get() && m_rVar2.get(); }
// Called when one of the observed variables is changed
void onUpdate( Subject<VarBool, void*> &rVariable, void* );
void onUpdate( Subject<VarBool> &rVariable, void* );
private:
/// Boolean variables
......@@ -118,7 +118,7 @@ class VarBoolOrBool: public VarBool, public Observer<VarBool, void*>
virtual bool get() const { return m_rVar1.get() || m_rVar2.get(); }
// Called when one of the observed variables is changed
void onUpdate( Subject<VarBool, void*> &rVariable, void* );
void onUpdate( Subject<VarBool> &rVariable, void* );
private:
/// Boolean variables
......@@ -137,7 +137,7 @@ class VarNotBool: public VarBool, public Observer<VarBool, void*>
virtual bool get() const { return !m_rVar.get(); }
// Called when the observed variable is changed
void onUpdate( Subject<VarBool, void*> &rVariable, void* );
void onUpdate( Subject<VarBool> &rVariable, void* );
private:
/// Boolean variable
......
......@@ -34,7 +34,7 @@
/// List variable
class VarList: public Variable, public Subject<VarList, void* >
class VarList: public Variable, public Subject<VarList>
{
public:
VarList( intf_thread_t *pIntf );
......
......@@ -32,7 +32,7 @@ class VarPercent;
/// Percentage variable
class VarPercent: public Variable, public Subject<VarPercent, void*>
class VarPercent: public Variable, public Subject<VarPercent>
{
public:
VarPercent( intf_thread_t *pIntf ): Variable( pIntf ), m_value( 0 ) {}
......
......@@ -192,7 +192,7 @@ void VarText::set( const UString &rText )
}
void VarText::onUpdate( Subject<VarPercent, void*> &rVariable, void *arg )
void VarText::onUpdate( Subject<VarPercent> &rVariable, void *arg )
{
UString newText = get();
// If the text has changed, notify the observers
......@@ -204,7 +204,7 @@ void VarText::onUpdate( Subject<VarPercent, void*> &rVariable, void *arg )
}
void VarText::onUpdate( Subject<VarText,void*> &rVariable, void *arg )
void VarText::onUpdate( Subject<VarText> &rVariable, void *arg )
{
UString newText = get();
// If the text has changed, notify the observers
......
......@@ -32,7 +32,7 @@
/// String variable
class VarText: public Variable, public Subject<VarText, void*>,
class VarText: public Variable, public Subject<VarText>,
public Observer<VarPercent, void*>,
public Observer< VarText,void*>
{
......@@ -49,8 +49,8 @@ class VarText: public Variable, public Subject<VarText, void*>,
virtual const UString get() const;
/// Methods called when an observed variable is modified
virtual void onUpdate( Subject<VarPercent, void*> &rVariable, void* );
virtual void onUpdate( Subject<VarText, void*> &rVariable, void* );
virtual void onUpdate( Subject<VarPercent> &rVariable, void* );
virtual void onUpdate( Subject<VarText> &rVariable, void* );
private:
/// Stop observing other variables
......
......@@ -77,7 +77,7 @@ VariablePtr EqualizerBands::getBand( int band )
}
void EqualizerBands::onUpdate( Subject<VarPercent,void*> &rBand, void *arg )
void EqualizerBands::onUpdate( Subject<VarPercent> &rBand, void *arg )
{
// Make sure we are not called from set()
if (!m_isUpdating)
......
......@@ -52,7 +52,7 @@ class EqualizerBands: public SkinObject, public Observer<VarPercent, void*>
bool m_isUpdating;
/// Callback for band updates
virtual void onUpdate( Subject<VarPercent, void*> &rBand , void *);
virtual void onUpdate( Subject<VarPercent> &rBand , void *);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment