Fixed list navigation and ribbon selection in input option screens
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4181 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
8a3bcdaa03
commit
de492f69dc
@ -42,27 +42,6 @@ using namespace gui;
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
static unsigned int id_counter = 0;
|
||||
static unsigned int id_counter_2 = 1000; // for items that can't be reached with keyboard navigation but can be clicked
|
||||
|
||||
int Widget::getNewID()
|
||||
{
|
||||
return id_counter++;
|
||||
}
|
||||
int Widget::getNewNoFocusID()
|
||||
{
|
||||
return id_counter_2++;
|
||||
}
|
||||
/** When switching to a new screen, this function will be called to reset ID counters
|
||||
* (so we start again from ID 0, and don't grow to big numbers) */
|
||||
void Widget::resetIDCounters()
|
||||
{
|
||||
id_counter = 0;
|
||||
id_counter_2 = 1000;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
Widget::Widget(bool reserve_id)
|
||||
{
|
||||
@ -89,7 +68,40 @@ Widget::Widget(bool reserve_id)
|
||||
|
||||
m_reserved_id = -1;
|
||||
}
|
||||
|
||||
Widget::~Widget()
|
||||
{
|
||||
// If any player focused this widget, unset that focus
|
||||
for (int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
{
|
||||
if (m_player_focus[n])
|
||||
{
|
||||
GUIEngine::focusNothingForPlayer(n);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
static unsigned int id_counter = 0;
|
||||
static unsigned int id_counter_2 = 1000; // for items that can't be reached with keyboard navigation but can be clicked
|
||||
|
||||
int Widget::getNewID()
|
||||
{
|
||||
return id_counter++;
|
||||
}
|
||||
int Widget::getNewNoFocusID()
|
||||
{
|
||||
return id_counter_2++;
|
||||
}
|
||||
/** When switching to a new screen, this function will be called to reset ID counters
|
||||
* (so we start again from ID 0, and don't grow to big numbers) */
|
||||
void Widget::resetIDCounters()
|
||||
{
|
||||
id_counter = 0;
|
||||
id_counter_2 = 1000;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void Widget::add()
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ namespace GUIEngine
|
||||
int m_reserved_id;
|
||||
|
||||
Widget(bool reserve_id = false);
|
||||
virtual ~Widget() {}
|
||||
virtual ~Widget();
|
||||
|
||||
/**
|
||||
* Get the underlying irrLicht GUI element, casted to the right type.
|
||||
|
@ -41,6 +41,21 @@ void ListWidget::clear()
|
||||
list->clear();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
bool ListWidget::OnEvent (const SEvent &event)
|
||||
{
|
||||
// block input events, we will handle them (vertical navigation) ourselves
|
||||
if (event.EventType == EET_KEY_INPUT_EVENT ||
|
||||
event.EventType == EET_JOYSTICK_INPUT_EVENT ||
|
||||
event.EventType == EET_MOUSE_INPUT_EVENT)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void ListWidget::addItem(const char* item)
|
||||
{
|
||||
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
|
||||
|
@ -35,6 +35,8 @@ namespace GUIEngine
|
||||
|
||||
SkinWidgetContainer m_selection_skin_info;
|
||||
|
||||
virtual bool OnEvent (const SEvent &event);
|
||||
|
||||
void add();
|
||||
void addItem(const char* item);
|
||||
|
||||
|
@ -50,6 +50,11 @@ void ModelViewWidget::add()
|
||||
|
||||
//m_element = GUIEngine::getGUIEnv()->addMeshViewer(widget_size, NULL, ++id_counter_2);
|
||||
|
||||
/*
|
||||
TODO: remove this unclean thing, I think irrlicht provides this feature:
|
||||
virtual void IGUIElement::OnPostRender (u32 timeMs)
|
||||
\brief animate the element and its children.
|
||||
*/
|
||||
GUIEngine::needsUpdate.push_back(this);
|
||||
|
||||
angle = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user