mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
little tinkering
This commit is contained in:
parent
7e490e7213
commit
61b5a35384
4 changed files with 42 additions and 19 deletions
|
@ -120,6 +120,20 @@ void GUITextInputMenu::drawMenu()
|
|||
gui::IGUIElement::draw();
|
||||
}
|
||||
|
||||
void GUITextInputMenu::acceptInput()
|
||||
{
|
||||
if(m_dest)
|
||||
{
|
||||
gui::IGUIElement *e = getElementFromId(256);
|
||||
if(e != NULL)
|
||||
{
|
||||
m_dest->gotText(e->getText());
|
||||
}
|
||||
delete m_dest;
|
||||
m_dest = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool GUITextInputMenu::OnEvent(const SEvent& event)
|
||||
{
|
||||
if(event.EventType==EET_KEY_INPUT_EVENT)
|
||||
|
@ -129,6 +143,12 @@ bool GUITextInputMenu::OnEvent(const SEvent& event)
|
|||
quitMenu();
|
||||
return true;
|
||||
}
|
||||
if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
|
||||
{
|
||||
acceptInput();
|
||||
quitMenu();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(event.EventType==EET_GUI_EVENT)
|
||||
{
|
||||
|
@ -148,15 +168,7 @@ bool GUITextInputMenu::OnEvent(const SEvent& event)
|
|||
switch(event.GUIEvent.Caller->getID())
|
||||
{
|
||||
case 257:
|
||||
if(m_dest)
|
||||
{
|
||||
gui::IGUIElement *e = getElementFromId(256);
|
||||
if(e != NULL)
|
||||
{
|
||||
m_dest->gotText(e->getText());
|
||||
}
|
||||
delete m_dest;
|
||||
}
|
||||
acceptInput();
|
||||
quitMenu();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue