Merge remote-tracking branch 'Math07/working'

This commit is contained in:
Marianne Gagnon 2014-12-29 19:25:04 -05:00
commit 3a1b0bc351
2 changed files with 22 additions and 2 deletions

View File

@ -326,6 +326,7 @@ void SpinnerWidget::addLabel(stringw label)
void SpinnerWidget::setValue(const int new_value)
{
m_value = new_value;
m_customText = "";
if (m_graphical)
{
@ -397,7 +398,14 @@ void SpinnerWidget::setActivated()
Widget::setActivated();
setText(L"");
setValue( getValue() ); // Update the display
if (m_customText.empty())
{
setValue( getValue() ); // Update the display
}
else
{
setCustomText(m_customText);
}
}
// -----------------------------------------------------------------------------
@ -406,14 +414,21 @@ void SpinnerWidget::setDeactivated()
{
Widget::setDeactivated();
// Save it temporary because setValue(which is uses for update in this case) overwrites it
core::stringw customText = m_customText;
setText(L"-");
setValue( getValue() ); // Update the display
m_customText = customText;
}
// -----------------------------------------------------------------------------
void SpinnerWidget::setCustomText(const core::stringw& text)
{
m_children[1].m_element->setText(text.c_str());
m_customText = text;
if (m_children.size() > 0)
{
m_children[1].m_element->setText(text.c_str());
}
}

View File

@ -75,6 +75,11 @@ namespace GUIEngine
/** \brief Whether to wrap back to the first value when going "beyond" the last value */
bool m_wrap_around;
/** \brief Keeps track of the custom text in spinner (a text which isn't related to a value)
* to remember it and set it back (example : when we deactivate the widget)
*/
core::stringw m_customText;
/** \brief implementing method from base class Widget */
virtual EventPropagation transmitEvent(Widget* w,