Cleanup : less publicly editable members in Widget, renamed the name of tabs in options because there was a name conflict, improved widget search into the tree

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5086 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-03-27 23:18:07 +00:00
parent f93e26e48f
commit 2f3cf6d8b4
23 changed files with 143 additions and 93 deletions

View File

@ -6,11 +6,11 @@
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png"
<icon-button id="tab_audio_video" width="128" height="128" icon="gui/options_audio_video.png"
I18N="Section in the settings menu" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png"
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png"
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
</tabs>

View File

@ -6,11 +6,11 @@
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png"
<icon-button id="tab_audio_video" width="128" height="128" icon="gui/options_audio_video.png"
I18N="Section in the settings menu" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png"
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png"
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
</tabs>

View File

@ -6,11 +6,11 @@
<spacer height="15" width="10"/>
<tabs id="options_choice" height="10%" max_height="110" width="100%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/options_audio_video.png"
<icon-button id="tab_audio_video" width="128" height="128" icon="gui/options_audio_video.png"
I18N="Section in the settings menu" text="Audio/Video"/>
<icon-button id="players" width="128" height="128" icon="gui/options_players.png"
<icon-button id="tab_players" width="128" height="128" icon="gui/options_players.png"
I18N="Section in the settings menu" text="Players"/>
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png"
<icon-button id="tab_controls" width="128" height="128" icon="gui/options_input.png"
I18N="Section in the settings menu" text="Controls"/>
</tabs>

View File

@ -153,14 +153,9 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
// we don't want that since we do our own custom processing for keys
if (w->m_type == WTYPE_LIST)
{
// cheap way to remove the focus from the element (nope, IGUIEnv::removeFocus doesn't work)
// Obviously will not work if the list if the first item of the screen.
GUIEngine::getGUIEnv()->setFocus( getCurrentScreen()->getFirstWidget()->getIrrlichtElement() );
return EVENT_BLOCK; // confirms to irrLicht that we processed it
return EVENT_BLOCK;
}
//return w->focused(0); // is this still used with the new focus implementation?
break;
}
case EGET_EDITBOX_ENTER:

View File

@ -402,9 +402,9 @@ Widget* Screen::getWidget(const char* name, ptr_vector<Widget>* within_vector)
{
Widget& widget = (*within_vector)[n];
if(widget.m_properties[PROP_ID] == name) return &widget;
if (widget.m_properties[PROP_ID] == name) return &widget;
if(widget.m_type == WTYPE_DIV)
if (widget.searchInsideMe() && widget.m_children.size() > 0)
{
Widget* el = getWidget(name, &(widget.m_children));
if(el != NULL) return el;
@ -422,9 +422,9 @@ Widget* Screen::getWidget(const int id, ptr_vector<Widget>* within_vector)
{
Widget& widget = (*within_vector)[n];
if(widget.m_element != NULL && widget.m_element->getID() == id) return &widget;
if (widget.m_element != NULL && widget.m_element->getID() == id) return &widget;
if(widget.m_children.size() > 0)
if (widget.searchInsideMe() && widget.m_children.size() > 0)
{
// std::cout << "widget = <" << widget.m_properties[PROP_ID].c_str() << "> widget.m_children.size()=" << widget.m_children.size() << std::endl;
Widget* el = getWidget(id, &(widget.m_children));
@ -443,7 +443,7 @@ Widget* Screen::getFirstWidget(ptr_vector<Widget>* within_vector)
{
if (!within_vector->get(i)->m_focusable) continue;
// if container, also checks children
// if container, also checks children (FIXME: don't hardcode which types to avoid descending into)
if (within_vector->get(i)->m_children.size() > 0 &&
within_vector->get(i)->m_type != WTYPE_RIBBON &&
within_vector->get(i)->m_type != WTYPE_SPINNER)

View File

@ -116,7 +116,14 @@ namespace GUIEngine
/** returns an object by name, casted to specified type, or NULL if not found/wrong type */
template <typename T> T* getWidget(const char* name)
{
return dynamic_cast<T*>( getWidget(name) );
Widget* out = getWidget(name);
T* outCasted = dynamic_cast<T*>( out );
if (out != NULL && outCasted == NULL)
{
fprintf(stderr, "Screen::getWidget : Widget '%s' of type '%s' cannot be casted to "
"requested type '%s'!\n", name, typeid(*out).name(), typeid(T).name());
}
return outCasted;
}
static Widget* getWidget(const char* name, ptr_vector<Widget>* within_vector);

View File

@ -57,8 +57,7 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_t
/* find which type of widget is specified by the current tag, and instanciate it */
if (!strcmp("div", xml->getNodeName()))
{
Widget* w = new Widget();
w->m_type = WTYPE_DIV;
Widget* w = new Widget(WTYPE_DIV);
append_to.push_back(w);
}
else if (!strcmp("stkgui", xml->getNodeName()))
@ -68,14 +67,12 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_t
}
else if (!strcmp("placeholder", xml->getNodeName()))
{
Widget* w = new Widget(true);
w->m_type = WTYPE_DIV;
Widget* w = new Widget(WTYPE_DIV, true);
append_to.push_back(w);
}
else if (!strcmp("box", xml->getNodeName()))
{
Widget* w = new Widget();
w->m_type = WTYPE_DIV;
Widget* w = new Widget(WTYPE_DIV);
w->m_show_bounding_box = true;
append_to.push_back(w);
}
@ -126,7 +123,7 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_t
}
else if (!strcmp("spacer", xml->getNodeName()))
{
append_to.push_back(new Widget());
append_to.push_back(new Widget(WTYPE_NONE));
}
else if (!strcmp("ribbon_grid", xml->getNodeName()))
{
@ -195,8 +192,10 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = prop_name; else widget.m_
}
/* a new div starts here, continue parsing with this new div as new parent */
if( widget.m_type == WTYPE_DIV || widget.m_type == WTYPE_RIBBON)
if (widget.getType() == WTYPE_DIV || widget.getType() == WTYPE_RIBBON)
{
parseScreenFileDiv( xml, append_to[append_to.size()-1].m_children );
}
}// end case EXN_ELEMENT
break;

View File

@ -57,7 +57,7 @@ using namespace GUIEngine;
// -----------------------------------------------------------------------------
Widget::Widget(bool reserve_id)
Widget::Widget(WidgetType type, bool reserve_id)
{
m_magic_number = 0xCAFEC001;
@ -68,7 +68,7 @@ Widget::Widget(bool reserve_id)
id = -1;
m_element = NULL;
m_title_font = false;
m_type = WTYPE_NONE;
m_type = type;
m_focusable = true;
m_event_handler = NULL;
@ -85,9 +85,12 @@ Widget::Widget(bool reserve_id)
m_selected[n] = false;
}
m_reserved_id = -1;
m_deactivated = false;
m_badges = 0;
m_reserved_id = -1;
m_deactivated = false;
m_badges = 0;
// set a default value, derivates can override this as they wish
m_check_inside_me = (m_type == WTYPE_DIV);
}
// -----------------------------------------------------------------------------

View File

@ -120,6 +120,12 @@ namespace GUIEngine
*/
bool m_selected[MAX_PLAYER_COUNT];
/**
* Whether to descend in the children of this widget when searching a widget
* from its ID or name. (children classes can override this value as they please)
*/
bool m_check_inside_me;
/**
* called when left/right keys pressed and focus is on widget.
* Returns 'EVENT_LET' if user's event handler should be notified of a change.
@ -191,6 +197,10 @@ namespace GUIEngine
* if/how much space must be added to the raw label's size for the widget to be large enough */
virtual int getHeightNeededAroundLabel() const { return 0; }
/** Type of this widget */
WidgetType m_type;
public:
/**
* This is set to NULL by default; set to something else in a widget to mean
@ -241,7 +251,7 @@ namespace GUIEngine
/** A simple flag that can be raised to hide this widget */
bool m_deactivated;
Widget(bool reserve_id = false);
Widget(WidgetType type, bool reserve_id = false);
virtual ~Widget();
/**
@ -278,10 +288,7 @@ namespace GUIEngine
* one irrlicht widgets (e.g. Spinner)
*/
ptr_vector<Widget> m_children;
/** Type of this widget */
WidgetType m_type;
/** A map that holds values for all specified widget properties (in the XML file)*/
std::map<Property, std::string> m_properties;
@ -309,6 +316,8 @@ namespace GUIEngine
*/
virtual void move(const int x, const int y, const int w, const int h);
/** \return Type of this widget */
WidgetType getType() const { return m_type; }
bool isSelected(const int playerID) const { return m_selected[playerID]; }
@ -344,6 +353,8 @@ namespace GUIEngine
* Called when irrLicht widgets cleared. Forget all references to them, they're no more valid.
*/
virtual void elementRemoved();
bool searchInsideMe() const { return m_check_inside_me; }
};

View File

@ -20,11 +20,14 @@
using namespace GUIEngine;
using namespace irr::core;
ButtonWidget::ButtonWidget()
{
m_type = WTYPE_BUTTON;
}
// -----------------------------------------------------------------------------
ButtonWidget::ButtonWidget() : Widget(WTYPE_BUTTON)
{
}
// -----------------------------------------------------------------------------
void ButtonWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
@ -35,10 +38,14 @@ void ButtonWidget::add()
m_element->setTabOrder(id);
m_element->setTabGroup(false);
}
// -----------------------------------------------------------------------------
void ButtonWidget::setLabel(irr::core::stringw label)
{
m_element->setText( label.c_str() );
m_text = label;
}
// -----------------------------------------------------------------------------

View File

@ -20,13 +20,16 @@
using namespace GUIEngine;
using namespace irr::core;
CheckBoxWidget::CheckBoxWidget()
// -----------------------------------------------------------------------------
CheckBoxWidget::CheckBoxWidget() : Widget(WTYPE_CHECKBOX)
{
m_state = true;
m_event_handler = this;
m_type = WTYPE_CHECKBOX;
}
// -----------------------------------------------------------------------------
void CheckBoxWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);

View File

@ -31,7 +31,7 @@ using namespace irr::gui;
const char* DynamicRibbonWidget::NO_ITEM_ID = "?";
DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row) : Widget(WTYPE_DYNAMIC_RIBBON)
{
m_scroll_offset = 0;
m_needed_cols = 0;
@ -42,7 +42,8 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
m_has_label = false;
m_left_widget = NULL;
m_right_widget = NULL;
m_type = WTYPE_DYNAMIC_RIBBON;
m_check_inside_me = true;
// by default, set all players to have no selection in this ribbon
for (int n=0; n<MAX_PLAYER_COUNT; n++)
@ -101,8 +102,8 @@ void DynamicRibbonWidget::add()
delete m_left_widget;
delete m_right_widget;
}
m_left_widget = new Widget();
m_right_widget = new Widget();
m_left_widget = new Widget(WTYPE_NONE);
m_right_widget = new Widget(WTYPE_NONE);
const int average_y = y + (h-m_label_height)/2;
m_arrows_w = 30;

View File

@ -25,11 +25,10 @@ using namespace irr::gui;
// -----------------------------------------------------------------------------
IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
const bool focusable, IconPathType pathType)
const bool focusable, IconPathType pathType) : Widget(WTYPE_ICON_BUTTON)
{
m_label = NULL;
m_texture = NULL;
m_type = WTYPE_ICON_BUTTON;
m_custom_aspect_ratio = 1.0f;
m_tab_stop = tab_stop;

View File

@ -21,13 +21,16 @@ using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;
LabelWidget::LabelWidget(bool title)
// -----------------------------------------------------------------------------
LabelWidget::LabelWidget(bool title) : Widget(WTYPE_LABEL)
{
m_type = WTYPE_LABEL;
m_title_font = title;
m_has_color = false;
}
// -----------------------------------------------------------------------------
void LabelWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);

View File

@ -21,18 +21,23 @@ using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;
ListWidget::ListWidget()
{
m_type = WTYPE_LIST;
}
// -----------------------------------------------------------------------------
ListWidget::ListWidget() : Widget(WTYPE_LIST)
{
}
// -----------------------------------------------------------------------------
void ListWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
m_element = GUIEngine::getGUIEnv()->addListBox (widget_size, m_parent, getNewID());
}
// -----------------------------------------------------------------------------
void ListWidget::clear()
{
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
@ -40,6 +45,7 @@ void ListWidget::clear()
list->clear();
}
// -----------------------------------------------------------------------------
/* // Doesn't work, I would need to override CGUIListBox, but this class is private
bool ListWidget::OnEvent (const SEvent &event)
@ -57,28 +63,36 @@ bool ListWidget::OnEvent (const SEvent &event)
}
}
*/
// -----------------------------------------------------------------------------
void ListWidget::addItem(const char* item)
{
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
assert(list != NULL);
list->addItem( stringw(item).c_str() );
}
// -----------------------------------------------------------------------------
int ListWidget::getSelection() const
{
const IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
assert(list != NULL);
return list->getSelected();
}
// -----------------------------------------------------------------------------
std::string ListWidget::getSelectionName() const
{
const IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
assert(list != NULL);
return stringc( list->getListItem( list->getSelected() ) ).c_str();
}
// -----------------------------------------------------------------------------
void ListWidget::unfocused(const int playerID)
{
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
@ -87,3 +101,4 @@ void ListWidget::unfocused(const int playerID)
if (list != NULL) list->setSelected(-1);
}
// -----------------------------------------------------------------------------

View File

@ -22,8 +22,10 @@ using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;
ModelViewWidget::ModelViewWidget() : IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, false, false)
ModelViewWidget::ModelViewWidget() :
IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, false, false)
{
//FIXME: find nicer way than overriding what IconButtonWidget's constructor already set...
m_type = WTYPE_MODEL_VIEW;
m_rtt_provider = NULL;
m_rotation_mode = ROTATE_OFF;

View File

@ -33,7 +33,8 @@ using namespace irr::gui;
#endif
// -----------------------------------------------------------------------------
RibbonWidget::RibbonWidget(const RibbonType type)
RibbonWidget::RibbonWidget(const RibbonType type) : Widget(WTYPE_RIBBON)
{
for (int n=0; n<MAX_PLAYER_COUNT; n++)
{
@ -41,11 +42,12 @@ RibbonWidget::RibbonWidget(const RibbonType type)
}
m_selection[0] = 0; // only player 0 has a selection by default
m_type = WTYPE_RIBBON;
m_ribbon_type = type;
m_mouse_focus = NULL;
m_listener = NULL;
m_listener = NULL;
m_check_inside_me = true;
updateSelection();
}
// -----------------------------------------------------------------------------

View File

@ -30,10 +30,11 @@ using namespace irr::video;
// -----------------------------------------------------------------------------
SpinnerWidget::SpinnerWidget(const bool gauge)
SpinnerWidget::SpinnerWidget(const bool gauge) : Widget(WTYPE_SPINNER)
{
m_gauge = gauge;
m_type = WTYPE_SPINNER;
m_check_inside_me = true; //FIXME: not sure this is necessary
}
// -----------------------------------------------------------------------------
@ -62,14 +63,15 @@ void SpinnerWidget::add()
m_value = (m_min + m_max)/2;
// create sub-widgets if they don't already exist
if(m_children.size() == 0)
if (m_children.size() == 0)
{
std::string& icon = m_properties[PROP_ICON];
m_graphical = icon.size()>0;
m_children.push_back( new Widget() );
m_children.push_back( new Widget() );
m_children.push_back( new Widget() );
//FIXME: unclean to create "fake" button/label/icon widgets!!
m_children.push_back( new Widget(WTYPE_BUTTON) );
m_children.push_back( new Widget(m_graphical ? WTYPE_ICON_BUTTON : WTYPE_LABEL) );
m_children.push_back( new Widget(WTYPE_BUTTON) );
}
int widgetID;
@ -93,7 +95,6 @@ void SpinnerWidget::add()
rect<s32> subsize_left_arrow = rect<s32>(0 ,0, h, h);
IGUIButton * left_arrow = GUIEngine::getGUIEnv()->addButton(subsize_left_arrow, btn, getNewNoFocusID(), L" ");
m_children[0].m_element = left_arrow;
m_children[0].m_type = WTYPE_BUTTON;
left_arrow->setTabStop(false);
m_children[0].m_event_handler = this;
m_children[0].m_properties[PROP_ID] = "left";
@ -109,10 +110,8 @@ void SpinnerWidget::add()
const int free_h_space = w-h*2-texture_width; // to center image
rect<s32> subsize_label = rect<s32>(h+free_h_space/2, 0, w-h+free_h_space/2, h);
//IGUIButton* subbtn = GUIEngine::getGUIEnv()->addButton(subsize_label, btn, ++id_counter_2, L"");
IGUIImage * subbtn = GUIEngine::getGUIEnv()->addImage(subsize_label, btn, getNewNoFocusID());
m_children[1].m_element = subbtn;
m_children[1].m_type = WTYPE_ICON_BUTTON;
m_children[1].id = subbtn->getID();
m_children[1].m_event_handler = this;
subbtn->setUseAlphaChannel(true);
@ -127,7 +126,6 @@ void SpinnerWidget::add()
false /* border */, true /* word wrap */,
btn, getNewNoFocusID());
m_children[1].m_element = label;
m_children[1].m_type = WTYPE_LABEL;
m_children[1].m_event_handler = this;
m_children[1].id = label->getID();
label->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
@ -141,7 +139,6 @@ void SpinnerWidget::add()
IGUIButton * right_arrow = GUIEngine::getGUIEnv()->addButton(subsize_right_arrow, btn, getNewNoFocusID(), L" ");
right_arrow->setTabStop(false);
m_children[2].m_element = right_arrow;
m_children[2].m_type = WTYPE_BUTTON;
m_children[2].m_event_handler = this;
m_children[2].m_properties[PROP_ID] = "right";
m_children[2].id = m_children[2].m_element->getID();

View File

@ -23,11 +23,13 @@ using namespace irr::core;
using namespace irr::gui;
// -----------------------------------------------------------------------------
TextBoxWidget::TextBoxWidget()
TextBoxWidget::TextBoxWidget() : Widget(WTYPE_TEXTBOX)
{
m_type = WTYPE_TEXTBOX;
}
// -----------------------------------------------------------------------------
void TextBoxWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
@ -40,7 +42,9 @@ void TextBoxWidget::add()
m_element->setTabGroup(false);
m_element->setTabStop(true);
}
// -----------------------------------------------------------------------------
stringw TextBoxWidget::getText() const
{
const IGUIEditBox* textCtrl = Widget::getIrrlichtElement<IGUIEditBox>();
@ -48,7 +52,9 @@ stringw TextBoxWidget::getText() const
return stringw(textCtrl->getText());
}
// -----------------------------------------------------------------------------
EventPropagation TextBoxWidget::focused(const int playerID)
{
assert(playerID == 0); // No support for multiple players in text areas!
@ -58,7 +64,9 @@ EventPropagation TextBoxWidget::focused(const int playerID)
setWithinATextBox(true);
return EVENT_LET;
}
// -----------------------------------------------------------------------------
void TextBoxWidget::unfocused(const int playerID)
{
assert(playerID == 0); // No support for multiple players in text areas!

View File

@ -66,10 +66,8 @@ class FocusDispatcher : public Widget
KartSelectionScreen* m_parent;
int m_reserved_id;
public:
FocusDispatcher(KartSelectionScreen* parent)
FocusDispatcher(KartSelectionScreen* parent) : Widget(WTYPE_BUTTON)
{
//m_type = WTYPE_LABEL;
m_type = WTYPE_BUTTON;
m_parent = parent;
m_reserved_id = -1;
@ -205,7 +203,7 @@ public:
std::string m_kartInternalName;
PlayerKartWidget(KartSelectionScreen* parent,StateManager:: ActivePlayer* associatedPlayer,
Widget* area, const int m_playerID, const int irrlichtWidgetID=-1) : Widget()
Widget* area, const int m_playerID, const int irrlichtWidgetID=-1) : Widget(WTYPE_DIV)
{
m_associatedPlayer = associatedPlayer;
x_speed = 1.0f;

View File

@ -46,7 +46,7 @@ OptionsScreenAV::OptionsScreenAV() : Screen("options_av.stkgui")
void OptionsScreenAV::init()
{
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
if (ribbon != NULL) ribbon->select( "audio_video", GUI_PLAYER_ID );
if (ribbon != NULL) ribbon->select( "tab_audio_video", GUI_PLAYER_ID );
// ---- sfx volume
SpinnerWidget* gauge = this->getWidget<SpinnerWidget>("sfx_volume");
@ -144,9 +144,9 @@ void OptionsScreenAV::eventCallback(Widget* widget, const std::string& name, con
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
if (selection == "audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
}
else if(name == "back")
{

View File

@ -262,8 +262,8 @@ void OptionsScreenInput::buildDeviceList()
// -----------------------------------------------------------------------------
void OptionsScreenInput::init()
{
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
if (ribbon != NULL) ribbon->select( "controls", GUI_PLAYER_ID );
RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice");
if (tabBar != NULL) tabBar->select( "tab_controls", GUI_PLAYER_ID );
DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices");
@ -393,9 +393,9 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
if (selection == "audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
}
else if (name == "add_device")
{

View File

@ -49,8 +49,8 @@ OptionsScreenPlayers::OptionsScreenPlayers() : Screen("options_players.stkgui")
void OptionsScreenPlayers::init()
{
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
if (ribbon != NULL) ribbon->select( "players", GUI_PLAYER_ID );
RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice");
if (tabBar != NULL) tabBar->select( "tab_players", GUI_PLAYER_ID );
ListWidget* players = this->getWidget<ListWidget>("players");
assert(players != NULL);
@ -140,9 +140,9 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
if (selection == "audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
}
else if (name == "back")
{