diff options
author | Harald Axmann <harald.axmann@hotmail.com> | 2012-11-25 22:57:32 +0100 |
---|---|---|
committer | Harald Axmann <harald.axmann@hotmail.com> | 2012-12-01 10:44:02 +0100 |
commit | bdb2bf53f09a1acc9d1626f1e8b2be7de8dfc19f (patch) | |
tree | 5e3d5e4f45ae9e8fabcdd3732b59d97b373e630a | |
parent | e1fd53be024078ab7f4d3ee2ad5b641e402da772 (diff) |
GUIDialogKeyboardGeneric: set cursor position directly for absolute positions
-rw-r--r-- | xbmc/dialogs/GUIDialogKeyboardGeneric.cpp | 13 | ||||
-rw-r--r-- | xbmc/dialogs/GUIDialogKeyboardGeneric.h | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp index 9ae41c1a51..8a72a05895 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp @@ -144,11 +144,11 @@ bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action) uint8_t b = action.GetID() & 0xFF; if (b == XBMCVK_HOME) { - MoveCursor(-GetCursorPos()); + SetCursorPos(0); } else if (b == XBMCVK_END) { - MoveCursor(m_strEdit.GetLength() - GetCursorPos()); + SetCursorPos(m_strEdit.GetLength()); } else if (b == XBMCVK_LEFT) { @@ -286,7 +286,7 @@ void CGUIDialogKeyboardGeneric::SetText(const CStdString& aTextString) m_strEdit.Empty(); g_charsetConverter.utf8ToW(aTextString, m_strEdit); UpdateLabel(); - MoveCursor(m_strEdit.size()); + SetCursorPos(m_strEdit.size()); } CStdString CGUIDialogKeyboardGeneric::GetText() const @@ -539,10 +539,15 @@ void CGUIDialogKeyboardGeneric::OnDeinitWindow(int nextWindowID) void CGUIDialogKeyboardGeneric::MoveCursor(int iAmount) { + SetCursorPos(GetCursorPos() + iAmount); +} + +void CGUIDialogKeyboardGeneric::SetCursorPos(int iPos) +{ CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT)); if (pEdit) { - pEdit->SetCursorPos(pEdit->GetCursorPos() + iAmount); + pEdit->SetCursorPos(iPos); } } diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.h b/xbmc/dialogs/GUIDialogKeyboardGeneric.h index 1f3d826c22..958b11eefa 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.h +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.h @@ -52,6 +52,7 @@ class CGUIDialogKeyboardGeneric : public CGUIDialog, public CGUIKeyboard void SetControlLabel(int id, const CStdString &label); void OnShift(); void MoveCursor(int iAmount); + void SetCursorPos(int iPos); int GetCursorPos() const; void OnSymbols(); void OnIPAddress(); |