* $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_text.hpp"
}
// Initial state
- if( m_scrollMode == kAutomatic )
- m_fsm.setState( "outMoving" );
- else
- m_fsm.setState( "outStill" );
+ m_fsm.setState( "outStill" );
// Observe the variable
m_rVariable.addObserver( this );
CtrlText::~CtrlText()
{
m_rVariable.delObserver( this );
- if( m_pTimer )
- {
- delete m_pTimer;
- }
- if( m_pImg )
- {
- delete m_pImg;
- }
- if( m_pImgDouble )
- {
- delete m_pImgDouble;
- }
+ delete m_pTimer;
+ delete m_pImg;
+ delete m_pImgDouble;
}
}
-void CtrlText::onUpdate( Subject<VarText> &rVariable )
+void CtrlText::onUpdate( Subject<VarText> &rVariable, void* arg )
{
- displayText( m_rVariable.get() );
+ if( isVisible() )
+ {
+ displayText( m_rVariable.get() );
+ }
}
{
// Create the images ('normal' and 'double') from the text
// 'Normal' image
- if( m_pImg )
- {
- delete m_pImg;
- }
+ delete m_pImg;
m_pImg = m_rFont.drawString( rText, m_color );
if( !m_pImg )
{
}
// 'Double' image
const UString doubleStringWithSep = rText + SEPARATOR_STRING + rText;
- if( m_pImgDouble )
- {
- delete m_pImgDouble;
- }
+ delete m_pImgDouble;
m_pImgDouble = m_rFont.drawString( doubleStringWithSep, m_color );
// Update the current image used, as if the control size had changed
- onChangePosition();
+ onPositionChange();
if( m_alignment == kRight && getPosition() &&
getPosition()->getWidth() < m_pImg->getWidth() )
}
-void CtrlText::onChangePosition()
+void CtrlText::onPositionChange()
{
if( m_pImg && getPosition() )
{
if( m_pImg->getWidth() < getPosition()->getWidth() )
{
m_pCurrImg = m_pImg;
+
+ // When the control becomes wide enough for the text to display,
+ // make sure to stop any scrolling effect
+ m_pTimer->stop();
+ m_xPos = 0;
}
else
{
}
+void CtrlText::onResize()
+{
+ onPositionChange();
+}
+
+
void CtrlText::CmdToManual::execute()
{
EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;