Clean up deactivating spinners, removing a few FIXMEs

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7234 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-01-03 19:13:47 +00:00
parent fdbafeb5ff
commit d22ec956b6
5 changed files with 29 additions and 11 deletions

View File

@ -137,7 +137,8 @@
the -\>addLabel(...) method in code to do this.
It can also display arbitrary text containing the value; just define the
PROP_TEXT property to contain the text you want, including a format string %i
where the value should appear.
where the value should appear (a string that does not contain %i will result
in the same text being displayed in the spinner no matter the current value).
\note The "gauge" variant behaves similarly, but a fill band shows how close
to the max the value is.

View File

@ -308,10 +308,10 @@ namespace GUIEngine
*/
/** \brief undos setDeactivated() */
void setActivated();
virtual void setActivated();
/** \brief greys out the widget, making it not clickable for the user */
void setDeactivated();
virtual void setDeactivated();
/**

View File

@ -376,3 +376,21 @@ void SpinnerWidget::setValue(irr::core::stringw new_value)
// -----------------------------------------------------------------------------
void SpinnerWidget::setActivated()
{
Widget::setActivated();
setText(L"");
setValue( getValue() ); // Update the display
}
// -----------------------------------------------------------------------------
void SpinnerWidget::setDeactivated()
{
Widget::setDeactivated();
setText(L"-");
setValue( getValue() ); // Update the display
}

View File

@ -140,6 +140,12 @@ namespace GUIEngine
* \return the minimum value the spinner can take
*/
int getMin() const { return m_min; }
/** Override method from base class Widget */
virtual void setActivated();
/** Override method from base class Widget */
virtual void setDeactivated();
};
}

View File

@ -156,17 +156,10 @@ void RaceSetupScreen::onGameModeChanged()
if (!RaceManager::hasAI(gamemode))
{
kartamount->setDeactivated();
// dirty trick to hide the number inside the spinner (FIXME)
kartamount->setText(L"-");
kartamount->setValue( kartamount->getValue() );
}
else
{
kartamount->setActivated();
kartamount->setText(L"");
kartamount->setValue( kartamount->getValue() );
}
}
@ -181,7 +174,7 @@ void RaceSetupScreen::init()
SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
kartamount->setActivated();
kartamount->setText(L""); // FIXME: dirty trick (see below)
// Avoid negative numbers (which can happen if e.g. the number of karts
// in a previous race was lower than the number of players now.
int num_ai = race_manager->getNumberOfKarts()-race_manager->getNumPlayers();