示例#1
0
void CGUIDialogFavourites::OnPopupMenu(int item)
{
  if (item < 0 || item >= m_favourites->Size())
    return;

  // highlight the item
  (*m_favourites)[item]->Select(true);

  CContextButtons choices;
  if (m_favourites->Size() > 1)
  {
    choices.Add(1, 13332);
    choices.Add(2, 13333);
  }
  choices.Add(3, 15015);
  choices.Add(4, 118);
  
  int button = CGUIDialogContextMenu::ShowAndGetChoice(choices);

  // unhighlight the item
  (*m_favourites)[item]->Select(false);

  if (button == 1)
    OnMoveItem(item, -1);
  else if (button == 2)
    OnMoveItem(item, 1);
  else if (button == 3)
    OnDelete(item);
  else if (button == 4)
    OnRename(item);
}
示例#2
0
void CSharedFilesCtrl::OnKeyPressed( wxKeyEvent& event )
{
	if (event.GetKeyCode() == WXK_F2) {
		wxCommandEvent evt;
		OnRename(evt);
		
		return;
	}
	event.Skip();
}
void CGUIDialogFavourites::OnPopupMenu(int item)
{
  if (item < 0 || item >= m_favourites->Size())
    return;

  CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
  if (pMenu)
  {
    // highlight the item
    (*m_favourites)[item]->Select(true);

    // initialize the positioning
    float posX = 0;
    float posY = 0;
    const CGUIControl *pList = GetControl(FAVOURITES_LIST);
    if (pList)
    {
      posX = pList->GetXPosition() + pList->GetWidth() / 2;
      posY = pList->GetYPosition() + pList->GetHeight() / 2;
    }
    pMenu->Initialize();

    int btn_MoveUp = m_favourites->Size() > 1 ? pMenu->AddButton(13332) : 0;
    int btn_MoveDown = m_favourites->Size() > 1 ? pMenu->AddButton(13333) : 0;
    int btn_Remove = pMenu->AddButton(15015);
    int btn_Rename = pMenu->AddButton(118);

    pMenu->SetPosition(GetPosX() + posX - pMenu->GetWidth() / 2, GetPosY() + posY - pMenu->GetHeight() / 2);
    pMenu->DoModal(GetID());
    int button = pMenu->GetButton();

    // unhighlight the item
    (*m_favourites)[item]->Select(false);

    if (button == btn_MoveUp)
      OnMoveItem(item, -1);
    else if (button == btn_MoveDown)
      OnMoveItem(item, 1);
    else if (button == btn_Remove)
      OnDelete(item);
    else if (button == btn_Rename)
      OnRename(item);
  }
}
示例#4
0
void CGUIDialogFavourites::OnPopupMenu(int item)
{
  if (item < 0 || item >= m_favourites->Size())
    return;

  CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
  if (pMenu)
  {
    // highlight the item
    (*m_favourites)[item]->Select(true);

    // initialize the positioning
    CPoint pos;
    const CGUIControl *pList = GetControl(FAVOURITES_LIST);
    if (pList)
      pos = pList->GetRenderPosition() + CPoint(pList->GetWidth() * 0.5f, pList->GetHeight() * 0.5f);
    pMenu->Initialize();

    int btn_MoveUp = m_favourites->Size() > 1 ? pMenu->AddButton(13332) : 0;
    int btn_MoveDown = m_favourites->Size() > 1 ? pMenu->AddButton(13333) : 0;
    int btn_Remove = pMenu->AddButton(15015);
    int btn_Rename = pMenu->AddButton(118);

    pMenu->OffsetPosition(pos.x, pos.y);
    pMenu->DoModal(GetID());
    int button = pMenu->GetButton();

    // unhighlight the item
    (*m_favourites)[item]->Select(false);

    if (button == btn_MoveUp)
      OnMoveItem(item, -1);
    else if (button == btn_MoveDown)
      OnMoveItem(item, 1);
    else if (button == btn_Remove)
      OnDelete(item);
    else if (button == btn_Rename)
      OnRename(item);
  }
}
示例#5
0
void OnFileSystemCommand(
                        SerializerContext* cmdContext,
                        SerializerContext* respContext,
                        unsigned char* responseBuffer,
                        unsigned short responseBufferSize)
{
  nmc.cmdContext = cmdContext;
  nmc.respContext = respContext;
  nmc.responseBuffer = responseBuffer;
  nmc.responseBufferSize = responseBufferSize;

  unsigned char fsCmd = 0;
  Get(cmdContext, (void*)&fsCmd, sizeof(fsCmd));
  switch(fsCmd){
  case Mount:
    OnMount(&nmc);
    break;
  case UnMount:
    OnUnMount(&nmc);
    break;
  case OpenFile:
    OnOpenFile(&nmc);
    break;
  case CloseFile:
    OnCloseFile(&nmc);
    break;
  case ReadFile:
    OnReadFile(&nmc);
    break;
  case WriteFile:
    OnWriteFile(&nmc);
    break;
  case SeekFile:
    OnSeekFile(&nmc);
    break;
  case TruncateFile:
    OnTruncateFile(&nmc);
    break;
  case SyncFile:
    OnSyncFile(&nmc);
    break;
  case ReadString:
    OnReadString(&nmc);
    break;
  case WriteString:
    OnWriteString(&nmc);
    break;
  case GetFilePosition:
    OnGetFilePosition(&nmc);
    break;
  case GetEndOfFile:
    OnGetEndOfFile(&nmc);
    break;
  case GetFileSize:
    OnGetFileSize(&nmc);
    break;
  case GetFileError:
    OnGetFileError(&nmc);
    break;
  case OpenDir:
    OnOpenDir(&nmc);
    break;
  case CloseDir:
    OnCloseDir(&nmc);
    break;
  case ReadDir:
    OnReadDir(&nmc);
    break;
  case MakeDir:
    OnMakeDir(&nmc);
    break;
  case ChangeDir:
    OnChangeDir(&nmc);
    break;
  case GetCurrentDir:
    OnGetCurrentDir(&nmc);
    break;
  case GetFreeSpace:
    OnGetFreeSpace(&nmc);
    break;
  case Unlink:
    OnUnlink(&nmc);
    break;
  case ChangeAttribute:
    OnChangeAttribute(&nmc);
    break;
  case ChangeTime:
    OnChangeTime(&nmc);
    break;
  case Rename:
    OnRename(&nmc);
    break;
  case GetDiskStatus:
    OnGetDiskStatus(&nmc);
    break;
  default:
    vt100TextColor(VT100_Red, VT100_Black);
    printf("%s: invalid command: %i\r\n", __func__, (int)fsCmd);
    vt100TextDefault();
    break;
  }
}