//-------------------------------------------------------------------// // AddDialogTab() // //-------------------------------------------------------------------// // Make sure these dlgs are fully created before calling Init(). // Also, make sure that you used this tab ctrl as the parent of // the dialogs! //-------------------------------------------------------------------// void ChildDlgTabCtrl::AddDialogTab( CDialog* pNewDlg, LPCTSTR szName ) { // Did you make the tab ctrl the parent? // Otherwise, sizing will be all screwed up. ASSERT( pNewDlg->GetParent() == this ); // The majority of our flicker elimination comes from setting // WS_CLIPCHILDREN for the dialog. MAKE SURE THIS IS SET! // See MSJ May '97 C++ Q&A for more info - thanks again, Paul! ASSERT( pNewDlg->GetStyle() & WS_CLIPCHILDREN ); InsertItem( TabDlgs.size(), szName ); TabDlgs.push_back( pNewDlg ); }
//向列表框中添加行 BOOL CMyListCtrl::AddItem(int nItem,int nSubItem,LPCTSTR strItem,int nImageIndex) { LV_ITEM lvItem; lvItem.mask = LVIF_TEXT; lvItem.iItem = nItem; lvItem.iSubItem = nSubItem; lvItem.pszText = (LPTSTR) strItem; // lvItem.Height=20; if(nImageIndex != -1){ lvItem.mask |= LVIF_IMAGE; lvItem.iImage |= LVIF_IMAGE; } if(nSubItem == 0) return InsertItem(&lvItem); return SetItem(&lvItem); }
HTREEITEM CViewTree::AddItem(HTREEITEM hParent, LPCTSTR szText, int iImage) { TVITEM tvi; ZeroMemory(&tvi, sizeof(TVITEM)); tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.iImage = iImage; tvi.iSelectedImage = iImage; tvi.pszText = (LPTSTR)szText; TVINSERTSTRUCT tvis; ZeroMemory(&tvis, sizeof(TVINSERTSTRUCT)); tvis.hParent = hParent; tvis.item = tvi; return InsertItem(tvis); }
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); }
void CSharedFilesCtrl::DoShowFile(CKnownFile* file, bool batch) { wxUIntPtr ptr = reinterpret_cast<wxUIntPtr>(file); if ((!batch) && (FindItem(-1, ptr) > -1)) { return; } const long insertPos = (batch ? GetItemCount() : GetInsertPos(ptr)); long newitem = InsertItem(insertPos, wxEmptyString); SetItemPtrData( newitem, ptr ); if (!batch) { ShowFilesCount(); } }
int CTDLFindResultsListCtrl::AddResult(const SEARCHRESULT& result, LPCTSTR szTask, LPCTSTR/*szPath*/, const CFilteredToDoCtrl* pTDC) { int nPos = GetItemCount(); // add result int nIndex = InsertItem(nPos, szTask); SetItemText(nIndex, 1, Misc::FormatArray(result.aMatched)); UpdateWindow(); // map identifying data FTDRESULT* pRes = new FTDRESULT(result.dwID, pTDC, result.HasFlag(RF_DONE)); SetItemData(nIndex, (DWORD)pRes); return nIndex; }
void CMIDIMappingDialog::OnBnClickedButtonAdd() //--------------------------------------------- { if(m_rSndFile.GetModSpecifications().MIDIMappingDirectivesMax <= m_rMIDIMapper.GetCount()) { Reporting::Information("Maximum amount of MIDI Mapping directives reached."); } else { const size_t i = m_rMIDIMapper.AddDirective(m_Setting); if(m_rSndFile.GetpModDoc()) m_rSndFile.GetpModDoc()->SetModified(); SelectItem(InsertItem(m_Setting, i)); OnSelectionChanged(); } }
struct node* insertMax( struct node* node, int studentId, struct item* item ) { int i = node->numChildren; node->keys[i] = studentId; // node's greatest key is studentId if ( node->isLeafNode == YES ) { node->courseList[i] = InsertItem( node->courseList[i], item ); node->numChildren = node->numChildren + 1; } else { if ( node->children[i-1]->numChildren == 4 ) { // if slotting in studentId made 4 children node = split( node, i ); i++; } node = insertMax( node->children[i-1], studentId, item ); } return node; } // insertMax
void CUsersListCtrl::ProcessConnOp(int op, const t_connectiondata &connectionData) { if (op==USERCONTROL_CONNOP_ADD) { CString str; if (connectionData.user=="") str.Format("(not logged in) (%06d)",connectionData.userid); else str.Format("%s (%06d)",connectionData.user,connectionData.userid); int index=InsertItem(GetItemCount(),str); t_connectiondata *pData = new t_connectiondata; *pData = connectionData; SetItemData(index, (DWORD)pData); } else if (op==USERCONTROL_CONNOP_MODIFY) { for (int i=0;i<GetItemCount();i++) { t_connectiondata *pData=(t_connectiondata *)GetItemData(i); if (pData->userid==connectionData.userid) { *pData = connectionData; CString str; if (connectionData.user=="") str.Format("(not logged in) (%06d)",connectionData.userid); else str.Format("%s (%06d)",connectionData.user,connectionData.userid); SetItemText(i,0,str); break; } } } else if (op==USERCONTROL_CONNOP_REMOVE) { for (int i=0;i<GetItemCount();i++) { t_connectiondata *pData=(t_connectiondata *)GetItemData(i); if (pData->userid==connectionData.userid) { delete pData; DeleteItem(i); break; } } } }
/** * * \param lpszFilePath * \param lpszFilter * \return */ BOOL CImageListBox::Load(LPCTSTR lpszFilePath, LPCTSTR lpszFilter) { char szPath[MAX_PATH]; sprintf(szPath, "%s\\%s", lpszFilePath, lpszFilter); SetRedraw( FALSE ); WIN32_FIND_DATA wDt; HANDLE hFile = ::FindFirstFile(szPath, &wDt); if (hFile != INVALID_HANDLE_VALUE) { BOOL bFind = TRUE; while( bFind ) { if (!(wDt.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { CString s(wDt.cFileName); if (!s.IsEmpty()) { CImage image; sprintf(szPath, "%s\\%s", lpszFilePath, wDt.cFileName); image.Load(szPath); CBitmap* pBitmap = CBitmap::FromHandle((HBITMAP)image); if (pBitmap) { // 添加位图 int image = m_ImageList.Add(pBitmap, RGB(0, 0, 0)); int nItem = image ? image - 1 : 0; // 插入项目 InsertItem(nItem, s.GetBuffer(), image); } } } bFind = ::FindNextFile(hFile, &wDt); } ::FindClose(hFile); } SetRedraw(TRUE); Invalidate(); return TRUE; }
int KGListCtrl::InsertDepend(LPKGLISTITEM pParentItem, LPKGLISTITEM pInsertItem) { int nResult = false; int nRetCode = false; LPKGLISTITEM pPreItem = m_listDataTree.FindLastVisualChild(pParentItem); int nInsertPos = 0; int nColsNumber = GetHeaderCtrl()->GetItemCount(); KG_PROCESS_ERROR(pInsertItem); nRetCode = m_listDataTree.AddDepend(pParentItem, pInsertItem); KG_PROCESS_ERROR(nRetCode); nRetCode = !m_listDataTree.IsVisual(pInsertItem); KG_PROCESS_SUCCESS(nRetCode); if (pPreItem) { nInsertPos = FindItemPos(pPreItem) + 1; } else { if (pParentItem) { nInsertPos = FindItemPos(pParentItem) + 1; } else { nInsertPos = 0; } } if (nColsNumber > pInsertItem->arryItemText.GetCount()) { nColsNumber = (int)pInsertItem->arryItemText.GetCount(); } InsertItem(nInsertPos, NULL); SetItemData(nInsertPos, (DWORD_PTR)pInsertItem); RetrievesItemData(pInsertItem); Exit1: nResult = true; Exit0: return nResult; }
// Restores the entire list if the filter is empty void wxAdvancedListCtrl::RestoreList() { if (BackupItems.empty()) return; DeleteAllItems(); for (size_t x = 0; x < BackupItems.size(); ++x) { InsertItem(x, wxT("")); for (size_t y = 0; y < BackupItems[x].size(); ++y) { SetItem(BackupItems[x][y]); } } }
void GUI_manager::add_IMG(const char* full_path_file_name) { int item = ListView_GetItemCount(IMG_list); vector<internal_file> TRE_file_list; char tmp[1024]; char local_file_name[1024]; char t_file_type[255]; char drive[5]; char dir[1024]; GetWindowText(region_name,tmp,1000); _splitpath(full_path_file_name,drive,dir,local_file_name,t_file_type); if( !strcmp(strupr( t_file_type ),".TXT" ) ) { FILE* list = fopen(full_path_file_name,"r"); char file_name[1025]; strcpy(tmp,"map"); if( list ) { while( fgets(file_name,1024,list) != NULL ) { //remove 'non asci' chars! while( file_name[strlen(file_name)-1] < 32 && strlen(file_name)) file_name[strlen(file_name)-1] = 0; if( strlen(file_name) ) { if( file_name[0] == ':' ) { strcpy(tmp,&file_name[1]); } else { uploader->add_img_file(file_name,&TRE_file_list,"",0,0,tmp,uploader->get_product_id(tmp)); } } } fclose(list); } } else { uploader->add_img_file(full_path_file_name,&TRE_file_list,"",0,0,tmp,uploader->get_product_id(tmp)); } for( vector<internal_file>::iterator f = TRE_file_list.begin(); f < TRE_file_list.end(); f++ ) { InsertItem(IMG_list, item , LPARAM("%s"),(*f).region_name.c_str()); SetSubItemText (IMG_list, item, 1, "%s", (*f).TRE_map_name.c_str()); SetSubItemText (IMG_list, item, 2, "%s", (*f).file_name.c_str()); SetSubItemText (IMG_list, item, 3, "%s", (*f).get_internal_short_name()); } AutoSizeColumns(IMG_list); show_size(); }
void GUI_manager::enter_sync_mode(bool verbose) { char b_title1[500]; char b_title2[500]; int item = ListView_GetItemCount(IMG_list); vector<internal_file> TRE_file_list; sync_mode = false; if( connect(true) == false ) return; SetSelection(IMG_list,0); while( remove_IMG() ) ; loadString(IDS_SYNC_START,b_title1,sizeof(b_title1)); loadString(IDS_SYNC_TITLE,b_title2,sizeof(b_title2)); if( verbose ) { if( MessageBox(NULL,b_title1,b_title2,MB_ICONERROR | MB_YESNO) == IDYES ) { sync_mode = true; } } else sync_mode = true; if( sync_mode ) { EnableWindow(GetDlgItem (gui_hwndDlg, IDC_IMG_FILE),FALSE); EnableWindow(GetDlgItem (gui_hwndDlg, IDC_EXE_FILE),FALSE); EnableWindow(GetDlgItem (gui_hwndDlg, IDC_STORE_FILES),FALSE); SetCursor (g_hWaitCursor); if( uploader->download_directory(&TRE_file_list) == true ) { item = ListView_GetItemCount(IMG_list); for( vector<internal_file>::iterator f = TRE_file_list.begin(); f < TRE_file_list.end(); f++ ) { InsertItem(IMG_list, item , LPARAM("%s"),(*f).region_name.c_str()); SetSubItemText (IMG_list, item, 1, "%s", (*f).TRE_map_name.c_str()); SetSubItemText (IMG_list, item, 2, "%s", (*f).file_name.c_str()); SetSubItemText (IMG_list, item, 3, "%s", (*f).get_internal_short_name()); } AutoSizeColumns(IMG_list); show_size(); } SetCursor (g_hArrowCursor); } }
long ListCtrlImproved::AppendRow() { long item; GetItemCount() ? item = GetItemCount() : item = 0; wxListItem info; // Set the item display name info.SetColumn(0); info.SetId(item); if(GetItemCount() % 2 && HasFlag(wxLC_COLOUR_BACKGROUND)) info.SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); item = InsertItem(info); return item; }
void LstOdaSrvDetails::InsertHeader(const wxString &Name, const wxColor *NameColor, const wxColor *NameBGColor) { wxListItem ListItem; ListItem.SetMask(wxLIST_MASK_TEXT); // Name Column ListItem.SetText(Name); ListItem.SetColumn(srvdetails_field_name); ListItem.SetId(InsertItem(GetItemCount(), ListItem.GetText())); ListItem.SetBackgroundColour(*NameBGColor); ListItem.SetTextColour(*NameColor); SetItem(ListItem); }
BOOL CFusionTabControls::CreateTabs() { int tab; for (tab = 0; tab < NumTabs; ++tab) { TC_ITEM item; item.mask = TCIF_TEXT; item.pszText = Tabs[tab].Text; InsertItem (Tabs[tab].WhichTab, &item); } m_CurrentTab = GetCurSel(); return TRUE; }
BOOL CObjectClassStatistics::EnumDataSources (HPROJECT hPr, BOOL, UINT_PTR *pData) { // Namen der Datenquelle besorgen char cbBuffer[_MAX_PATH]; DEX_GetDataSourceShortName(hPr, cbBuffer); // Icon der Datenquelle besorgen DWORD dwBmp = IMG_DATASOURCE; { __Interface<ITRiASConnection> Conn; if (DEX_GetDataSourcePtr(hPr, *Conn.ppv())) { __Interface<ITRiASDatabase> DBase; if (SUCCEEDED(Conn -> get_Database (DBase.ppi()))) { USES_CONVERSION; CComBSTR bstrProgID; // ProgID des TRiAS-DataBase-TargetObjektes if (SUCCEEDED(DBase -> get_Type (&bstrProgID))) { __Interface<ITRiASDataServerRegEntries> Entries(CLSID_TRiASDataServerRegEntries); __Interface<ITRiASDataServerRegEntry> Entry; if (SUCCEEDED(Entries -> FindFromServerProgID (bstrProgID, Entry.ppi()))) Entry -> get_ToolboxBitmap32 ((LONG *)&dwBmp); } } } } // Item in Baum einhängen und mit dummy [+] versehen _ASSERTE(0 <= dwBmp && dwBmp < _countof(g_cbBmps)); HTREEITEM hRoot = *reinterpret_cast<HTREEITEM *>(pData); HTREEITEM hItem = InsertItem(cbBuffer, g_cbBmps[dwBmp], g_cbBmps[dwBmp], hRoot, TVI_LAST); TV_ITEM tvi; tvi.mask = TVIF_HANDLE|TVIF_CHILDREN|TVIF_PARAM; tvi.hItem = hItem; tvi.cChildren = 1; tvi.lParam = reinterpret_cast<LPARAM>(new CDataSourceItemCallback(hPr, hItem)); SetItem(&tvi); return TRUE; }
void CTuotuoTabCtrl::DragItemEnd_Dest() { // 如果是在自己的frame里面拖动,我们不在这个函数里面处理 if (m_bDraggingSource) return; // 这里做个判断,以防止梁志威的快手 if (m_nDragToPos > m_TabItems.size()) m_nDragToPos = m_TabItems.size(); SetScrollDir(0); CTabItem *pItem = m_pDraggingItem; m_pDraggingItem = NULL; InsertItem(m_nDragToPos, pItem); m_nDragToPos = -2; EnsureVisible(pItem); }
void CFriendListCtrl::AddFriend(const CFriend* pFriend) { // ==> Run eMule as NT Service [leuk_he/Stulle] - Stulle if (theApp.IsRunningAsService(SVC_LIST_OPT)) return; // <== Run eMule as NT Service [leuk_he/Stulle] - Stulle //Xman CodeFix if (!theApp.emuledlg->IsRunning()) return; //Xman end int iItem = InsertItem(LVIF_TEXT | LVIF_PARAM, GetItemCount(), pFriend->m_strName, 0, 0, 0, (LPARAM)pFriend); if (iItem >= 0) UpdateFriend(iItem, pFriend); theApp.emuledlg->chatwnd->UpdateFriendlistCount(theApp.friendlist->GetCount()); }
void CQueueListCtrl::AddClient(/*const*/ CUpDownClient* client, bool resetclient) { if (resetclient && client) { client->SetWaitStartTime(); client->SetAskedCount(1); } if (!theApp.emuledlg->IsRunning()) return; if (thePrefs.IsQueueListDisabled()) return; int iItemCount = GetItemCount(); int iItem = InsertItem(LVIF_TEXT|LVIF_PARAM,iItemCount,LPSTR_TEXTCALLBACK,0,0,0,(LPARAM)client); Update(iItem); theApp.emuledlg->transferwnd->UpdateListCount(CTransferWnd::wnd2OnQueue, iItemCount+1); }
void CInstrumentList::InsertInstrument(int Index) { // Inserts an instrument in the list (Index = instrument number) CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc(); if (!pDoc->IsInstrumentUsed(Index)) return; char Name[CInstrument::INST_NAME_MAX]; pDoc->GetInstrumentName(Index, Name); int Type = pDoc->GetInstrumentType(Index); // Name is of type index - name CString Text; Text.Format(_T("%02X - %s"), Index, A2T(Name)); InsertItem(Index, Text, Type - 1); }
void CChuquanData::OnAddNew() { LVITEM listItem; listItem.mask=LVIF_TEXT|LVIF_IMAGE; UpdateData(TRUE); CTaiChuQuanSetDlg AddChuquan; if(AddChuquan.DoModal()==IDOK) { int nTimes=m_ctrlChuQuan.GetItemCount(); float fGive =AddChuquan.m_fGive/10.0f; float fAlloc=AddChuquan.m_fAlloc/10.0f; float fPrice=AddChuquan.m_fPrice; float fDivid=AddChuquan.m_fDivid/10.0f; if( fGive==0&&fAlloc==0&&fPrice==0&&fDivid==0) return; if( !IsAlreadyChuQuan(AddChuquan.m_timet) ) { AfxMessageBox("同一天只能除权一次!",MB_ICONASTERISK); return; } CTime tm(AddChuquan.m_timet); CString str; str=tm.Format("%Y/%m/%d"); POWER Power; Power.nTime=tm.GetTime(); Power.fGive=fGive; Power.fAllocate=fAlloc; Power.fAllocatePrice=fPrice; Power.fDividend=fDivid; Power.nFlags=AddChuquan.m_kind; m_nChuQuanKind[nTimes]=Power.nFlags; InsertItem(nTimes,str,Power); AddChuQuanInfo(m_strStockCode,&Power); } }
void CLATEDView::OnLink(int id, CLCLink *pSrc) { ASSERT(pSrc); switch(id) { case Add_Link: case TraverseLinks: { HTREEITEM hRoot,hSrc; DWORD dwData; CTreeCtrl& rTree = GetTreeCtrl(); hRoot = rTree.GetRootItem(); ASSERT(hRoot); if(!hRoot) { return; } //inserts sourc link dwData = (DWORD) pSrc; hSrc = InsertItem(dwData,true,hRoot); ASSERT(hSrc); pSrc->SetTreeItem(hSrc); if(id == Add_Link && hSrc) { Expand(hSrc); } } break; case Del_Link: { HTREEITEM hItem = pSrc->GetTreeItem(); if(!hItem) { break; } CTreeCtrl& rTree = GetTreeCtrl(); rTree.DeleteItem(hItem); pSrc->SetTreeItem(NULL); } break; default: break; } }
long wxTreeCtrl::InsertItem(long parent, const wxString& label, int image, int selImage, long insertAfter) { wxTreeItem info; info.m_text = label; info.m_mask = wxTREE_MASK_TEXT; if ( image > -1 ) { info.m_mask |= wxTREE_MASK_IMAGE | wxTREE_MASK_SELECTED_IMAGE; info.m_image = image; if ( selImage == -1 ) info.m_selectedImage = image; else info.m_selectedImage = selImage; } return InsertItem(parent, info, insertAfter); }
int CListCtrlEx::AddItem(LPCSTR pszItem, COLORREF clrBg, COLORREF clrText, int iImage, BOOL bAddToBeginning) { int c = bAddToBeginning ? 0 : GetItemCount (); ListEx_ItemInfo info; info.clrBg = clrBg; info.clrText = clrText; if (bAddToBeginning) m_vInfo.insert (m_vInfo.begin (), info); else m_vInfo.push_back (info); c = InsertItem (c, "", iImage); if (*pszItem) SetItemText (c, 0, pszItem); return c; }
void CInspectorTreeCtrl::NewTree(LPCSTR rootxpath) { ASSERT(connection != NULL); DeleteAllItems(); IPropertyTree & pTree = *connection->queryRoot(rootxpath); if(connection->getType() != CT_none) { TV_INSERTSTRUCT is; is.hInsertAfter = TVI_LAST; is.item.mask = TVIF_TEXT | TVIF_PARAM; is.item.pszText = LPSTR_TEXTCALLBACK; is.hParent = TVI_ROOT; is.item.lParam = reinterpret_cast <DWORD> (createTreeListRoot(pTree.queryName(), pTree)); HTREEITEM r = InsertItem(&is); AddLevel(pTree, r); Expand(r, TVE_EXPAND); } }
int CSortListCtrl::AddItemColor(LPCTSTR pszText, COLORREF crText, COLORREF crBak) { //insert item at the last const int iIndex = InsertItem( GetItemCount(), pszText ); ItemData *m_pSortItemData=new ItemData[GetColumns()]; /* m_pSortItemData[0].crText=crText; m_pSortItemData[0].crBak=crBak; */ SetItemData(iIndex,(DWORD) m_pSortItemData); //no sort function return iIndex; }
void CParamsCtrl::Init() { CString s; int i; for (i = 0; i < COLUMNS; i++) { const COL_INFO& ci = m_ColInfo[i]; s.LoadString(ci.Title); InsertColumn(i, s, ci.Align, ci.Width); } for (i = 0; i < NUM_PARMS; i++) { s.LoadString(m_ParmInfo[i].NameID); InsertItem(i, s); } int style = GetExtendedStyle(); SetExtendedStyle(style | LVS_EX_GRIDLINES); m_ImgList.Create(1, ROW_HEIGHT, ILC_COLOR4, 1, 1); SetImageList(&m_ImgList, LVSIL_SMALL); // set row height }
void CInputOutputTabCtrl::InitDialogs() { CRect clientRect; GetClientRect(clientRect); m_lastSizeX = clientRect.Width(); m_lastSizeY = clientRect.Height(); for(int i = 0; i < m_numTabs; i++) { m_wnds[i]->Create(m_wndIds[i], GetParent()); m_wnds[i]->SetParent(this); } for(int i = 0; i < m_numTabs; i++) InsertItem(i, m_wndNames[i].GetBuffer()); ActivateTabDialogs(); }