aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/UI
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-14 16:13:26 +0200
committerEinar Johan Trøan Sømåen2012-06-14 16:13:26 +0200
commitfbc71915493f8162a674e0c83d470bfe6eb80a42 (patch)
treeb4950a65c01f996e28f226180e5a9080422582c7 /engines/wintermute/UI
parentd14fd7b1a352df6e94247e325f679cc25fef671c (diff)
downloadscummvm-rg350-fbc71915493f8162a674e0c83d470bfe6eb80a42.tar.gz
scummvm-rg350-fbc71915493f8162a674e0c83d470bfe6eb80a42.tar.bz2
scummvm-rg350-fbc71915493f8162a674e0c83d470bfe6eb80a42.zip
WINTERMUTE: Add a quick-fix to replace SDL_TEXTINPUT.
Diffstat (limited to 'engines/wintermute/UI')
-rw-r--r--engines/wintermute/UI/UIEdit.cpp13
-rw-r--r--engines/wintermute/UI/UIEdit.h2
-rw-r--r--engines/wintermute/UI/UIWindow.cpp4
-rw-r--r--engines/wintermute/UI/UIWindow.h2
4 files changed, 10 insertions, 11 deletions
diff --git a/engines/wintermute/UI/UIEdit.cpp b/engines/wintermute/UI/UIEdit.cpp
index b85159240f..54c85021c9 100644
--- a/engines/wintermute/UI/UIEdit.cpp
+++ b/engines/wintermute/UI/UIEdit.cpp
@@ -686,10 +686,10 @@ HRESULT CUIEdit::Display(int OffsetX, int OffsetY) {
//////////////////////////////////////////////////////////////////////////
-bool CUIEdit::HandleKeypress(Common::Event *event) {
+bool CUIEdit::HandleKeypress(Common::Event *event, bool printable) {
bool Handled = false;
- if (event->type == Common::EVENT_KEYDOWN) {
+ if (event->type == Common::EVENT_KEYDOWN && !printable) {
switch (event->kbd.keycode) {
case Common::KEYCODE_ESCAPE:
case Common::KEYCODE_TAB:
@@ -769,12 +769,11 @@ bool CUIEdit::HandleKeypress(Common::Event *event) {
break;
}
return Handled;
- }
-#if 0
- else if (event->type == SDL_TEXTINPUT) {
+ } else if (event->type == Common::EVENT_KEYDOWN && printable) {
if (_selStart != _selEnd) DeleteChars(_selStart, _selEnd);
- WideString wstr = StringUtil::Utf8ToWide(event->text.text);
+ //WideString wstr = StringUtil::Utf8ToWide(event->kbd.ascii);
+ WideString wstr; wstr += (char)event->kbd.ascii;
_selEnd += InsertChars(_selEnd, (byte *)StringUtil::WideToAnsi(wstr).c_str(), 1);
if (Game->_textRTL) _selEnd = _selStart;
@@ -782,7 +781,7 @@ bool CUIEdit::HandleKeypress(Common::Event *event) {
return true;
}
-#endif
+
return false;
}
diff --git a/engines/wintermute/UI/UIEdit.h b/engines/wintermute/UI/UIEdit.h
index 3b8698d55d..4771a0f772 100644
--- a/engines/wintermute/UI/UIEdit.h
+++ b/engines/wintermute/UI/UIEdit.h
@@ -44,7 +44,7 @@ public:
bool _cursorVisible;
uint32 _lastBlinkTime;
virtual HRESULT Display(int OffsetX, int OffsetY);
- virtual bool HandleKeypress(Common::Event *event);
+ virtual bool HandleKeypress(Common::Event *event, bool printable = false);
int _scrollOffset;
int _frameWidth;
uint32 _cursorBlinkRate;
diff --git a/engines/wintermute/UI/UIWindow.cpp b/engines/wintermute/UI/UIWindow.cpp
index 53ce72fe4a..94c76a60ea 100644
--- a/engines/wintermute/UI/UIWindow.cpp
+++ b/engines/wintermute/UI/UIWindow.cpp
@@ -1100,12 +1100,12 @@ const char *CUIWindow::ScToString() {
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::HandleKeypress(Common::Event *event) {
+bool CUIWindow::HandleKeypress(Common::Event *event, bool printable) {
//TODO
if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_TAB) {
return SUCCEEDED(MoveFocus(!CBKeyboardState::IsShiftDown()));
} else {
- if (_focusedWidget) return _focusedWidget->HandleKeypress(event);
+ if (_focusedWidget) return _focusedWidget->HandleKeypress(event, printable);
else return false;
}
return false;
diff --git a/engines/wintermute/UI/UIWindow.h b/engines/wintermute/UI/UIWindow.h
index 4bdef647a3..43d5961e7e 100644
--- a/engines/wintermute/UI/UIWindow.h
+++ b/engines/wintermute/UI/UIWindow.h
@@ -70,7 +70,7 @@ public:
virtual HRESULT Display(int OffsetX = 0, int OffsetY = 0);
CUIWindow(CBGame *inGame);
virtual ~CUIWindow();
- virtual bool HandleKeypress(Common::Event *event);
+ virtual bool HandleKeypress(Common::Event *event, bool printable = false);
CBArray<CUIObject *, CUIObject *> _widgets;
TTextAlign _titleAlign;
HRESULT LoadFile(const char *Filename);