* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
- * Olivier Teulière <ipkiss@via.ecp.fr>
+ * Olivier Teulière <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ctrl_generic.hpp"
#include "../utils/position.hpp"
#include "../utils/var_bool.hpp"
+#include <assert.h>
+
CtrlGeneric::CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
VarBool *pVisible):
- SkinObject( pIntf ), m_pLayout( NULL ), m_pPosition( NULL ),
- m_help( rHelp ), m_pVisible( pVisible )
+ SkinObject( pIntf ), m_pLayout( NULL ), m_pVisible( pVisible ),
+ m_pPosition( NULL ), m_help( rHelp )
{
// Observe the visibility variable
if( m_pVisible )
CtrlGeneric::~CtrlGeneric()
{
- if( m_pPosition )
- {
- delete m_pPosition;
- }
if( m_pVisible )
{
m_pVisible->delObserver( this );
void CtrlGeneric::setLayout( GenericLayout *pLayout,
const Position &rPosition )
{
+ assert( !m_pLayout && pLayout);
+
m_pLayout = pLayout;
- if( m_pPosition )
- {
- delete m_pPosition;
- }
m_pPosition = new Position( rPosition );
onPositionChange();
}
+void CtrlGeneric::unsetLayout()
+{
+ assert( m_pLayout );
+
+ delete m_pPosition;
+ m_pPosition = NULL;
+ m_pLayout = NULL;
+}
void CtrlGeneric::notifyLayout( int width, int height,
- int xOffSet, int yOffSet ) const
+ int xOffSet, int yOffSet )
{
+ width = ( width > 0 ) ? width : m_pPosition->getWidth();
+ height = ( height > 0 ) ? height : m_pPosition->getHeight();
+
// Notify the layout
if( m_pLayout )
{
}
-void CtrlGeneric::notifyLayoutMaxSize( const OSGraphics *pImg1,
- const OSGraphics *pImg2 )
+void CtrlGeneric::notifyLayoutMaxSize( const Box *pImg1, const Box *pImg2 )
{
if( pImg1 == NULL )
{
}
-void CtrlGeneric::onUpdate( Subject<VarBool> &rVariable )
+void CtrlGeneric::onUpdate( Subject<VarBool> &rVariable, void *arg )
{
+ (void)arg;
// Is it the visibility variable ?
if( &rVariable == m_pVisible )
{