• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetSelectedItemCount函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: BuildPopupMenu

void wxExListViewFile::BuildPopupMenu(wxExMenu& menu)
{
  const long style = menu.GetStyle() |
    (GetFileName().GetStat().IsReadOnly() ? wxExMenu::MENU_IS_READ_ONLY: 0);

  menu.SetStyle(style);

  wxExListViewWithFrame::BuildPopupMenu(menu);
    
  if ( GetSelectedItemCount() == 0 &&
      !GetFileName().GetStat().IsReadOnly())
  {
    menu.AppendSeparator();
    menu.Append(wxID_ADD);
  }
}
开发者ID:hugofvw,项目名称:wxExtension,代码行数:16,代码来源:listviewfile.cpp


示例17: _

void exclusion_listctrl::popup_menu( wxMouseEvent& event )
{
    wxMenu      a_menu;

    a_menu.Append( PU_ADD_EXCLUSION, _( "Add a new exclusion...") );
    a_menu.Append( PU_EDIT_EXCLUSION, _( "Edit selected exclusion..." ) );
    a_menu.Append( PU_DELETE_EXCLUSION, _( "Delete selected exclusion" ) );
    
    // If no listctrl rows selected, then disable the menu items that require selection
    if ( GetSelectedItemCount() == 0 ) 
    {
        a_menu.Enable( PU_EDIT_EXCLUSION, FALSE );
        a_menu.Enable( PU_DELETE_EXCLUSION, FALSE );
    }

    // Show the popup menu (wxWindow::PopupMenu ), at the x,y position of the click event 
    PopupMenu( &a_menu, event.GetPosition() );
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:18,代码来源:exclusion_listctrl.cpp


示例18: if

const GameListItem* CGameListCtrl::GetSelectedISO() const
{
	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;
		return m_ISOFiles[GetItemData(item)];
	}
}
开发者ID:LordNed,项目名称:dolphin,代码行数:18,代码来源:GameListCtrl.cpp


示例19: list

CMuleListCtrl::ItemDataList CMuleListCtrl::GetSelectedItems() const
{
	// Create the initial vector with as many items as are selected
	ItemDataList list( GetSelectedItemCount() );
	
	// Current item being located
	unsigned int current = 0;
	
	long pos = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
	while ( pos != -1 ) {
		wxASSERT( current < list.size() );
	
		list[ current++ ] = GetItemData( pos );

		pos = GetNextItem( pos, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
	}
	
	return list;
}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:19,代码来源:MuleListCtrl.cpp


示例20: GetSelectedItemCount

void CQueueViewFailed::OnContextMenu(wxContextMenuEvent& event)
{
	wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_QUEUE_FAILED"));
	if (!pMenu)
		return;

#ifndef __WXMSW__
	// GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1)
	const bool has_selection = GetSelectedItemCount() != 0;
#else
	const bool has_selection = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1;
#endif

	pMenu->Enable(XRCID("ID_REMOVE"), has_selection);
	pMenu->Enable(XRCID("ID_REQUEUE"), has_selection);

	PopupMenu(pMenu);
	delete pMenu;
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:19,代码来源:queueview_failed.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetSelection函数代码示例发布时间:2022-05-30
下一篇:
C++ GetSelectedItem函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap