当前位置: 首页>>代码示例>>C++>>正文


C++ GetSelectedItemCount函数代码示例

本文整理汇总了C++中GetSelectedItemCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSelectedItemCount函数的具体用法?C++ GetSelectedItemCount怎么用?C++ GetSelectedItemCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetSelectedItemCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

const GameListItem * CGameListCtrl::GetSelectedISO()
{
	if (m_ISOFiles.size() == 0)
	{
		return nullptr;
	}
	else if (GetSelectedItemCount() == 0)
	{
		return nullptr;
	}
	else
	{
		long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
		if (item == wxNOT_FOUND)
		{
			return nullptr;
		}
		else
		{
			// Here is a little workaround for multiselections:
			// when > 1 item is selected, return info on the first one
			// and deselect it so the next time GetSelectedISO() is called,
			// the next item's info is returned
			if (GetSelectedItemCount() > 1)
				SetItemState(item, 0, wxLIST_STATE_SELECTED);

			return m_ISOFiles[GetItemData(item)];
		}
	}
}
开发者ID:Chemlo,项目名称:dolphin,代码行数:30,代码来源:GameListCtrl.cpp

示例2: WXUNUSED

void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event))
{
	if (GetSelectedItemCount() == 1)
	{
		const GameListItem *iso = GetSelectedISO();
		if (!iso)
			return;
		if (wxMessageBox(_("Are you sure you want to delete this file?  It will be gone forever!"),
					wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES)
		{
			File::Delete(iso->GetFileName());
			Update();
		}
	}
	else
	{
		if (wxMessageBox(_("Are you sure you want to delete these files?\nThey will be gone forever!"),
					wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES)
		{
			int selected = GetSelectedItemCount();

			for (int i = 0; i < selected; i++)
			{
				const GameListItem *iso = GetSelectedISO();
				File::Delete(iso->GetFileName());
			}
			Update();
		}
	}
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:30,代码来源:GameListCtrl.cpp

示例3: OnRemoveAll

void CQueueViewFailed::OnRemoveAll(wxCommandEvent& event)
{
#ifndef __WXMSW__
	// GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1)
	if (GetSelectedItemCount())
#endif
	{
		// First, clear all selections
		int item;
		while ((item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1)
			SetItemState(item, 0, wxLIST_STATE_SELECTED);
	}

	CEditHandler* pEditHandler = CEditHandler::Get();
	if (pEditHandler)
		pEditHandler->RemoveAll(CEditHandler::upload_and_remove_failed);

	for (std::vector<CServerItem*>::iterator iter = m_serverList.begin(); iter != m_serverList.end(); iter++)
		delete *iter;
	m_serverList.clear();

	m_itemCount = 0;
	SaveSetItemCount(0);
	m_fileCount = 0;
	m_folderScanCount = 0;

	DisplayNumberQueuedFiles();

	RefreshListOnly();

	if (!m_itemCount && m_pQueue->GetQueueView()->GetItemCount())
		m_pQueue->SetSelection(0);
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:33,代码来源:queueview_failed.cpp

示例4: GetSelectedItemCount

void CQueueViewBase::UpdateSelections_ItemRangeAdded(int added, int count)
{
#ifndef __WXMSW__
	// GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1)
	const int selection_count = GetSelectedItemCount();
	if (!selection_count)
		return;
#endif

	std::list<int> itemsToSelect;

	// Go through all selected items
	int item = GetNextItem(added - 1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);

	while (item != -1)
	{
		// Select new items preceding to current one
		while (!itemsToSelect.empty() && itemsToSelect.front() < item)
		{
			SetItemState(itemsToSelect.front(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
			itemsToSelect.pop_front();
		}
		if (itemsToSelect.empty())
			SetItemState(item, 0, wxLIST_STATE_SELECTED);
		else if (itemsToSelect.front() == item)
			itemsToSelect.pop_front();

		itemsToSelect.push_back(item + count);

		item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
	}
	for (std::list<int>::const_iterator iter = itemsToSelect.begin(); iter != itemsToSelect.end(); iter++)
		SetItemState(*iter, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
开发者ID:ErichKrause,项目名称:filezilla,代码行数:34,代码来源:queue.cpp

示例5: OnRightClick

void CContactListCtrl::OnRightClick(wxListEvent& e)
{
  wxMenu menu;
  if (GetSelectedItemCount() == 1) {
    // Single selection
    CContact& rContact = m_liEntries[e.GetIndex()];
    const TPhoneList& rPhones = rContact.getConstPhones();
    if (rPhones.size()) {
      wxMenu *submenu = new wxMenu();
      TPhoneList::const_iterator it = rPhones.begin();
      for (int i = 0; it != rPhones.end() && (i < MAX_PHONES); ++it, ++i) {
        submenu->Append(ID_CTX_MAKE_CALL + i,
            wxString::Format(wxT("%s (%s)"), it->getNumber(),
                CPhone::getNumberTypeName(it->getType())));
      }
      if (rPhones.size() > MAX_PHONES) {
        submenu->Append(ID_CTX_SELECT_CALL, _("More..."));
      }
      menu.Append(ID_CTX_SELECT_CALL, _("Call..."));
      menu.AppendSubMenu(submenu, _("Quick Call"));
      menu.AppendSeparator();
    }
    menu.Append(CMD_ADD_ADDRESS, _("Add..."));
    menu.Append(CMD_EDIT_ADDRESS, _("Edit..."));
    menu.AppendSeparator();
    menu.Append(CMD_DEL_ADDRESS, _("Delete"));
  }
  else {
    // Multiple selection
    menu.Append(CMD_ADD_ADDRESS, _("Add..."));
    menu.AppendSeparator();
    menu.Append(CMD_DEL_ADDRESS, _("Delete"));
  }
  PopupMenu(&menu);
}
开发者ID:Sonderstorch,项目名称:c-mon,代码行数:35,代码来源:contactspage.cpp

示例6: GetWindowStyle

void wxExListView::BuildPopupMenu(wxExMenu& menu)
{
  menu.AppendSeparator();
  menu.AppendEdit(true);
  
  const long style = GetWindowStyle();

  if (
    GetItemCount() > 0 && 
    GetSelectedItemCount() == 0 &&
    style & wxLC_REPORT)
  {
    menu.AppendSeparator();

    wxMenu* menuSort = new wxMenu;

    for (
#ifdef wxExUSE_CPP0X	
      auto it = m_Columns.begin();
#else
      std::vector<wxExColumn>::iterator it = m_Columns.begin();
#endif	  
      it != m_Columns.end();
      ++it)
    {
      menuSort->Append(ID_COL_FIRST + it->GetColumn(), it->GetText());
    }

    menu.AppendSubMenu(menuSort, _("Sort On"));
  }
开发者ID:hugofvw,项目名称:wxExtension,代码行数:30,代码来源:listview.cpp

示例7: GetSelectedItemCount

BOOL ColourGallery::DoDeleteSelection(void)
{
	DWORD TotalItems = GetSelectedItemCount();

	IndexedColour **KillList = new IndexedColourPtr[TotalItems+1];
	if (KillList == NULL)
		return(FALSE);
	
	DWORD KillIndex = 0;
	SequenceItem *Ptr = FindFirstSelected();
	while (Ptr != NULL)
	{
		KillList[KillIndex++] = (IndexedColour *) FindRealItem(Ptr);

		Ptr = FindNextSelected(Ptr);
	}
	
	KillList[KillIndex] = NULL;		// NULL terminate the list

	// Delete (hide, with undo actually) the given colours
	ColourManager::HideColours(ColourManager::GetColourList(), KillList, TRUE);

	// HideColours has made a copy of this list for itself, so we are responsible
	// for deleting our original list
	delete [] KillList;

	return(TRUE);
}
开发者ID:vata,项目名称:xarino,代码行数:28,代码来源:colgal.cpp

示例8: ClearSelection

void CMuleListCtrl::ClearSelection() 
{
	if (GetSelectedItemCount()) {
		long index = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
		while (index != -1) {
			SetItemState(index, 0, wxLIST_STATE_SELECTED);
			index = GetNextItem(index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
		}
	}
}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:10,代码来源:MuleListCtrl.cpp

示例9: WXUNUSED

void CGameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED (event))
{
	const wxString message = GetSelectedItemCount() == 1 ?
			_("Are you sure you want to delete this file? It will be gone forever!") :
			_("Are you sure you want to delete these files? They will be gone forever!");

	if (wxMessageBox(message, _("Warning"), wxYES_NO | wxICON_EXCLAMATION) == wxYES)
	{
		for (const GameListItem* iso : GetAllSelectedISOs())
			File::Delete(iso->GetFileName());
		Update();
	}
}
开发者ID:LordNed,项目名称:dolphin,代码行数:13,代码来源:GameListCtrl.cpp

示例10: while

std::vector<int> OrderListCtrl::GetSelectedItems()
{
	int current = -1;
	std::vector<int> items;
	
	while (static_cast<int>(items.size()) < GetSelectedItemCount())
	{
		current = GetNextItem(current, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
		items.push_back(current);
	}

	return items;
}
开发者ID:tmich,项目名称:AeronPrint,代码行数:13,代码来源:OrderListCtrl.cpp

示例11: GetSelectedItemCount

void wxGxContentView::OnDeselected(wxListEvent& event)
{
	//event.Skip();
    if(GetSelectedItemCount() == 0)
    {
        m_pSelection->Select(m_nParentGxObjectID, false, NOTFIRESELID);
    }
    else
    {
    	LPITEMDATA pItemData = (LPITEMDATA)event.GetData();
	    if(pItemData != NULL)
        {
            m_pSelection->Unselect(pItemData->nObjectID, NOTFIRESELID);
        }
    }

	if(GetSelectedItemCount() == 0)
    {
		m_pSelection->SetInitiator(TREECTRLID);
        if (m_pGxApp)
            m_pGxApp->UpdateNewMenu(m_pSelection);
	}

    wxGISStatusBar* pStatusBar = m_pApp->GetStatusBar();
    if(pStatusBar)
    {
        if(GetSelectedItemCount() > 1)
        {
            pStatusBar->SetMessage(wxString::Format(_("%d objects selected"), GetSelectedItemCount()));
        }
        else
        {
            pStatusBar->SetMessage(wxEmptyString);
        }
    }

}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:37,代码来源:gxcontentview.cpp

示例12: GetNextItem

void CUnitPane::OnRClick(wxListEvent& event)
{
    wxMenu       menu;
    long         idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    CUnit      * pUnit = GetUnit(idx);
    int          x=0,y;

    int          width, height;

    int nItems = GetSelectedItemCount();


    wxDisplaySize(&width, &height);
    y = event.GetPoint().y;
    ClientToScreen(&x, &y);
    if (height-y < 150)
        y = height-150;
    ScreenToClient(&x, &y);

    if (nItems>1)
    {
        // multiple units
        menu.Append(menu_Popup_IssueOrders     , wxT("Issue orders"));
        menu.Append(menu_Popup_UnitFlags       , wxT("Set custom flags")    );
        menu.Append(menu_Popup_AddToTracking   , wxT("Add to a tracking group"));

        PopupMenu( &menu, event.GetPoint().x, y);
    }
    else
        if (pUnit)
        {
            // single unit
            if (pUnit->IsOurs)
            {
                menu.Append(menu_Popup_ShareSilv     , wxT("Share SILV")        );
                menu.Append(menu_Popup_Teach         , wxT("Teach")             );
                menu.Append(menu_Popup_Split         , wxT("Split")             );
                menu.Append(menu_Popup_DiscardJunk   , wxT("Discard junk items"));
                menu.Append(menu_Popup_GiveEverything, wxT("Give everything")   );
                menu.Append(menu_Popup_DetectSpies   , wxT("Detect spies")      );
            }

            menu.Append(menu_Popup_UnitFlags       , wxT("Set custom flags")    );
            menu.Append(menu_Popup_AddToTracking   , wxT("Add to a tracking group"));


            PopupMenu( &menu, event.GetPoint().x, y);
        }
}
开发者ID:ennorehling,项目名称:alh,代码行数:49,代码来源:unitpane.cpp

示例13: HitTest

void CGameListCtrl::OnLeftClick(wxMouseEvent& event)
{
	// Focus the clicked item.
	int flags;
	long item = HitTest(event.GetPosition(), flags);
	if ((item != wxNOT_FOUND) && (GetSelectedItemCount() == 0) &&
			(!event.ControlDown()) && (!event.ShiftDown()))
	{
		SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
		SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
		wxGetApp().GetCFrame()->UpdateGUI();
	}

	event.Skip();
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:15,代码来源:GameListCtrl.cpp

示例14: GetSelectedItemCount

void wxGISToolExecuteView::OnDeselected(wxListEvent& event)
{
    if(GetSelectedItemCount() == 0)
        m_pSelection->Select(m_nParentGxObjectId, false, NOTFIRESELID);

    wxGxObject* pObject = m_pCatalog->GetRegisterObject(event.GetData());
    if(!pObject)
        return;

    m_pSelection->Unselect(pObject->GetId(), NOTFIRESELID);

    wxGISStatusBar* pStatusBar = m_pApp->GetStatusBar();
    if(pStatusBar)
    {
        if(GetSelectedItemCount() > 1)
        {
            pStatusBar->SetMessage(wxString::Format(_("%d objects selected"), GetSelectedItemCount()));
        }
        else
        {
            pStatusBar->SetMessage(wxEmptyString);
        }
    }
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:24,代码来源:gxtoolexecview.cpp

示例15: WXUNUSED

void CUnitPane::OnPopupMenuUnitFlags (wxCommandEvent& WXUNUSED(event))
{
    long         idx;
    CUnit      * pUnit;
    unsigned int flags = 0;
    BOOL         ManyUnits = (GetSelectedItemCount() > 1);

    if (!ManyUnits)
    {
        idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        pUnit = GetUnit(idx);
        if (pUnit)
            flags = pUnit->Flags;
    }

    CUnitFlagsDlg dlg(this, ManyUnits?eManyUnits:eThisUnit, flags & UNIT_CUSTOM_FLAG_MASK);
    int rc = dlg.ShowModal();
    idx   = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    while (idx>=0)
    {
        pUnit = GetUnit(idx);

        switch (rc)
        {
        case wxID_OK:
            pUnit->Flags    &= ~UNIT_CUSTOM_FLAG_MASK;
            pUnit->FlagsOrg &= ~UNIT_CUSTOM_FLAG_MASK;
            pUnit->Flags    |= (dlg.m_UnitFlags & UNIT_CUSTOM_FLAG_MASK);
            pUnit->FlagsOrg |= (dlg.m_UnitFlags & UNIT_CUSTOM_FLAG_MASK);
            pUnit->FlagsLast = ~pUnit->Flags;
            break;
        case ID_BTN_SET_ALL_UNIT:
            pUnit->Flags    |= (dlg.m_UnitFlags & UNIT_CUSTOM_FLAG_MASK);
            pUnit->FlagsOrg |= (dlg.m_UnitFlags & UNIT_CUSTOM_FLAG_MASK);
            pUnit->FlagsLast = ~pUnit->Flags;
            break;
        case ID_BTN_RMV_ALL_UNIT:
            pUnit->Flags    &= ~(dlg.m_UnitFlags & UNIT_CUSTOM_FLAG_MASK);
            pUnit->FlagsOrg &= ~(dlg.m_UnitFlags & UNIT_CUSTOM_FLAG_MASK);
            pUnit->FlagsLast = ~pUnit->Flags;
            break;
        }
        idx   = GetNextItem(idx, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    }
//    Update(m_pCurLand);
    SetData(sel_by_no, -1, FALSE);

}
开发者ID:ennorehling,项目名称:alh,代码行数:48,代码来源:unitpane.cpp


注:本文中的GetSelectedItemCount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。