本文整理汇总了C++中CAction::GetUnicode方法的典型用法代码示例。如果您正苦于以下问题:C++ CAction::GetUnicode方法的具体用法?C++ CAction::GetUnicode怎么用?C++ CAction::GetUnicode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAction
的用法示例。
在下文中一共展示了CAction::GetUnicode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAction
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
{
bool handled = true;
if (action.GetID() == (KEY_VKEY | XBMCVK_BACK))
Backspace();
else if (action.GetID() == ACTION_ENTER || (m_isKeyboardNavigationMode && action.GetID() == ACTION_SELECT_ITEM))
OnOK();
else if (action.GetID() == ACTION_SHIFT)
OnShift();
else if (action.GetID() == ACTION_SYMBOLS)
OnSymbols();
// don't handle move left/right and select in the edit control
else if (!m_isKeyboardNavigationMode &&
(action.GetID() == ACTION_MOVE_LEFT ||
action.GetID() == ACTION_MOVE_RIGHT ||
action.GetID() == ACTION_SELECT_ITEM))
handled = false;
else
{
handled = false;
wchar_t unicode = action.GetUnicode();
if (unicode)
{
std::wstring wch = L"";
wch.insert(wch.begin(), unicode);
std::string ch;
g_charsetConverter.wToUTF8(wch, ch);
handled = CodingCharacter(ch);
if (!handled)
{
// send action to edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
handled = edit->OnAction(action);
if (!handled && action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
{
BYTE b = action.GetID() & 0xFF;
if (b == XBMCVK_TAB)
{
// Toggle left/right key mode
m_isKeyboardNavigationMode = !m_isKeyboardNavigationMode;
if (m_isKeyboardNavigationMode)
{
m_previouslyFocusedButton = GetFocusedControlID();
SET_CONTROL_FOCUS(edit->GetID(), 0);
}
else
SET_CONTROL_FOCUS(m_previouslyFocusedButton, 0);
handled = true;
}
}
}
}
}
if (!handled) // unhandled by us - let's see if the baseclass wants it
handled = CGUIDialog::OnAction(action);
return handled;
}
示例2: OnAction
bool CGUIDialogNumeric::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_NEXT_ITEM)
OnNext();
else if (action.GetID() == ACTION_PREV_ITEM)
OnPrevious();
else if (action.GetID() == ACTION_BACKSPACE)
OnBackSpace();
else if (action.GetID() == ACTION_ENTER)
OnOK();
else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9)
OnNumber(action.GetID() - REMOTE_0);
else if (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
{ // input from the keyboard (vkey, not ascii)
BYTE b = action.GetID() & 0xFF;
if (b == XBMCVK_LEFT) OnPrevious();
else if (b == XBMCVK_RIGHT) OnNext();
else if (b == XBMCVK_RETURN || b == XBMCVK_NUMPADENTER) OnOK();
else if (b == XBMCVK_BACK) OnBackSpace();
else if (b == XBMCVK_ESCAPE) OnCancel();
}
else if (action.GetID() >= KEY_ASCII) // FIXME make it KEY_UNICODE
{ // input from the keyboard
if (action.GetUnicode() == 10 || action.GetUnicode() == 13) OnOK(); // enter
else if (action.GetUnicode() == 8) OnBackSpace(); // backspace
else if (action.GetUnicode() == 27) OnCancel(); // escape
else if (action.GetUnicode() >= 48 && action.GetUnicode() < 58) // number
OnNumber(action.GetUnicode() - 48);
}
else
return CGUIDialog::OnAction(action);
return true;
}
示例3: OnAction
bool CGUIDialogNumeric::OnAction(const CAction &action)
{
if (action.GetID() >= ACTION_MOVE_LEFT && action.GetID() <= ACTION_MOVE_DOWN)
m_autoClosing = false;
if (action.GetID() == ACTION_CLOSE_DIALOG || action.GetID() == ACTION_PREVIOUS_MENU)
OnCancel();
else if (action.GetID() == ACTION_NEXT_ITEM)
OnNext();
else if (action.GetID() == ACTION_PREV_ITEM)
OnPrevious();
else if (action.GetID() == ACTION_BACKSPACE)
OnBackSpace();
else if (action.GetID() == ACTION_ENTER)
OnOK();
else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9)
OnNumber(action.GetID() - REMOTE_0);
else if (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
{ // input from the keyboard (vkey, not ascii)
BYTE b = action.GetID() & 0xFF;
if (b == 0x25) OnPrevious(); // left
else if (b == 0x27) OnNext(); // right
else if (b == 0x0D) OnOK(); // enter
else if (b == 0x08) OnBackSpace(); // backspace
else if (b == 0x1B) OnCancel(); // escape
}
else if (action.GetID() >= KEY_ASCII) // FIXME make it KEY_UNICODE
{ // input from the keyboard
if (action.GetUnicode() == 10 || action.GetUnicode() == 13) OnOK(); // enter
else if (action.GetUnicode() == 8) OnBackSpace(); // backspace
else if (action.GetUnicode() == 27) OnCancel(); // escape
else if (action.GetUnicode() >= 48 && action.GetUnicode() < 58) // number
OnNumber(action.GetUnicode() - 48);
}
else
return CGUIDialog::OnAction(action);
return true;
}
示例4: OnAction
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
{
bool handled(true);
if (action.GetID() == ACTION_BACKSPACE)
{
Backspace();
}
else if (action.GetID() == ACTION_ENTER)
{
OnOK();
}
else if (action.GetID() == ACTION_CURSOR_LEFT)
{
MoveCursor( -1);
}
else if (action.GetID() == ACTION_CURSOR_RIGHT)
{
if ((unsigned int) GetCursorPos() == m_strEdit.size() && (m_strEdit.size() == 0 || m_strEdit[m_strEdit.size() - 1] != ' '))
{ // add a space
Character(L' ');
}
else
MoveCursor(1);
}
else if (action.GetID() == ACTION_SHIFT)
{
OnShift();
}
else if (action.GetID() == ACTION_SYMBOLS)
{
OnSymbols();
}
else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9)
{
OnRemoteNumberClick(action.GetID());
}
else if (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
{ // input from the keyboard (vkey, not ascii)
uint8_t b = action.GetID() & 0xFF;
if (b == XBMCVK_HOME)
{
MoveCursor(-GetCursorPos());
}
else if (b == XBMCVK_END)
{
MoveCursor(m_strEdit.GetLength() - GetCursorPos());
}
else if (b == XBMCVK_LEFT)
{
MoveCursor( -1);
}
else if (b == XBMCVK_RIGHT)
{
MoveCursor(1);
}
else if (b == XBMCVK_RETURN || b == XBMCVK_NUMPADENTER)
{
OnOK();
}
else if (b == XBMCVK_DELETE)
{
if (GetCursorPos() < m_strEdit.GetLength())
{
MoveCursor(1);
Backspace();
}
}
else if (b == XBMCVK_BACK) Backspace();
else if (b == XBMCVK_ESCAPE) Close();
}
else if (action.GetID() >= KEY_ASCII)
{ // input from the keyboard
//char ch = action.GetID() & 0xFF;
switch (action.GetUnicode())
{
case 13: // enter
case 10: // enter
OnOK();
break;
case 8: // backspace
Backspace();
break;
case 27: // escape
Close();
break;
default: //use character input
Character(action.GetUnicode());
break;
}
}
else // unhandled by us - let's see if the baseclass wants it
handled = CGUIDialog::OnAction(action);
if (handled && m_pCharCallback)
{ // we did _something_, so make sure our search message filter is reset
m_pCharCallback(this, GetText());
}
return handled;
}
示例5: OnAction
//.........这里部分代码省略.........
{
if (m_cursorPos < m_text2.length())
{
if (!ClearMD5())
m_text2.erase(m_cursorPos, 1);
UpdateText();
return true;
}
}
if (b == XBMCVK_BACK)
{
if (m_cursorPos > 0)
{
if (!ClearMD5())
m_text2.erase(--m_cursorPos, 1);
UpdateText();
}
return true;
}
else if (b == XBMCVK_RETURN || b == XBMCVK_NUMPADENTER)
{
// enter - send click message, but otherwise ignore
SEND_CLICK_MESSAGE(GetID(), GetParentID(), 1);
return true;
}
else if (b == XBMCVK_ESCAPE)
{ // escape - fallthrough to default action
return CGUIButtonControl::OnAction(action);
}
}
else if (action.GetID() >= KEY_ASCII)
{
// input from the keyboard
int ch = action.GetUnicode();
// ignore non-printing characters
if ( !((0 <= ch && ch < 0x8) || (0xE <= ch && ch < 0x1B) || (0x1C <= ch && ch < 0x20)) )
{
switch (ch)
{
case 9: // tab, ignore
case 11: // Non-printing character, ignore
case 12: // Non-printing character, ignore
break;
case 10:
case 13:
{
// enter - send click message, but otherwise ignore
SEND_CLICK_MESSAGE(GetID(), GetParentID(), 1);
return true;
}
case 27:
{ // escape - fallthrough to default action
return CGUIButtonControl::OnAction(action);
}
case 8:
{
// backspace
if (m_cursorPos)
{
if (!ClearMD5())
m_text2.erase(--m_cursorPos, 1);
}
break;
}
case 127:
{ // delete
示例6: OnAction
bool CGUIEditControl::OnAction(const CAction &action)
{
ValidateCursor();
if (m_inputType != INPUT_TYPE_READONLY)
{
if (action.GetID() == ACTION_BACKSPACE)
{
// backspace
if (m_cursorPos)
{
if (!ClearMD5())
m_text2.erase(--m_cursorPos, 1);
UpdateText();
}
return true;
}
else if (action.GetID() == ACTION_MOVE_LEFT)
{
if (m_cursorPos > 0)
{
m_cursorPos--;
UpdateText(false);
return true;
}
}
else if (action.GetID() == ACTION_MOVE_RIGHT)
{
if ((unsigned int) m_cursorPos < m_text2.size())
{
m_cursorPos++;
UpdateText(false);
return true;
}
}
else if (action.GetID() == ACTION_PASTE)
{
ClearMD5();
OnPasteClipboard();
}
else if (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
{
// input from the keyboard (vkey, not ascii)
BYTE b = action.GetID() & 0xFF;
if (b == XBMCVK_HOME)
{
m_cursorPos = 0;
UpdateText(false);
return true;
}
else if (b == XBMCVK_END)
{
m_cursorPos = m_text2.length();
UpdateText(false);
return true;
}
if (b == XBMCVK_LEFT && m_cursorPos > 0)
{
m_cursorPos--;
UpdateText(false);
return true;
}
if (b == XBMCVK_RIGHT && m_cursorPos < m_text2.length())
{
m_cursorPos++;
UpdateText(false);
return true;
}
if (b == XBMCVK_DELETE)
{
if (m_cursorPos < m_text2.length())
{
if (!ClearMD5())
m_text2.erase(m_cursorPos, 1);
UpdateText();
return true;
}
}
if (b == XBMCVK_BACK)
{
if (m_cursorPos > 0)
{
if (!ClearMD5())
m_text2.erase(--m_cursorPos, 1);
UpdateText();
}
return true;
}
}
else if (action.GetID() >= KEY_ASCII)
{
// input from the keyboard
switch (action.GetUnicode())
{
case '\t':
break;
case 10:
case 13:
{
// enter - send click message, but otherwise ignore
//.........这里部分代码省略.........
示例7: OnAction
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
{
bool handled(true);
if (action.GetID() == ACTION_BACKSPACE)
{
Backspace();
}
else if (action.GetID() == ACTION_ENTER)
{
OnOK();
}
else if (action.GetID() == ACTION_CURSOR_LEFT)
{
MoveCursor( -1);
}
else if (action.GetID() == ACTION_CURSOR_RIGHT)
{
if (m_strEditing.empty() && (unsigned int) GetCursorPos() == m_strEdit.size() && (m_strEdit.size() == 0 || m_strEdit[m_strEdit.size() - 1] != ' '))
{ // add a space
Character(L' ');
}
else
MoveCursor(1);
}
else if (action.GetID() == ACTION_SHIFT)
{
OnShift();
}
else if (action.GetID() == ACTION_SYMBOLS)
{
OnSymbols();
}
else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9)
{
OnRemoteNumberClick(action.GetID());
}
else if (action.GetID() == ACTION_PASTE)
{
OnPasteClipboard();
}
else if ( (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII) ||
(action.GetButtonCode() >= KEY_VKEY && action.GetButtonCode() < KEY_ASCII) )
{ // input from the keyboard (vkey, not ascii)
if (!m_strEditing.empty())
return handled;
uint8_t b = action.GetButtonCode() ? action.GetButtonCode() & 0xFF : action.GetID() & 0xFF;
switch (b)
{
case XBMCVK_HOME:
SetCursorPos(0);
break;
case XBMCVK_END:
SetCursorPos(m_strEdit.size());
break;
case XBMCVK_LEFT:
MoveCursor( -1);
break;
case XBMCVK_RIGHT:
MoveCursor(1);
break;
case XBMCVK_RETURN:
case XBMCVK_NUMPADENTER:
OnOK();
break;
case XBMCVK_DELETE:
if (GetCursorPos() < (int)m_strEdit.size())
{
MoveCursor(1);
Backspace();
}
break;
case XBMCVK_BACK:
Backspace();
break;
case XBMCVK_ESCAPE:
Close();
break;
case XBMCVK_LSHIFT:
case XBMCVK_RSHIFT:
OnShift();
break;
case XBMCVK_CAPSLOCK:
OnCapsLock();
break;
}
}
else if (action.GetID() >= KEY_ASCII)
{ // input from the keyboard
//char ch = action.GetID() & 0xFF;
int ch = action.GetUnicode();
if( m_keyType == LOWER && m_bShift )
{
if (ch >= 'a' && ch <= 'z')
ch -= 32;
OnShift();
}
else if( m_keyType == CAPS && !m_bShift )
//.........这里部分代码省略.........