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


C++ GetSelectedItem函数代码示例

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


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

示例1: GetCursorPos

void CSiteGroupsTree::OnRightClick(NMHDR *, LRESULT *result)
{
    CPoint pt;
    GetCursorPos(&pt);
    CPoint ptClient = pt;
    ScreenToClient(&ptClient);
    
    HTREEITEM item = HitTest(ptClient);
    if (item == 0)
        item = GetSelectedItem();

    UpdateMenu(m_menu, item);
    m_menu.TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, this);

    *result = 1;
}
开发者ID:death,项目名称:webwatch,代码行数:16,代码来源:SiteGroupsTree.cpp

示例2: Dlg

void ValueListCtrl::OnDelete(wxCommandEvent& event)
{
  wxMessageDialog Dlg(this, "Are you sure you want to delete this value?", "Confirm Value Delete", wxYES_NO | wxICON_EXCLAMATION );
  if(Dlg.ShowModal() != wxID_YES)
  {
    return;
  }
  long Item = GetSelectedItem();
  if(Item == -1)
  {
    return ;
  }
  wxString Text = GetItemText(Item);
  m_pConfig->remove_value(m_Key, Text);
  DeleteItem(Item);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:16,代码来源:ValueListCtrl.cpp

示例3: GetSelectedItem

void MenuEditor::AddItem(const wxString& label, const wxString& shortcut,
  const wxString& id, const wxString& name, const wxString &help, const wxString &kind)
{
    int sel = GetSelectedItem();
    int identation = 0;
    if (sel >= 0) identation = GetItemIdentation(sel);
    wxString labelAux = label;
    labelAux.Trim(true);
    labelAux.Trim(false);
    if (sel < 0) sel = m_menuList->GetItemCount() - 1;

    labelAux = wxString(wxChar(' '), identation * IDENTATION) + labelAux;

    long index = InsertItem(sel + 1, labelAux, shortcut, id, name, help, kind);
    m_menuList->SetItemState(index, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
开发者ID:Three-DS,项目名称:wxformbuilder-3.5.0,代码行数:16,代码来源:menueditor.cpp

示例4: GetSelectedItem

void CPageSound::OnSelectButton() 
{
	int iSel = GetSelectedItem();
	
	if(iSel!=-1)
	{
		CString strFileName = m_SoundPathList.GetItemText(iSel,1);
		CFileDialog OpenDlg(TRUE,NULL,strFileName,OFN_CREATEPROMPT|OFN_EXPLORER,GetString(IDS_SOUND_FORMAT),this);
		if(OpenDlg.DoModal()==IDOK)
		{
			m_SoundPathList.SetItemText(iSel,1,OpenDlg.GetPathName());
			SetModified();
		}
	}
	BlockOrUnBlock();
}
开发者ID:0anion0,项目名称:IBN,代码行数:16,代码来源:PageSound.cpp

示例5: GetSelectedItem

void CMyTreeListControl::OnContextMenu(CWnd* /*pWnd*/, CPoint pt)
{
	int i= GetSelectedItem();
	if (i == -1)
		return;

	CTreeListItem *item= GetItem(i);

	CRect rc= GetWholeSubitemRect(i, 0);
	CRect rcTitle= item->GetTitleRect() + rc.TopLeft();

	CMenu menu;
	menu.LoadMenu(IDR_POPUPLIST);
	CMenu *sub= menu.GetSubMenu(0);

	PrepareDefaultMenu(sub, (CItem *)item);
	GetMainFrame()->AppendUserDefinedCleanups(sub);

	// Show popup menu and act accordingly.
	//
	// The menu shall not overlap the label but appear
	// horizontally at the cursor position,
	// vertically under (or above) the label.
	// TrackPopupMenuEx() behaves in the desired way, if
	// we exclude the label rectangle extended to full screen width.
	// 
	// Thanks to Sven for this compromise between the old Windirstat
	// behavior (show the menu to the right of the label) and the
	// Explorer behavior (show the menu at the cursor position).

	TPMPARAMS tp;
	tp.cbSize = sizeof(tp);
	tp.rcExclude = rcTitle;
	ClientToScreen(&tp.rcExclude);

	CRect desktop;
	GetDesktopWindow()->GetWindowRect(desktop);

	tp.rcExclude.left = desktop.left;
	tp.rcExclude.right = desktop.right;

	const int overlap = 2;	// a little vertical overlapping
	tp.rcExclude.top += overlap;
	tp.rcExclude.bottom -= overlap;

	sub->TrackPopupMenuEx(TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, AfxGetMainWnd(), &tp);
}
开发者ID:Meitinger,项目名称:windirstat,代码行数:47,代码来源:dirstatview.cpp

示例6: GetSelectedItem

void CTreeFileCtrl::OnRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult) 
{
  //Remember the old selected item
  HTREEITEM hOldSelItem = GetSelectedItem();

  //Work out the position of where the context menu should be
  CPoint p(GetCurrentMessage()->pt);
  CPoint pt(p);
  ScreenToClient(&pt);
  Select(HitTest(pt), TVGN_CARET);
	OnContextMenu(NULL, p);

  //Reselect the old selected item
  Select(hOldSelItem, TVGN_CARET);
	
	*pResult = 0;
}
开发者ID:5432935,项目名称:genesis3d,代码行数:17,代码来源:FileTreeCtrl.cpp

示例7: notify

void CFileListManager::OnUnloadFiles( KeyValues *pParams )
{
	CNotifyScopeGuard notify( "CFileListManager::OnUnloadFiles", NOTIFY_SOURCE_FILE_LIST_MANAGER, NOTIFY_SETDIRTYFLAG );

	int nSelected = GetSelectedItemsCount();
	for ( int i = 0; i < nSelected; ++i )
	{
		int itemId = GetSelectedItem( i );
		DmFileId_t fileid = ( DmFileId_t )GetItemUserData( itemId );
		if ( g_pDataModel->IsFileLoaded( fileid ) )
		{
			SetLoaded( fileid, false );
		}
	}

	Refresh();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:17,代码来源:FileListManager.cpp

示例8: GetSelectedItem

//---------------------------- PRIVATE          -----------------------------//
void wxContextListCtrl::LeftDown(wxMouseEvent &)
{
	wxInt32 index = GetSelectedItem();

	if(-1 != index)
	{
		wxInt32 id = GetItemData(index);

		// Since we're a menu, we just want clicks, not selections.
		SetSelectedItem(-1);

		Controller::get().Transmit(shEventContextMenuClick, id);
		
		wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, id);
		ProcessEvent(command);
	}
}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:18,代码来源:ContextListCtrl.cpp

示例9: GetSelectedItem

void CTabMemSpellsDlg::OnMaxdec() 
{
	int nIndex = GetSelectedItem();
	if (nIndex == -1)
		return;

	CString strNum;
	int nNum;
	
	strNum = m_lcList.GetItemText(nIndex,2);
	nNum = atoi(strNum);
	if (nNum > 0)
	{
		strNum.Format("%d",nNum-1);
		m_lcList.SetItemText(nIndex,2,strNum);
	}
}
开发者ID:devurandom,项目名称:shadowkeeper,代码行数:17,代码来源:TabMemSpellsDlg.cpp

示例10: GetSelectedItem

void CDirectoryTreeCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if (nChar == VK_SPACE)
	{
		HTREEITEM hItem = GetSelectedItem();
		if (hItem)
		{
			ShareSubDirTree(hItem, GetKeyState(VK_CONTROL) & 0x8000);

			// if Ctrl+Space is passed to the tree control, it just beeps and does not check/uncheck the item!
			SetCheck(hItem, !GetCheck(hItem));
			return;
		}
	}

	CTreeCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:17,代码来源:DirectoryTreeCtrl.cpp

示例11: SendMessage

/**
 * Call when adapter selection changed. This will reset device
 * combobox, list devices for new adapter, and call ChangedDevice().
 */
void ZFXD3DEnum::ChangedAdapter(void) {
   ZFXADAPTERINFO *pA=NULL;

   // delete content of device combobox
   SendMessage(m_hDEVICE, CB_RESETCONTENT, 0, 0);

   pA = (ZFXADAPTERINFO *)GetSelectedItem(m_hADAPTER);

   for (UINT d=0; d<pA->nNumDevs; d++) {
      AddItem(m_hDEVICE, D3DDevTypeToString(pA->d3dDevs[d].
              d3dDevType), &pA->d3dDevs[d]);
     }
   SendMessage(m_hDEVICE, CB_SETCURSEL, (WPARAM)0, 0);
   
   // treat as if device slectio changed
   ChangedDevice();
   } // ChangedAdapter
开发者ID:slipslob,项目名称:3d-zfxengine,代码行数:21,代码来源:ZFXD3D_enum.cpp

示例12: KillTimer

void CTreeCtrlEx::OnTimer(UINT nIDEvent)
{
	if (nIDEvent == TCEX_EDITLABEL)
	{
		// Stop the timer.
		KillTimer(m_idTimer);

		// Invoke label editing.
		if (m_bEditLabelPending)
			EditLabel(GetSelectedItem());

		m_bEditLabelPending = FALSE;
		return;
	}

	CTreeCtrl::OnTimer(nIDEvent);
}
开发者ID:mikemakuch,项目名称:muzikbrowzer,代码行数:17,代码来源:TreeCtrlEx.cpp

示例13: switch

void CDirectoryTreeCtrl::OnTvnKeydown(NMHDR *pNMHDR, LRESULT *pResult)
{ 
	LPNMTVKEYDOWN pTVKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(pNMHDR);

	switch(pTVKeyDown->wVKey)
	{
		case VK_SPACE:
		case VK_RETURN:
		{
			HTREEITEM hItem = GetSelectedItem();

			if(hItem)
			{		
				HTREEITEM tItem = GetFirstVisibleItem();

				CheckChanged(hItem, !GetCheck(hItem));
								
				if(m_bCtrlPressed)
				{
					Expand(hItem, TVE_TOGGLE);
					HTREEITEM hChild;
					hChild = GetChildItem(hItem);

					while(hChild != NULL)
					{ 
						MarkChilds(hChild,!GetCheck(hItem));
						hChild = GetNextSiblingItem( hChild );
					}

					SetCheck(hItem, !GetCheck(hItem));
					Expand(hItem, TVE_TOGGLE);
				}
		 
				SelectSetFirstVisible(tItem);
			}

			break;
		}

		default:
			break;
	}

	*pResult = 0;
}
开发者ID:rusingineer,项目名称:EmulePlus,代码行数:45,代码来源:DirectoryTreeCtrl.cpp

示例14: GetSelectedItem

/**
 *\fn           HRESULT GetCurProject(Project **ppProject)
 *\brief        得到当前项目
 *\param[in]    Project * * ppProject 项目指针
 *\return       HRESULT 0成功,其它失败
 */
HRESULT CAddinProcess::GetCurProject(Project **ppProject)
{
    CComPtr<SelectedItem> selectItem;
    HRESULT hr = GetSelectedItem(1, &selectItem);

    if (SUCCEEDED(hr) && selectItem != NULL)
    {
        CComPtr<ProjectItem> item;
        hr = selectItem->get_ProjectItem(&item);

        if (SUCCEEDED(hr) && item != NULL)
        {
            hr = item->get_ContainingProject(ppProject);
        }
    }

    return hr;
}
开发者ID:tempbottle,项目名称:TestSet,代码行数:24,代码来源:AddinProcess.cpp

示例15: GetSelectedItem

BOOL CShellTreeCtrl::GetCurFilePath(CString & str)
{
	LPTVITEMDATA	lptvid;
	char		szBuff[MAX_PATH];
	HTREEITEM		hItem=NULL;

	hItem = GetSelectedItem();

	lptvid=(LPTVITEMDATA)GetItemData(hItem);

	if(SHGetPathFromIDList(lptvid->lpifq,szBuff))
	{
		str = szBuff;
		return TRUE;
	}
	else
		return FALSE;
}
开发者ID:vicentdsmin,项目名称:myie,代码行数:18,代码来源:ShellTreeCtrl.cpp


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