Spinners can now contain text + the number; used it for the number of laps selector
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3696 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c8e7c5b92b
commit
c08e0eaf0a
@ -44,8 +44,11 @@ over values (default will be from 0 to 10). You can specify an icon; then, inclu
|
||||
like %i in the name, and at runtime the current number will be inserted into the given name to find the
|
||||
right file for each possible value the spinner can take. It may also display arbitrary text instead of
|
||||
numbers, though this cannot be achieve in the XML file; use 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.
|
||||
The "gauge" variant behaves similarly, but a fill band shows how close to the max the value is.
|
||||
|
||||
|
||||
WTYPE_BUTTON "button"
|
||||
A plain text buttons.
|
||||
|
||||
|
@ -117,12 +117,6 @@ void ModalDialog::onEnterPressedInternal()
|
||||
PressAKeyDialog::PressAKeyDialog(const float w, const float h) :
|
||||
ModalDialog(w, h)
|
||||
{
|
||||
//core::rect< s32 > area2(0, 0, m_area.getWidth(), m_area.getHeight());
|
||||
//IGUIStaticText* label = GUIEngine::getGUIEnv()->addStaticText( stringw(_("Press a key")).c_str(),
|
||||
// area2, false /* border */, true /* word wrap */,
|
||||
// m_irrlicht_window);
|
||||
//label->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||
|
||||
LabelWidget* widget = new LabelWidget();
|
||||
widget->m_properties[PROP_TEXT] = _("Press a key");
|
||||
widget->m_properties[PROP_TEXT_ALIGN] = "center";
|
||||
@ -300,6 +294,7 @@ TrackInfoDialog::TrackInfoDialog(const char* trackName, ITexture* screenshot, co
|
||||
|
||||
widget->m_properties[PROP_MIN_VALUE] = "1";
|
||||
widget->m_properties[PROP_MAX_VALUE] = "99";
|
||||
widget->m_properties[PROP_TEXT] = "%i laps";
|
||||
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
|
@ -617,8 +617,6 @@ void Screen::processAction(const int action, const unsigned int value, Input::In
|
||||
case PA_FIRE:
|
||||
if(type == Input::IT_STICKBUTTON)
|
||||
{
|
||||
|
||||
std::cout << "sending event, pressedDown=" << pressedDown << "\n";
|
||||
// simulate a 'enter' key press. doesn't seem to work
|
||||
irr::SEvent::SKeyInput evt;
|
||||
evt.PressedDown = pressedDown;
|
||||
@ -666,7 +664,7 @@ bool Screen::OnEvent(const SEvent& event)
|
||||
Widget* w = getWidget(id);
|
||||
if(w == NULL) break;
|
||||
|
||||
if(ModalDialog::isADialogActive())
|
||||
if(ModalDialog::isADialogActive() && w->m_event_handler == NULL)
|
||||
{
|
||||
ModalDialog::getCurrent()->processEvent(w->m_properties[PROP_ID]);
|
||||
return false;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "gui/engine.hpp"
|
||||
#include "gui/my_button.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -854,9 +856,19 @@ void SpinnerWidget::setValue(const int new_value)
|
||||
((IGUIImage*)(m_children[1].m_element))->setImage(GUIEngine::getDriver()->getTexture(imagefile));
|
||||
}
|
||||
else if(m_labels.size() > 0)
|
||||
{
|
||||
m_children[1].m_element->setText( stringw(m_labels[new_value].c_str()).c_str() );
|
||||
}
|
||||
else if(m_properties[PROP_TEXT].size() > 0)
|
||||
{
|
||||
char text[128];
|
||||
sprintf(text, _(m_properties[PROP_TEXT].c_str()), m_value );
|
||||
m_children[1].m_element->setText( stringw(text).c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_children[1].m_element->setText( stringw(m_value).c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
Loading…
Reference in New Issue
Block a user