summaryrefslogtreecommitdiff
path: root/src/guiTextInputMenu.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-23 17:32:21 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-23 17:32:21 +0200
commit61b5a353849f8c8a188c4f91c1aa89c9e7a1d10a (patch)
treedd35e0ed2bc2c51e532383f238b59340909e89ad /src/guiTextInputMenu.cpp
parent7e490e72139fbfe12535c71b27228dd82ef0250b (diff)
downloadminetest-61b5a353849f8c8a188c4f91c1aa89c9e7a1d10a.tar.gz
minetest-61b5a353849f8c8a188c4f91c1aa89c9e7a1d10a.tar.bz2
minetest-61b5a353849f8c8a188c4f91c1aa89c9e7a1d10a.zip
little tinkering
Diffstat (limited to 'src/guiTextInputMenu.cpp')
-rw-r--r--src/guiTextInputMenu.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp
index 8a9da3489..0668aa7b3 100644
--- a/src/guiTextInputMenu.cpp
+++ b/src/guiTextInputMenu.cpp
@@ -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;
}