void CGUIDialogKeyboardGeneric::UpdateButtons() { SET_CONTROL_SELECTED(GetID(), CTL_BUTTON_SHIFT, m_bShift); SET_CONTROL_SELECTED(GetID(), CTL_BUTTON_CAPS, m_keyType == CAPS); SET_CONTROL_SELECTED(GetID(), CTL_BUTTON_SYMBOLS, m_keyType == SYMBOLS); if (m_currentLayout >= m_layouts.size()) m_currentLayout = 0; CKeyboardLayout layout = m_layouts.empty() ? CKeyboardLayout() : m_layouts[m_currentLayout]; SET_CONTROL_LABEL(CTL_BUTTON_LAYOUT, layout.GetName()); unsigned int modifiers = CKeyboardLayout::ModifierKeyNone; if ((m_keyType == CAPS && !m_bShift) || (m_keyType == LOWER && m_bShift)) modifiers |= CKeyboardLayout::ModifierKeyShift; if (m_keyType == SYMBOLS) { modifiers |= CKeyboardLayout::ModifierKeySymbol; if (m_bShift) modifiers |= CKeyboardLayout::ModifierKeyShift; } for (unsigned int row = 0; row < BUTTONS_MAX_ROWS; row++) { for (unsigned int column = 0; column < BUTTONS_PER_ROW; column++) { int buttonID = (row * BUTTONS_PER_ROW) + column + BUTTON_ID_OFFSET; std::string label = layout.GetCharAt(row, column, modifiers); SetControlLabel(buttonID, label); if (!label.empty()) SET_CONTROL_VISIBLE(buttonID); else SET_CONTROL_HIDDEN(buttonID); } } }
void CGUIDialogKeyboardGeneric::UpdateButtons() { SET_CONTROL_SELECTED(GetID(), CTL_BUTTON_SHIFT, m_bShift); SET_CONTROL_SELECTED(GetID(), CTL_BUTTON_CAPS, m_keyType == CAPS); SET_CONTROL_SELECTED(GetID(), CTL_BUTTON_SYMBOLS, m_keyType == SYMBOLS); if (m_currentLayout >= m_layouts.size()) m_currentLayout = 0; CKeyboardLayout layout = m_layouts.empty() ? CKeyboardLayout() : m_layouts[m_currentLayout]; m_codingtable = layout.GetCodingTable(); if (m_codingtable && !m_codingtable->IsInitialized()) m_codingtable->Initialize(); bool bShowWordList = false; if (m_codingtable) { switch (m_codingtable->GetType()) { case IInputCodingTable::TYPE_WORD_LIST: bShowWordList = true; break; case IInputCodingTable::TYPE_CONVERT_STRING: m_codingtable->SetTextPrev(GetText()); m_hzcode.clear(); break; } } if (bShowWordList) { SET_CONTROL_VISIBLE(CTL_LABEL_HZCODE); SET_CONTROL_VISIBLE(CTL_LABEL_HZLIST); } else { SET_CONTROL_HIDDEN(CTL_LABEL_HZCODE); SET_CONTROL_HIDDEN(CTL_LABEL_HZLIST); } SET_CONTROL_LABEL(CTL_BUTTON_LAYOUT, layout.GetName()); unsigned int modifiers = CKeyboardLayout::ModifierKeyNone; if ((m_keyType == CAPS && !m_bShift) || (m_keyType == LOWER && m_bShift)) modifiers |= CKeyboardLayout::ModifierKeyShift; if (m_keyType == SYMBOLS) { modifiers |= CKeyboardLayout::ModifierKeySymbol; if (m_bShift) modifiers |= CKeyboardLayout::ModifierKeyShift; } for (unsigned int row = 0; row < BUTTONS_MAX_ROWS; row++) { for (unsigned int column = 0; column < BUTTONS_PER_ROW; column++) { int buttonID = (row * BUTTONS_PER_ROW) + column + BUTTON_ID_OFFSET; std::string label = layout.GetCharAt(row, column, modifiers); SetControlLabel(buttonID, label); if (!label.empty()) SET_CONTROL_VISIBLE(buttonID); else SET_CONTROL_HIDDEN(buttonID); } } }