Commit c4988bda authored by cutealien's avatar cutealien

EditBox works now with numpad on X11 (thx @Hendu for bureport).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4926 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f591a5ac
--------------------------
Changes in 1.9 (not yet released)
- EditBox works now with numpad on X11
- Added helper functions for converting between wchar and utf-8. Patch provided by Hendu.
- Added sphere frustum culling support. Patch provided by Hendu.
- Fixed issues with setViewPort method under OpenGL. (reported by anontypist)
......
......@@ -423,8 +423,9 @@ bool CGUIEditBox::processKey(const SEvent& event)
return false;
}
}
// default keyboard handling
else
// Some special keys - but only handle them if KeyInput.Char is null as on some systems (X11) they might have same key-code as ansi-keys otherwise
else if (event.KeyInput.Char == 0)
{
switch(event.KeyInput.Key)
{
case KEY_END:
......@@ -479,17 +480,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
BlinkStartTime = os::Timer::getTime();
}
break;
case KEY_RETURN:
if (MultiLine)
{
inputChar(L'\n');
}
else
{
calculateScrollPos();
sendGuiEvent( EGET_EDITBOX_ENTER );
}
return true;
case KEY_LEFT:
if (event.KeyInput.Shift)
......@@ -594,12 +584,17 @@ bool CGUIEditBox::processKey(const SEvent& event)
return false;
}
break;
case KEY_INSERT:
if ( !isEnabled() )
break;
case KEY_BACK:
OverwriteMode = !OverwriteMode;
break;
case KEY_DELETE:
if ( !isEnabled() )
break;
if (Text.size())
if (Text.size() != 0)
{
core::stringw s;
......@@ -617,35 +612,47 @@ bool CGUIEditBox::processKey(const SEvent& event)
}
else
{
// delete text behind cursor
if (CursorPos>0)
s = Text.subString(0, CursorPos-1);
else
s = L"";
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
// delete text before cursor
s = Text.subString(0, CursorPos);
s.append( Text.subString(CursorPos+1, Text.size()-CursorPos-1) );
Text = s;
--CursorPos;
}
if (CursorPos < 0)
CursorPos = 0;
if (CursorPos > (s32)Text.size())
CursorPos = (s32)Text.size();
BlinkStartTime = os::Timer::getTime();
newMarkBegin = 0;
newMarkEnd = 0;
textChanged = true;
}
break;
case KEY_INSERT:
if ( !isEnabled() )
break;
default:
return false;
}
}
else
{
// default keyboard handling
switch(event.KeyInput.Key)
{
case KEY_RETURN:
if (MultiLine)
{
inputChar(L'\n');
}
else
{
calculateScrollPos();
sendGuiEvent( EGET_EDITBOX_ENTER );
}
return true;
OverwriteMode = !OverwriteMode;
break;
case KEY_DELETE:
case KEY_BACK:
if ( !isEnabled() )
break;
if (Text.size() != 0)
if (Text.size())
{
core::stringw s;
......@@ -663,15 +670,18 @@ bool CGUIEditBox::processKey(const SEvent& event)
}
else
{
// delete text before cursor
s = Text.subString(0, CursorPos);
s.append( Text.subString(CursorPos+1, Text.size()-CursorPos-1) );
// delete text behind cursor
if (CursorPos>0)
s = Text.subString(0, CursorPos-1);
else
s = L"";
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
Text = s;
--CursorPos;
}
if (CursorPos > (s32)Text.size())
CursorPos = (s32)Text.size();
if (CursorPos < 0)
CursorPos = 0;
BlinkStartTime = os::Timer::getTime();
newMarkBegin = 0;
newMarkEnd = 0;
......@@ -713,6 +723,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
inputChar(event.KeyInput.Char);
return true;
}
}
// Set new text markers
setTextMarkers( newMarkBegin, newMarkEnd );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment