summaryrefslogtreecommitdiff
path: root/src/gui/widgets/textfield.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-11 22:25:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-11 22:25:21 +0300
commit120ef46ea296729baee0c88c046008d8e18644fa (patch)
tree36ac86de113f11e60c31008ea15d286bb30d831d /src/gui/widgets/textfield.cpp
parentc4d16b36a373ba5609360e2698372926d7f2dc0f (diff)
downloadmv-120ef46ea296729baee0c88c046008d8e18644fa.tar.gz
mv-120ef46ea296729baee0c88c046008d8e18644fa.tar.bz2
mv-120ef46ea296729baee0c88c046008d8e18644fa.tar.xz
mv-120ef46ea296729baee0c88c046008d8e18644fa.zip
Add ability to show onscreen keyboard if input field focused.
Diffstat (limited to 'src/gui/widgets/textfield.cpp')
-rw-r--r--src/gui/widgets/textfield.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 73e01fb63..5d0621e1e 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "configuration.h"
+#include "inputmanager.h"
#include "keyevent.h"
#include "gui/popupmenu.h"
@@ -51,6 +52,7 @@ TextField::TextField(const Widget2 *const widget,
gcn::ActionListener *const listener, std::string eventId,
const bool sendAlwaysEvents):
gcn::TextField(text),
+ gcn::FocusListener(),
Widget2(widget),
mSendAlwaysEvents(sendAlwaysEvents),
mNumeric(false),
@@ -66,6 +68,8 @@ TextField::TextField(const Widget2 *const widget,
setFrameSize(2);
mForegroundColor = getThemeColor(Theme::TEXTFIELD);
+ addFocusListener(this);
+
if (instances == 0)
{
if (Theme::instance())
@@ -529,6 +533,10 @@ void TextField::fontChanged()
void TextField::mousePressed(gcn::MouseEvent &mouseEvent)
{
+#ifdef ANDROID
+ if (!Client::isKeyboardVisible())
+ inputManager.executeAction(Input::KEY_SHOW_KEYBOARD);
+#endif
if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT)
{
if (viewport)
@@ -550,3 +558,15 @@ void TextField::mousePressed(gcn::MouseEvent &mouseEvent)
gcn::TextField::mousePressed(mouseEvent);
}
}
+
+void TextField::focusGained(const gcn::Event &event A_UNUSED)
+{
+#ifdef ANDROID
+ if (!Client::isKeyboardVisible())
+ inputManager.executeAction(Input::KEY_SHOW_KEYBOARD);
+#endif
+}
+
+void TextField::focusLost(const gcn::Event &event A_UNUSED)
+{
+}