void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character { CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT)); if (pEdit) { CStdStringW edit = m_strEdit; pEdit->SetHighlight(0, 0); pEdit->SetSelection(0, 0); if (m_hiddenInput) { // convert to *'s edit.clear(); if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > CTimeUtils::GetFrameTime() && m_iCursorPos > 0) { // using the remove to input, so display the last key input edit.append(m_iCursorPos - 1, L'*'); edit.append(1, m_strEdit[m_iCursorPos - 1]); } else edit.append(m_strEdit.size(), L'*'); } else if (!m_strEditing.empty()) { edit.insert(m_iCursorPos, m_strEditing); pEdit->SetHighlight(m_iCursorPos, m_iCursorPos + m_strEditing.size()); if (m_iEditingLength > 0) pEdit->SetSelection(m_iCursorPos + m_iEditingOffset, m_iCursorPos + m_iEditingOffset + m_iEditingLength); } // convert back to utf8 CStdString utf8Edit; g_charsetConverter.wToUTF8(edit, utf8Edit); pEdit->SetLabel(utf8Edit); // Send off a search message unsigned int now = CTimeUtils::GetFrameTime(); // don't send until the REMOTE_SMS_DELAY has passed if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now) return; if (m_pCharCallback) { // do not send editing text comes from system input method if (!m_hiddenInput && !m_strEditing.empty()) g_charsetConverter.wToUTF8(m_strEdit, utf8Edit); m_pCharCallback(this, utf8Edit); } } }
void CGUIDialogNumeric::FrameMove() { CStdString strLabel; unsigned int start = 0; unsigned int end = 0; if (m_mode == INPUT_PASSWORD) { for (unsigned int i=0; i < m_number.size(); i++) strLabel += '*'; } else if (m_mode == INPUT_NUMBER) { // simple - just render text directly strLabel = m_number; } else if (m_mode == INPUT_TIME) { // format up the time strLabel = StringUtils::Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute); start = m_block * 3; end = m_block * 3 + 2; } else if (m_mode == INPUT_TIME_SECONDS) { // format up the time strLabel = StringUtils::Format("%2d:%02d", m_datetime.wMinute, m_datetime.wSecond); start = m_block * 3; end = m_block * 3 + 2; } else if (m_mode == INPUT_DATE) { // format up the date strLabel = StringUtils::Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear); start = m_block * 3; end = m_block * 3 + 2; if (m_block == 2) end = m_block * 3 + 4; } else if (m_mode == INPUT_IP_ADDRESS) { // format up the date strLabel = StringUtils::Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]); start = m_block * 4; end = m_block * 4 + 3; } CGUILabelControl *pLabel = (CGUILabelControl *)GetControl(CONTROL_INPUT_LABEL); if (pLabel) { pLabel->SetLabel(strLabel); pLabel->SetHighlight(start, end); } CGUIDialog::FrameMove(); }
void CGUIDialogNumeric::FrameMove() { std::string strLabel; unsigned int start = 0; unsigned int end = 0; if (m_mode == INPUT_PASSWORD) strLabel.assign(m_number.length(), '*'); else if (m_mode == INPUT_NUMBER) strLabel = m_number; else if (m_mode == INPUT_TIME) { // format up the time strLabel = StringUtils::Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute); start = m_block * 3; end = m_block * 3 + 2; } else if (m_mode == INPUT_TIME_SECONDS) { // format up the time strLabel = StringUtils::Format("%2d:%02d:%02d", m_datetime.wHour, m_datetime.wMinute, m_datetime.wSecond); start = m_block * 3; end = m_block * 3 + 2; } else if (m_mode == INPUT_DATE) { // format up the date strLabel = StringUtils::Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear); start = m_block * 3; end = m_block * 3 + 2; if (m_block == 2) end = m_block * 3 + 4; } else if (m_mode == INPUT_IP_ADDRESS) { // format up the date strLabel = StringUtils::Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]); start = m_block * 4; end = m_block * 4 + 3; } CGUILabelControl *pLabel = dynamic_cast<CGUILabelControl *>(GetControl(CONTROL_INPUT_LABEL)); if (pLabel) { pLabel->SetLabel(strLabel); pLabel->SetHighlight(start, end); } CGUIDialog::FrameMove(); }