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


C++ InsertItem函数代码示例

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


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

示例1: ASSERT

//-------------------------------------------------------------------//
// 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 );
}
开发者ID:moodboom,项目名称:Reusable,代码行数:23,代码来源:ChildDlgTabCtrl.cpp

示例2: InsertItem

//向列表框中添加行
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);
}
开发者ID:uesoft,项目名称:AutoPHS,代码行数:17,代码来源:mylistctrl.cpp

示例3: ZeroMemory

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);
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:16,代码来源:MDIChildTreeView.cpp

示例4: 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:TcT2k,项目名称:wxFormBuilder,代码行数:16,代码来源:menueditor.cpp

示例5: GetItemCount

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();
	}
}
开发者ID:Artoria2e5,项目名称:amule-dlp,代码行数:16,代码来源:SharedFilesCtrl.cpp

示例6: GetItemCount

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;
}
开发者ID:noindom99,项目名称:repositorium,代码行数:16,代码来源:TDLFindResultsListCtrl.cpp

示例7: SelectItem

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();
	}
}
开发者ID:Sappharad,项目名称:modizer,代码行数:16,代码来源:MIDIMappingDialog.cpp

示例8: insertMax

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
开发者ID:kimcoop,项目名称:1550-project1,代码行数:16,代码来源:myrecs.c

示例9: ProcessConnOp

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;
			}
		}
	}
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:47,代码来源:UsersListCtrl.cpp

示例10: sprintf

/**
 *
 * \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;
}
开发者ID:lonyzone,项目名称:oathx-ogrex-editor,代码行数:53,代码来源:ImageListBox.cpp

示例11: GetHeaderCtrl

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;
}
开发者ID:viticm,项目名称:pap2,代码行数:46,代码来源:KGListCtrl.cpp

示例12: DeleteAllItems

// 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]);
        }
    }
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:18,代码来源:lst_custom.cpp

示例13: ListView_GetItemCount

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();
	
}
开发者ID:casaretto,项目名称:cgpsmapper,代码行数:46,代码来源:gui_sendmap.cpp

示例14: GetItemCount

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;
}
开发者ID:292388900,项目名称:codelite,代码行数:17,代码来源:listctrl_improved.cpp

示例15: InsertHeader

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);
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:17,代码来源:lst_srvdetails.cpp


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