Fix focus lost when opening and closing dialog in players screen
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8434 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c1f992231e
commit
a4229e4cdb
@ -159,6 +159,15 @@ irr::core::stringw ListWidget::getSelectionLabel() const
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ListWidget::selectItemWithLabel(const irr::core::stringw& name)
|
||||
{
|
||||
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
|
||||
assert(list != NULL);
|
||||
return list->setSelected( name.c_str() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ListWidget::unfocused(const int playerID)
|
||||
{
|
||||
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
|
||||
|
@ -113,6 +113,8 @@ namespace GUIEngine
|
||||
|
||||
irr::core::stringw getSelectionLabel() const;
|
||||
|
||||
void selectItemWithLabel(const irr::core::stringw& name);
|
||||
|
||||
/**
|
||||
* \brief Finds the ID of the item that has a given internal name
|
||||
*/
|
||||
|
@ -39,6 +39,14 @@ PlayerInfoDialog::PlayerInfoDialog(PlayerProfile* player, const float w, const f
|
||||
|
||||
showRegularDialog();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
PlayerInfoDialog::~PlayerInfoDialog()
|
||||
{
|
||||
OptionsScreenPlayers::getInstance()->selectPlayer( translations->fribidize(m_player->getName()) );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
void PlayerInfoDialog::showRegularDialog()
|
||||
{
|
||||
|
@ -44,6 +44,9 @@ public:
|
||||
*/
|
||||
PlayerInfoDialog(PlayerProfile* PlayerInfoDialog,
|
||||
const float percentWidth, const float percentHeight);
|
||||
|
||||
virtual ~PlayerInfoDialog();
|
||||
|
||||
void onEnterPressedInternal();
|
||||
GUIEngine::EventPropagation processEvent(const std::string& eventSource);
|
||||
};
|
||||
|
@ -199,3 +199,12 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
|
||||
} // eventCallback
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenPlayers::selectPlayer(const irr::core::stringw& name)
|
||||
{
|
||||
ListWidget* players = this->getWidget<ListWidget>("players");
|
||||
assert(players != NULL);
|
||||
players->selectItemWithLabel(name);
|
||||
|
||||
players->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
bool gotNewPlayerName(const irr::core::stringw& newName, PlayerProfile* player=NULL);
|
||||
void deletePlayer(PlayerProfile* player);
|
||||
|
||||
void selectPlayer(const irr::core::stringw& name);
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void init();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user