GUI: Correctly display text input cursor

Nicolas Hake 2010-04-19 15:46:08 +02:00
parent f7eb1d12f2
commit bd8a5a997c
2 changed files with 4 additions and 2 deletions

View File

@ -1181,6 +1181,7 @@ namespace C4GUI
private:
enum CursorOperation { COP_BACK, COP_DELETE, COP_LEFT, COP_RIGHT, COP_HOME, COP_END };
static const char *CursorRepresentation;
bool KeyCursorOp(const C4KeyCodeEx &key, const CursorOperation &op);
bool KeyEnter();

View File

@ -30,6 +30,7 @@
namespace C4GUI
{
const char *Edit::CursorRepresentation = "\xC2\xA6"; // U+00A6 BROKEN BAR
// ----------------------------------------------------
// Edit
@ -653,8 +654,8 @@ namespace C4GUI
char cAtCursor = pDrawText[iCursorPos]; pDrawText[iCursorPos]=0; int32_t w,h,wc;
pFont->GetTextExtent(pDrawText, w, h, false);
pDrawText[iCursorPos] = cAtCursor;
pFont->GetTextExtent("¦", wc, h, false); wc/=2;
lpDDraw->TextOut("¦", *pFont, 1.5f, cgo.Surface, rcClientRect.x + cgo.TargetX + w - wc - iXScroll, iY0 + cgo.TargetY - h/3, dwFontClr, ALeft, false);
pFont->GetTextExtent(CursorRepresentation, wc, h, false); wc/=2;
lpDDraw->TextOut(CursorRepresentation, *pFont, 1.5f, cgo.Surface, rcClientRect.x + cgo.TargetX + w - wc - iXScroll, iY0 + cgo.TargetY - h/3, dwFontClr, ALeft, false);
}
// unclip
if (fOwnClip)