本文整理汇总了C++中GetItemData函数的典型用法代码示例。如果您正苦于以下问题:C++ GetItemData函数的具体用法?C++ GetItemData怎么用?C++ GetItemData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetItemData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoItemActivated
bool CppSymbolTree::DoItemActivated(wxTreeItemId item, wxEvent &event, bool notify)
{
//-----------------------------------------------------
// Each tree items, keeps a private user data that
// holds the key for searching the its corresponding
// node in the m_tree data structure
//-----------------------------------------------------
if (item.IsOk() == false)
return false;
MyTreeItemData* itemData = static_cast<MyTreeItemData*>(GetItemData(item));
if ( !itemData ) {
event.Skip();
return false;
}
wxString filename = itemData->GetFileName();
wxString project = ManagerST::Get()->GetProjectNameByFile(filename);
wxString pattern = itemData->GetPattern();
int lineno = itemData->GetLine();
// Open the file and set the cursor to line number
if(clMainFrame::Get()->GetMainBook()->OpenFile(filename, project, lineno-1)) {
// get the editor, and search for the pattern in the file
LEditor *editor = clMainFrame::Get()->GetMainBook()->GetActiveEditor();
if (editor) {
FindAndSelect(editor, pattern, GetItemText(item));
}
}
// post an event that an item was activated
if ( notify ) {
wxCommandEvent e(wxEVT_CMD_CPP_SYMBOL_ITEM_SELECTED);
e.SetEventObject(this);
wxPostEvent(GetEventHandler(), e);
}
return true;
}
示例2: OnBeginDrag
void BFBackupTree::OnBeginDrag (wxTreeEvent& event)
{
// get data behind the item
BFBackupTreeItemData* pItemData = dynamic_cast<BFBackupTreeItemData*>(GetItemData(event.GetItem()));
if (pItemData == NULL)
return;
// selected the currently draging item
SelectItem(event.GetItem());
// init
wxFileDataObject my_data;
wxDropSource dragSource ( this );
// drag a task or a directory?
if (pItemData->GetOID() == BFInvalidOID)
{
my_data.AddFile(pItemData->GetPath());
}
else
{
// remember the currently draged task
BFTask* pTask = BFProject::Instance().GetTask(pItemData->GetOID());
if (pTask == NULL)
return;
oidCurrentDrag_ = pTask->GetOID();
// just set dummy data
my_data.AddFile("<oid>");
}
// start dragging
dragSource.SetData(my_data);
dragSource.DoDragDrop( TRUE );
}
示例3: GetChildItem
HTREEITEM FolderTree::FindServersNode(HTREEITEM hFindFrom) const
{
if (m_bDisplayNetwork)
{
//Try to find some "servers" in the child items of hFindFrom
HTREEITEM hChild = GetChildItem(hFindFrom);
while (hChild)
{
FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(hChild);
if (pItem->m_pNetResource)
{
//Found a share
if (pItem->m_pNetResource->dwDisplayType == RESOURCEDISPLAYTYPE_SERVER)
return hFindFrom;
}
//Get the next sibling for the next loop around
hChild = GetNextSiblingItem(hChild);
}
//Ok, since we got here, we did not find any servers in any of the child nodes of this
//item. In this case we need to call ourselves recursively to find one
hChild = GetChildItem(hFindFrom);
while (hChild)
{
HTREEITEM hFound = FindServersNode(hChild);
if (hFound)
return hFound;
//Get the next sibling for the next loop around
hChild = GetNextSiblingItem(hChild);
}
}
//If we got as far as here then no servers were found.
return NULL;
}
示例4: GetItemRect
void SeriesListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
ProtectedSeriesArray& Series=*(SeriesListCtrl::Series); void *x;
HitItem=HitTest(point);
if (HitItem>=0)
{
CRect rect; GetItemRect(HitItem, rect, LVIR_ICON);
if (point.x < rect.left)
{
BYTE state=GetState(HitItem);
state++; if(state>2) state=1;
SetState(HitItem,state);
if((x=Series.GainAcsess(WRITE))!=0)
{
SeriesProtector Protector(x); TSeriesArray& Series(Protector);
Series[GetItemData(HitItem)]->SetVisible(state-1);
}
}
}
CListCtrl::OnLButtonDown(nFlags, point);
}
示例5: MultiSelectItem
//selects a specified node in multiple selection mode
void CLTWinTreeMgr::MultiSelectItem(HTREEITEM hItem, BOOL bSelect)
{
//get the item
if(hItem == NULL)
{
return;
}
CLTWinTreeItem* pItem = (CLTWinTreeItem*)GetItemData(hItem);
if(pItem && (pItem->m_bSelected != bSelect))
{
//save it
pItem->m_bSelected = bSelect;
//set the flag to the appropriate item
SetItemState(hItem, (bSelect) ? TVIS_SELECTED : 0, TVIS_SELECTED);
//trigger the callback
TriggerChangeSel(pItem);
}
}
示例6: if
/////////////////////////////////////////////////////////////////////////////
// CReportCtrl message handlers
void CReportCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
if (lplvcd->nmcd.dwDrawStage == CDDS_PREPAINT)
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if (lplvcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT)
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if (lplvcd->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT | CDDS_SUBITEM))
{
int serial = GetItemData(lplvcd->nmcd.dwItemSpec);
ItemColorMap::iterator it = m_itemColor.find(serial);
if (it != m_itemColor.end())
{
lplvcd->clrText = it->second;
}
*pResult = CDRF_DODEFAULT;
}
}
示例7: GetItemData
void SFTPTreeView::OnMenuNewFile(wxCommandEvent& event)
{
wxArrayTreeItemIds items;
m_treeCtrl->GetSelections(items);
if(items.size() != 1) return;
MyClientData* cd = GetItemData(items.Item(0));
CHECK_PTR_RET(cd);
if(!cd->IsFolder()) { return; }
wxString defaultValue;
static size_t s_untitledCounter = 0;
defaultValue << "Untitled" << ++s_untitledCounter;
wxString new_name = ::wxGetTextFromUser(_("Enter the new file name:"), _("New File"), defaultValue);
if(!new_name.IsEmpty()) {
wxString fullpath = cd->GetFullPath();
fullpath << "/" << new_name;
wxTreeItemId fileItem = DoAddFile(items.Item(0), fullpath);
if(fileItem.IsOk()) { DoOpenFile(fileItem); }
}
}
示例8: GetItemCount
void CCheckList::OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// TODO: Add your control notification handler code here
*pResult = 0;
int ItemCount = GetItemCount( );
if( ItemCount == 0 )
return;
//跟踪每一行绘制其中文字和内容
for( int i = 0; i < ItemCount; i++ )
{
ListNode* Node = (ListNode*)GetItemData( i );
if( pNMLV->iSubItem == 1 )
Node->m_ExpType = enumPT_VERTEXANI;
if( pNMLV->iSubItem == 2 && Node->m_NodeType == enumNT_SKELETALMESH )
Node->m_ExpType = enumPT_SKELETALANI;
if( pNMLV->iSubItem == 3 )
Node->m_ExpType = enumPT_NONEANI;
}
Invalidate();
}
示例9: GetCursorPos
void MyGameTreeCtrl::ClickTreeItem( HTREEITEM treeItem )
{
CPoint pt;
GetCursorPos(&pt);
ScreenToClient(&pt);
m_iCurItem = (int)GetItemData(treeItem);
if( m_BtnRect.PtInRect(pt) )
{
//显示右键
}
else
{
if( m_mapNode.find( treeItem) != m_mapNode.end() )
{
//GLOBAL_QQDATA->IQQData_ChangeItem2Old( m_iCurItem );
//SetItemImage( treeItem,m_mapBitmap2Index[m_mapNode[treeItem].second],m_mapBitmap2Index[m_mapNode[treeItem].second] );
m_mapNode.erase( treeItem );
}
SearchTreeItem( treeItem );
}
}
示例10: DelItemRecursive
BOOL CPropertiesCtrl::DelItemRecursive( HTREEITEM hItem )
{
if( !hItem )
return TRUE;
HTREEITEM hChild = NULL;
for( hChild = GetNextItem( hItem, TVGN_CHILD ); hChild; hChild = GetNextItem( hItem, TVGN_CHILD ) )
DelItemRecursive( hChild );
CFTCItemData * pItemData = (CFTCItemData*)GetItemData( hItem );
if( pItemData )
{
m_piMalloc->Free( pItemData->m_pIDL );
pItemData->m_pIDL = NULL;
}
delete pItemData;
DeleteItem( hItem );
return TRUE;
}
示例11: GetItemData
void TTreeView::AppendEntry(XGDraw &draw, short inset, TableEntryRecord *r)
{
TableDrawRecord data;
TableEntryRecord *te;
long width;
char buffer[256];
fLength++;
data.inset = inset;
data.entry = r;
fDrawList.Append(sizeof(data),&data);
GetItemData((uint32)r,buffer,sizeof(buffer));
width = 5 + (inset + 1) * 22 + draw.StringWidth(buffer);
if (width > fWidth) fWidth = width;
if (r->fOpen) {
inset++;
for (te = r->child; te != NULL; te = te->next) {
AppendEntry(draw,inset,te);
}
}
}
示例12: GetFirstSelectedItemPosition
void CDownloads_Deleted::OnDeletedRestore()
{
DLDS_LIST v;
POSITION pos = GetFirstSelectedItemPosition ();
while (pos)
{
int iItem = GetNextSelectedItem (pos);
vmsDownloadSmartPtr dld = (fsDownload*) GetItemData (iItem);
v.push_back (dld);
}
if (v.size ())
{
if (_pwndDownloads->Get_DWWN () == DWWN_DELETED)
_pwndDownloads->m_wndDeleted.ShowWindow (SW_HIDE);
try {
_DldsMgr.RestoreDownloads (v);
}
catch (...) {}
if (_pwndDownloads->Get_DWWN () == DWWN_DELETED)
_pwndDownloads->m_wndDeleted.ShowWindow (SW_SHOW);
}
}
示例13: DragData
void wxGISToolExecuteView::OnBeginDrag(wxListEvent& event)
{
wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(m_nParentGxObjectId);
if(!pGxObject)
return;
wxGISTaskDataObject DragData(wxThread::GetMainId(), wxDataFormat(wxGIS_DND_ID));
long nItem = wxNOT_FOUND;
int nCount(0);
for ( ;; )
{
nItem = GetNextItem(nItem, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if ( nItem == wxNOT_FOUND )
break;
DragData.AddDecimal(GetItemData(nItem));
}
wxDropSource dragSource( this );
dragSource.SetData( DragData );
wxDragResult result = dragSource.DoDragDrop( wxDrag_DefaultMove );
}
示例14: ScreenToClient
// Show help for this window
void ctConfigTreeCtrl::OnHelp(wxHelpEvent& event)
{
wxPoint pt = ScreenToClient(event.GetPosition());
int flags = 0;
wxTreeItemId id = HitTest(pt, flags);
ctTreeItemData *itemData = (ctTreeItemData*) GetItemData(id);
wxHelpProvider *helpProvider = wxHelpProvider::Get();
if ( helpProvider && itemData)
{
ctConfigItem* item = itemData->GetConfigItem();
if (item)
{
wxString helpTopic = item->GetPropertyString(wxT("help-topic"));
if (!helpTopic.IsEmpty())
{
wxGetApp().GetReferenceHelpController().DisplaySection(helpTopic);
return;
}
}
}
event.Skip();
}
示例15: GetNextItem
void CQueueListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED);
const CUpDownClient* client = (iSel != -1) ? (CUpDownClient*)GetItemData(iSel) : NULL;
CTitleMenu ClientMenu;
ClientMenu.CreatePopupMenu();
ClientMenu.AddMenuTitle(GetResString(IDS_CLIENTS), true);
ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS"));
ClientMenu.SetDefaultItem(MP_DETAIL);
//Xman friendhandling
ClientMenu.AppendMenu(MF_SEPARATOR);
//Xman end
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND"));
//Xman friendhandling
ClientMenu.AppendMenu(MF_STRING | (client && client->IsFriend() ? MF_ENABLED : MF_GRAYED), MP_REMOVEFRIEND, GetResString(IDS_REMOVEFRIEND), _T("DELETEFRIEND"));
ClientMenu.AppendMenu(MF_STRING | (client && client->IsFriend() ? MF_ENABLED : MF_GRAYED), MP_FRIENDSLOT, GetResString(IDS_FRIENDSLOT), _T("FRIENDSLOT"));
ClientMenu.CheckMenuItem(MP_FRIENDSLOT, (client && client->GetFriendSlot()) ? MF_CHECKED : MF_UNCHECKED);
ClientMenu.AppendMenu(MF_SEPARATOR);
//Xman end
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE"));
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetViewSharedFilesSupport()) ? MF_ENABLED : MF_GRAYED), MP_SHOWLIST, GetResString(IDS_VIEWFILES), _T("VIEWFILES"));
if (thePrefs.IsExtControlsEnabled())
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->IsBanned()) ? MF_ENABLED : MF_GRAYED), MP_UNBAN, GetResString(IDS_UNBAN));
if (Kademlia::CKademlia::IsRunning() && !Kademlia::CKademlia::IsConnected())
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetKadPort()!=0 && client->GetKadVersion() > 1) ? MF_ENABLED : MF_GRAYED), MP_BOOT, GetResString(IDS_BOOTSTRAP));
ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search"));
// - show requested files (sivka/Xman)
ClientMenu.AppendMenu(MF_SEPARATOR);
ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED),MP_LIST_REQUESTED_FILES, GetResString(IDS_LISTREQUESTED), _T("FILEREQUESTED"));
//Xman end
GetPopupMenuPos(*this, point);
ClientMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
VERIFY( ClientMenu.DestroyMenu() ); // XP Style Menu [Xanatos] - Stulle
}