Represet special keys on screen keyboard by symbols

This commit is contained in:
Deve 2018-03-20 00:10:13 +01:00
parent f559627951
commit 193ba6909f
2 changed files with 35 additions and 1 deletions

View File

@ -185,6 +185,37 @@ void ScreenKeyboard::createButtons()
addWidgetsRecursively(m_widgets);
} // createButtons
// ----------------------------------------------------------------------------
std::wstring ScreenKeyboard::getKeyName(std::string key_id)
{
std::wstring key_name;
if (key_id == "Enter")
{
key_name = L"\u23CE";
}
else if (key_id == "Shift")
{
key_name = L"\u21E7";
}
else if (key_id == "Back")
{
key_name = L"\u232B";
}
else if (key_id == "Space")
{
key_name = L"\u2423";
}
else
{
std::wstring tmp(key_id.begin(), key_id.end());
key_name = tmp;
}
return key_name;
}
// ----------------------------------------------------------------------------
/** A function that allows to select one of the available buttons layout
* \param buttons_type One of the available buttons type
@ -219,9 +250,11 @@ void ScreenKeyboard::assignButtons(ButtonsType buttons_type)
for (int j = 0; j < KEYBOARD_COLS_NUM; j++)
{
std::string key = keys != NULL ? (*keys)[i][j] : "?";
std::wstring key_name = getKeyName(key);
ButtonWidget* button = m_buttons[i * KEYBOARD_COLS_NUM + j];
button->setText(key.c_str());
button->setText(key_name.c_str());
button->m_properties[PROP_ID] = key;
}
}

View File

@ -95,6 +95,7 @@ namespace GUIEngine
void init();
void createButtons();
void assignButtons(ButtonsType buttons_type);
std::wstring getKeyName(std::string key_id);
public:
LEAK_CHECK()