Improvements to login screen : properly center buttons, and allow logging in by pressing enter

This commit is contained in:
auria.mg 2016-04-12 19:25:45 -04:00
parent 29e4d4a0bc
commit c18343f60b
3 changed files with 46 additions and 14 deletions

View File

@ -48,19 +48,24 @@
<div width="80%" align="center" layout="vertical-row" height="fit">
<label id="message" width="80%" align="center" text_align="left"/>
</div>
<spacer width="20" height="25"/>
<buttonbar id="options" width="90%" height="13%" align="bottom">
<icon-button id="ok" width="64" height="64" icon="gui/green_check.png"
I18N="In the user screen" text="OK" label_location="bottom"/>
<icon-button id="new_user" width="64" height="64" icon="gui/blue_plus.png"
I18N="In the user screen" text="Add user" label_location="bottom"/>
<icon-button id="delete" width="64" height="64" icon="gui/remove.png"
I18N="In the user screen" text="Delete" label_location="bottom"/>
<icon-button id="rename" width="64" height="64" icon="gui/rename.png"
I18N="In the user screen" text="Rename" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="In the user screen" text="Cancel" label_location="bottom"/>
</buttonbar>
<spacer width="20" proportion="1"/>
<div width="90%" align="center" layout="vertical-row" height="13%" height="fit" align="bottom">
<buttonbar id="options" width="100%" height="100%" align="center">
<icon-button id="ok" width="64" height="64" icon="gui/green_check.png"
I18N="In the user screen" text="OK" label_location="bottom"/>
<icon-button id="new_user" width="64" height="64" icon="gui/blue_plus.png"
I18N="In the user screen" text="Add user" label_location="bottom"/>
<icon-button id="delete" width="64" height="64" icon="gui/remove.png"
I18N="In the user screen" text="Delete" label_location="bottom"/>
<icon-button id="rename" width="64" height="64" icon="gui/rename.png"
I18N="In the user screen" text="Rename" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="In the user screen" text="Cancel" label_location="bottom"/>
</buttonbar>
</div>
<spacer width="20" height="25"/>
</box>
<spacer width="20" height="15"/>
</div>

View File

@ -181,6 +181,27 @@ void BaseUserScreen::tearDown()
Screen::tearDown();
} // tearDown
// ----------------------------------------------------------------------------
EventPropagation BaseUserScreen::filterActions(PlayerAction action,
int deviceID,
const unsigned int value,
Input::InputType type,
int playerId)
{
if (action == PA_MENU_SELECT)
{
if ((m_username_tb != NULL && m_username_tb->isFocusedForPlayer(PLAYER_ID_GAME_MASTER))
|| (m_password_tb != NULL && m_password_tb->isFocusedForPlayer(PLAYER_ID_GAME_MASTER)))
{
login();
}
return EVENT_BLOCK;
}
return EVENT_LET;
}
// ----------------------------------------------------------------------------
/** Called when a user is selected. It updates the online checkbox and
* entry fields.

View File

@ -23,7 +23,7 @@
#include "guiengine/screen.hpp"
#include "guiengine/widgets/spinner_widget.hpp"
#include "input/input.hpp"
namespace GUIEngine
{
class CheckBoxWidget;
@ -125,6 +125,12 @@ public:
void loginError(const irr::core::stringw &error_message);
void logoutSuccessful();
void logoutError(const irr::core::stringw &error_message);
virtual GUIEngine::EventPropagation filterActions(PlayerAction action,
int deviceID,
const unsigned int value,
Input::InputType type,
int playerId) OVERRIDE;
}; // class BaseUserScreen
// ============================================================================