LONG CuEditableListCtrlGenericDerived::OnEditNumberDlgOK (UINT wParam, LONG lParam) { int iItem, iSubItem; CString s = EDITNUMBER_GetText(); EDITNUMBER_GetEditItem(iItem, iSubItem); if (iItem < 0) return 0L; try { DERIVEDLINEINFO* pData = (DERIVEDLINEINFO*)GetItemData (iItem); if (pData) { CString strOldName = pData->szname; BOOL bOk = VCBBllOnEditDependent(pData, (LPTSTR)(LPCTSTR)s); ASSERT (strOldName == pData->szname); VCBF_GenericDerivedAddItem (this, (LPCTSTR)strOldName, GetGenericForCache()); } } catch (CeVcbfException e) { // // Catch critical error TRACE1 ("CuEditableListCtrlGenericDerived::OnEditNumberDlgOK has caught exception: %s\n", e.m_strReason); CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd(); pMain->CloseApplication (FALSE); } catch (CMemoryException* e) { VCBF_OutOfMemoryMessage (); e->Delete(); } catch (...) { TRACE0 ("Other error occured ...\n"); } return 0L; }
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; }
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 ); }
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; }
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); }
void SFTPTreeView::OnMenuOpen(wxCommandEvent& event) { wxTreeListItems items; m_treeListCtrl->GetSelections(items); if ( items.empty() ) return; for(size_t i=0; i<items.size(); ++i) { MyClientData *cd = GetItemData(items.at(i)); if ( !cd || cd->IsFolder() ) { continue; } RemoteFileInfo remoteFile; remoteFile.SetAccount( m_account ); remoteFile.SetRemoteFile( cd->GetFullPath() ); SFTPThreadRequet* req = new SFTPThreadRequet(remoteFile); SFTPWorkerThread::Instance()->Add( req ); m_plugin->AddRemoteFile(remoteFile); } }
//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); } }
GF_Node *V4StudioTree::FindTransformNode(wxTreeItemId itemId) { GF_Node *transformNode = NULL; while (true) { if (itemId.IsOk()) { V4StudioTreeItemData *data = (V4StudioTreeItemData *)GetItemData(itemId); if (data != NULL) { GF_Node *itemNode = data->GetNode(); u32 tag = gf_node_get_tag(itemNode); if (tag == TAG_MPEG4_Transform2D || tag == TAG_MPEG4_TransformMatrix2D) { transformNode = itemNode; break; } } else { break; } } else { break; } itemId = GetItemParent(itemId); } return transformNode; }
///////////////////////////////////////////////////////////////////////////// // 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; } }
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); } } }
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(); }
//------------------------------------------------------------------------------ void OutputTree::ShowMenu(wxTreeItemId itemId, const wxPoint& pt) { GmatTreeItemData *treeItem = (GmatTreeItemData *)GetItemData(itemId); theSubscriberName = treeItem->GetName(); GmatTree::ItemType itemType = treeItem->GetItemType(); #if DEBUG_OUTPUT_TREE MessageInterface::ShowMessage (wxT("OutputTree::ShowMenu() theSubscriberName=%s\n"), theSubscriberName.c_str()); #endif #if wxUSE_MENUS wxMenu menu; if (itemType == GmatTree::OUTPUT_REPORT) { menu.Append(POPUP_COMPARE_NUMERIC_VALUES, wxT("Compare Numeric Values")); menu.Append(POPUP_COMPARE_TEXT_LINES, wxT("Compare Text Lines")); } PopupMenu(&menu, pt); #endif // wxUSE_MENUS }
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 ); } }
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; }
LRESULT CTreeView::OnCustomDraw(NMHDR* pnmh) { NMTVCUSTOMDRAW* pCustomDraw = reinterpret_cast<NMTVCUSTOMDRAW*>(pnmh); switch (pCustomDraw->nmcd.dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: { HTREEITEM hItem = reinterpret_cast<HTREEITEM>(pCustomDraw->nmcd.dwItemSpec); if (!m_pMainFrame->IsActiveItem(GetItemData(hItem))) { pCustomDraw->clrText = GetSysColor(COLOR_GRAYTEXT); pCustomDraw->clrTextBk = GetSysColor(COLOR_3DLIGHT); } return CDRF_DODEFAULT; } } return CDRF_DODEFAULT; }
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); } } }
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); } }
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 ); }
// 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(); }
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 }
/******************************************************************************* Function Name : OnKillFocus Input(s) : pNewWnd - Pointer to the window that got focus Output : - Functionality : This will be called if ComboItem losses its focus. This function will post a message to parent list control to inform that list data has been editied. If the loss of focus is because of Escape key this will restore the old value. These will be executed only if it is non- editable control Member of : CComboItem Friend of : Author(s) : Raja N Date Created : 21.07.2004 Modifications : Raja N on 30.07.2004, Implemented code review comments *******************************************************************************/ void CComboItem::OnKillFocus(CWnd* pNewWnd) { CComboBox::OnKillFocus(pNewWnd); int nIndex = GetCurSel(); if( m_bIsEditable == FALSE && pNewWnd // NULL condition && pNewWnd != GetParent()->GetParent() )//For Dialog Close using X Button { CString omStr; // As it is non editable Get the window text to get the selected // item text GetWindowText(omStr); // Send Notification to parent of ListView ctrl LV_DISPINFO lvDispinfo; lvDispinfo.hdr.hwndFrom = GetParent()->m_hWnd; lvDispinfo.hdr.idFrom = GetDlgCtrlID();//that's us lvDispinfo.hdr.code = LVN_ENDLABELEDIT; lvDispinfo.item.mask = LVIF_TEXT | LVIF_PARAM; lvDispinfo.item.iItem = m_nItem; lvDispinfo.item.iSubItem = m_nSubItem; lvDispinfo.item.pszText = m_bVK_ESCAPE ? LPTSTR((LPCTSTR)omStrText) : LPTSTR((LPCTSTR)omStr); lvDispinfo.item.cchTextMax = omStr.GetLength(); lvDispinfo.item.lParam = GetItemData(GetCurSel()); // For non editable the selection should not be -1 PostMessage(WM_CLOSE); if( nIndex != CB_ERR ) { // Send the End Label Edit Message GetParent()->GetParent()->SendMessage( WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&lvDispinfo); } } }
BOOL CCJShellTree::GetFolderItemPath(HTREEITEM hItem, CString &strFolderPath) { LPTVITEMDATA lptvid; //Long pointer to TreeView item data LPSHELLFOLDER lpsf2=NULL; static TCHAR szBuff[MAX_PATH]; HRESULT hr; BOOL bRet=FALSE; lptvid=(LPTVITEMDATA)GetItemData(hItem); if (lptvid && lptvid->lpsfParent && lptvid->lpi) { hr=lptvid->lpsfParent->BindToObject(lptvid->lpi, 0,IID_IShellFolder,(LPVOID *)&lpsf2); if (SUCCEEDED(hr)) { ULONG ulAttrs = SFGAO_FILESYSTEM; // Determine what type of object we have. lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); if (ulAttrs & (SFGAO_FILESYSTEM)) { if(SHGetPathFromIDList(lptvid->lpifq,szBuff)){ strFolderPath = szBuff; bRet = TRUE; } } } if(lpsf2) lpsf2->Release(); } return bRet; }
void KGMemDateList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CClientDC dc(this); //CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); LPKGLISTITEM pItem = (LPKGLISTITEM)GetItemData(lpDrawItemStruct->itemID); _ItemDate itemData; KGListCtrl::DrawItem(lpDrawItemStruct); KG_PROCESS_ERROR(pItem); pItem->GetStructData(&itemData, sizeof(itemData)); if (itemData.dwType == MEM_TYPE_COLOR) { COLORREF colorRef;// = (COLORREF)atoi(itemData.szDate); DWORD dwColor; int nColorARGB[4]; sscanf(itemData.szDate, _T("%X"), &dwColor); nColorARGB[0] = (dwColor & 0xFF000000)>>24; nColorARGB[1] = (dwColor & 0x00FF0000)>>16; nColorARGB[2] = (dwColor & 0x0000FF00)>>8; nColorARGB[3] = (dwColor & 0x000000FF); colorRef = ((COLORREF)((((nColorARGB[3])&0xff)<<24)|(((nColorARGB[2])&0xff)<<16)|(((nColorARGB[1])&0xff)<<8)|((nColorARGB[0])&0xff))); CRect rect; GetSubItemRect( lpDrawItemStruct->itemID, 1, LVIR_BOUNDS, rect ); rect.left += 12; rect.top += 2; rect.bottom -= 1; rect.right = rect.left + rect.Height(); dc.FillRect(&rect, &CBrush(colorRef)); dc.Draw3dRect(&rect, RGB(100, 100, 100), RGB(100, 100, 100)); }
LRESULT FolderTree::OnChecked(HTREEITEM hItem, BOOL &bHandled) { FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(hItem); if(!Util::validatePath(Text::fromT(pItem->m_sFQPath))) { // no checking myComp or network bHandled = TRUE; return 1; } HTREEITEM hSharedParent = HasSharedParent(hItem); // if a parent is checked then this folder should be removed from the ex list if(hSharedParent != NULL) { ShareParentButNotSiblings(hItem); } else { // if no parent folder is checked then this is a new root dir LineDlg virt; virt.title = TSTRING(VIRTUAL_NAME); virt.description = TSTRING(VIRTUAL_NAME_LONG); tstring path = pItem->m_sFQPath; if( path[ path.length() -1 ] != '\\' ) path += '\\'; if (!sp->addDirectory(path)) return 1; UpdateParentItems(hItem); } UpdateChildItems(hItem, true); return 0; }
/// Set the appropriate icon bool wxCheckListCtrl::SetIcon(long& item) { wxCheckListItemAttr* data = (wxCheckListItemAttr*) GetItemData(item); std::cout << "SetIcon : " << data << '\n'; if (data) { int imageIndex = 0; if (data->GetChecked()) { if (data->GetEnabled()) { imageIndex = wxCHECKLIST_IMAGE_CHILD_CHECK_ENABLED; } else { imageIndex = wxCHECKLIST_IMAGE_CHILD_CHECK_DISABLED; } } else { if (data->GetEnabled()) { imageIndex = wxCHECKLIST_IMAGE_CHILD_UNCHECKED_ENABLED; } else { imageIndex = wxCHECKLIST_IMAGE_CHILD_UNCHECKED_DISABLED; } } SetItemImage(item, imageIndex); return true; } else return false; }
//*************************************************************************************** BOOL CBCGFontComboBox::SelectFont (LPCTSTR lpszName, BYTE nCharSet/* = DEFAULT_CHARSET*/) { ASSERT_VALID (this); ASSERT (::IsWindow (m_hWnd)); ASSERT (lpszName != NULL); for (int i = 0; i < GetCount (); i++) { CBCGFontDesc* pFontDescr = (CBCGFontDesc*) GetItemData (i); ASSERT_VALID (pFontDescr); if (pFontDescr->m_strName == lpszName) { if (nCharSet == DEFAULT_CHARSET || nCharSet == pFontDescr->m_nCharSet) { SetCurSel (i); return TRUE; } } } return FALSE; }
void CComboInListView::OnKillFocus(CWnd* pNewWnd) { int nIndex = GetCurSel(); CComboBox::OnKillFocus(pNewWnd); CString str; GetWindowText(str); // Send Notification to parent of ListView ctrl LV_DISPINFO lvDispinfo; lvDispinfo.hdr.hwndFrom = GetParent()->m_hWnd; lvDispinfo.hdr.idFrom = GetDlgCtrlID();//that's us lvDispinfo.hdr.code = LVN_ENDLABELEDIT; lvDispinfo.item.mask = LVIF_TEXT | LVIF_PARAM; lvDispinfo.item.iItem = m_iItem; lvDispinfo.item.iSubItem = m_iSubItem; lvDispinfo.item.pszText = m_bVK_ESCAPE ? NULL : LPTSTR((LPCTSTR)str); lvDispinfo.item.cchTextMax = str.GetLength(); lvDispinfo.item.lParam = GetItemData(GetCurSel()); if(nIndex!=CB_ERR) GetParent()->GetParent()->SendMessage(WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&lvDispinfo); PostMessage(WM_CLOSE); }
const GameListItem * CGameListCtrl::GetSelectedISO() { if (m_ISOFiles.size() == 0) return NULL; else if (GetSelectedItemCount() == 0) return NULL; else { long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == wxNOT_FOUND) return NULL; 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)]; } } }
void CXTPShellListCtrlEx::OnLButtonDblClk(UINT nFlags, CPoint point) { CXTPShellListCtrl::OnLButtonDblClk(nFlags, point); int iItem = GetDoubleClickedItem(); if (iItem >= 0) { XTP_LVITEMDATA* lplvid = (XTP_LVITEMDATA*)GetItemData(iItem); if (lplvid) { ULONG ulAttrs = GetAttributes(lplvid->lpsfParent, lplvid->lpi, SHCIDS_ALLFIELDS); if ((ulAttrs & SFGAO_FOLDER) == SFGAO_FOLDER) { if (m_strItemPath.GetAt(m_strItemPath.GetLength() -1) != _T('\\')) { m_strItemPath += _T('\\'); } m_strItemPath += GetItemText(iItem, 0); BrowseToFolder(m_strItemPath); if (m_pSyncWnd != 0) { m_pSyncWnd->SetWindowText(m_strItemPath); } } else { ShellOpenItem(lplvid); } } } }
HTREEITEM CTreeCtrlEx::CopyItem(HTREEITEM hItem, HTREEITEM htiNewParent, HTREEITEM htiAfter) { TV_INSERTSTRUCT tvstruct; HTREEITEM hNewItem; CString sText; tvstruct.item.hItem = hItem; tvstruct.item.mask = TVIF_CHILDREN|TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; GetItem( &tvstruct.item ); sText = GetItemText( hItem ); tvstruct.item.cchTextMax = sText.GetLength (); tvstruct.item.pszText = sText.LockBuffer (); tvstruct.hParent = htiNewParent; tvstruct.hInsertAfter = htiAfter; tvstruct.item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT; hNewItem = InsertItem( &tvstruct ); sText.ReleaseBuffer (); SetItemData( hNewItem,GetItemData(hItem) ); SetItemState( hNewItem,GetItemState(hItem,TVIS_STATEIMAGEMASK),TVIS_STATEIMAGEMASK); Sort(htiNewParent); return hNewItem; }