コード例 #1
0
ファイル: GUIDialogNumeric.cpp プロジェクト: Anankin/xbmc
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;
}
コード例 #2
0
ファイル: GUIDialogNumeric.cpp プロジェクト: Anankin/xbmc
bool CGUIDialogNumeric::OnMessage(CGUIMessage& message)
{
  switch ( message.GetMessage() )
  {
  case GUI_MSG_WINDOW_INIT:
    {
      m_bConfirmed = false;
      m_bCanceled = false;
      m_dirty = false;
      return CGUIDialog::OnMessage(message);
    }
    break;

  case GUI_MSG_CLICKED:
    {
      int iControl = message.GetSenderId();
      m_bConfirmed = false;
      m_bCanceled = false;
      if (CONTROL_NUM0 <= iControl && iControl <= CONTROL_NUM9)  // User numeric entry via dialog button UI
      {
        OnNumber(iControl - 10);
        return true;
      }
      else if (iControl == CONTROL_PREVIOUS)
      {
        OnPrevious();
        return true;
      }
      else if (iControl == CONTROL_NEXT)
      {
        OnNext();
        return true;
      }
      else if (iControl == CONTROL_BACKSPACE)
      {
        OnBackSpace();
        return true;
      }
      else if (iControl == CONTROL_ENTER)
      {
        OnOK();
        return true;
      }
    }
    break;

  case GUI_MSG_SET_TEXT:
    SetMode(m_mode, message.GetLabel());

    // close the dialog if requested
    if (message.GetParam1() > 0)
      OnOK();
    break;
  }
  return CGUIDialog::OnMessage(message);
}
コード例 #3
0
ファイル: GUIDialogNumeric.cpp プロジェクト: RoboSK/xbmc
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
0
ファイル: GUIDialogNumeric.cpp プロジェクト: Kr0nZ/xbmc
bool CGUIDialogNumeric::OnMessage(CGUIMessage& message)
{
  switch ( message.GetMessage() )
  {
  case GUI_MSG_WINDOW_INIT:
    {
      m_bConfirmed = false;
      m_bCanceled = false;
      m_dirty = false;
      m_autoCloseTime = 0;
      return CGUIDialog::OnMessage(message);
    }
    break;

  case GUI_MSG_CLICKED:
    {
      int iControl = message.GetSenderId();
      m_bConfirmed = false;
      m_bCanceled = false;
      if (CONTROL_NUM0 <= iControl && iControl <= CONTROL_NUM9)  // User numeric entry via dialog button UI
      {
        OnNumber(iControl - 10);
        return true;
      }
      else if (iControl == CONTROL_PREVIOUS)
      {
        OnPrevious();
        return true;
      }
      else if (iControl == CONTROL_NEXT)
      {
        OnNext();
        return true;
      }
      else if (iControl == CONTROL_BACKSPACE)
      {
        OnBackSpace();
        return true;
      }
      else if (iControl == CONTROL_ENTER)
      {
        OnOK();
        return true;
      }
    }
    break;
  }
  return CGUIDialog::OnMessage(message);
}
コード例 #5
0
ファイル: FootyDoc.cpp プロジェクト: vain0/hsed3_iconins
/**
 * CFootyDoc::OnDelete
 * @brief Deleteキーが押されたときの処理を行います。
 * @return どのように再描画するのか
 */
CFootyDoc::RedrawType CFootyDoc::OnDelete()
{
	// 宣言
	CUndoBuffer cUndo;
	RedrawType nType;
	
	if ( IsReadOnly() ) return REDRAW_FAILED;
	
	// 選択しているかどうかで場合分け
	if (IsSelecting()){
		nType = DeleteSelected(&cUndo);
		PushBackUndo(&cUndo);
		return nType;
	}
	else{
		// 前に一つ移動してからBackSpaceという形にする
		CEditPosition cBackUp = m_cCaretPos;
		m_cCaretPos.MoveColumnForward(&m_lsLines,1);
		if (cBackUp != m_cCaretPos)	// 違う
			return OnBackSpace();
		else						// 末尾
			return REDRAW_NONE;
	}
}