void CScreenDevice::ClearLineEnd (void) { for (unsigned nPosX = m_nCursorX; nPosX < m_nWidth; nPosX += m_CharGen.GetCharWidth ()) { EraseChar (nPosX, m_nCursorY); } }
bool cgUILineEdit::OnKeyDown( unsigned wparam, unsigned lparam ) { switch(wparam) { case VK_BACK: { return EraseChar(m_nCursorPos); }break; case VK_DELETE: { return EraseChar(m_nCursorPos+1); }break; case VK_LEFT: { int nDestPos = m_nCursorPos-1; if (GetKeyState(VK_CONTROL) < 0) { nDestPos = 0; } KeyMoveCursor(nDestPos); }break; case VK_RIGHT: { int nDestPos = m_nCursorPos+1; if (GetKeyState(VK_CONTROL) < 0) { nDestPos = m_strText.length(); } KeyMoveCursor(nDestPos); }break; case VK_HOME: { KeyMoveCursor(0); }break; case VK_END: { KeyMoveCursor(m_strText.length()); }break; default: break; } return false; }
void CScreenDevice::EraseChars (unsigned nCount) { if (nCount == 0) { return; } unsigned nEndX = m_nCursorX + nCount * m_CharGen.GetCharWidth (); if (nEndX > m_nWidth) { nEndX = m_nWidth; } for (unsigned nPosX = m_nCursorX; nPosX < nEndX; nPosX += m_CharGen.GetCharWidth ()) { EraseChar (nPosX, m_nCursorY); } }