本文整理汇总了C++中GetListCtrl函数的典型用法代码示例。如果您正苦于以下问题:C++ GetListCtrl函数的具体用法?C++ GetListCtrl怎么用?C++ GetListCtrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetListCtrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetListCtrl
void CSideBar::SetAttributeChecks()
{
MetaGraph *graph = m_treeDoc->m_meta_graph;
if (graph == NULL) {
return;
}
CListCtrl& list = GetListCtrl();
if (graph->viewingProcessed()) {
int displayed_attribute = graph->getDisplayedAttribute();
LVITEM item;
for (int i = 0; i < list.GetItemCount(); i++) {
item.iItem = i;
item.iSubItem = 0;
item.iImage = 0;
item.mask = LVIF_IMAGE;
list.GetItem(&item);
int image = item.iImage;
if ((i-1) == displayed_attribute) {
if (!m_attribute_locked[i]) {
image = 0;
}
else {
image = 2;
}
}
else {
if (!m_attribute_locked[i]) {
image = 1;
}
else {
image = 3;
}
}
if (item.iImage != image) {
item.iImage = image;
list.SetItem(&item);
}
}
}
}
示例2: GetListCtrl
/**
* Called when a stage is moved
* @param pMaterial The material that was deleted.
* @param from The from index
* @param to The to index
*/
void StageView::MV_OnMaterialStageMove(MaterialDoc* pMaterial, int from, int to) {
if(!internalChange) {
from++;
to++;
CListCtrl& list = GetListCtrl();
char szLabel[256];
LV_ITEM lvi;
ZeroMemory(&lvi, sizeof(LV_ITEM));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
lvi.stateMask = LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED;
lvi.pszText = szLabel;
lvi.iItem = from;
lvi.cchTextMax = 255;
list.GetItem(&lvi);
//Delete the original item
list.DeleteItem(from);
//Insert the item
lvi.iItem = to;
list.InsertItem(&lvi);
int type = -1;
int stageType = currentMaterial->GetAttributeInt(to-1, "stagetype");
switch(stageType) {
case MaterialDoc::STAGE_TYPE_NORMAL:
type = MaterialDefManager::MATERIAL_DEF_STAGE;
break;
case MaterialDoc::STAGE_TYPE_SPECIALMAP:
type = MaterialDefManager::MATERIAL_DEF_SPECIAL_STAGE;
break;
}
m_propView->SetPropertyListType(type, to-1);
Invalidate();
}
}
示例3: GetListCtrl
CString CLeftView::GetHeaderState(void)
{
CString szHeader;
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
CHeaderCtrl* pHeaderCtrl = ctlList.GetHeaderCtrl();
HDITEM hdi;
int nCount = pHeaderCtrl->GetItemCount();
for(int i = 0; i < nCount; i++)
{
hdi.mask = HDI_WIDTH;
pHeaderCtrl->GetItem(i, &hdi);
CString szWidth;
szWidth.Format( _T("%d,"), hdi.cxy);
szHeader.Append( szWidth ) ;
}
return szHeader;
}
示例4: GetListCtrl
void CGldEditorView::LoadGlobals(void)
{
CListCtrl &list = GetListCtrl();
int nColumns = list.GetHeaderCtrl()?list.GetHeaderCtrl()->GetItemCount():0;
for (int i=0; i<nColumns; i++)
list.DeleteColumn(0);
CRect wr;
list.GetClientRect(&wr);
int nCol=0;
int nWid=0;
#define W(X) (nWid+=X,X)
int Name = list.InsertColumn(nCol++,"Name",LVCFMT_LEFT,W(150),nCol);
int Module = list.InsertColumn(nCol++,"Module",LVCFMT_LEFT,W(150),nCol);
int Type = list.InsertColumn(nCol++,"Type",LVCFMT_LEFT,W(100),nCol);
int Access = list.InsertColumn(nCol++,"Access",LVCFMT_LEFT,W(150),nCol);
int Data = list.InsertColumn(nCol++,"Data",LVCFMT_LEFT,wr.Width()-nWid,nCol);
#undef W
GLOBALVAR *var = NULL;
while ((var=global_getnext(var))!=NULL)
{
char modname[1024], varname[1024];
int nItem = list.InsertItem(list.GetItemCount(),var->name);
char buffer[1024]="";
if (sscanf(var->name,"%[^:]::%s", modname, varname)==2)
{
list.SetItemText(nItem,Name,varname);
list.SetItemText(nItem,Module,modname);
}
list.SetItemText(nItem,Type,class_get_property_typename(var->prop->ptype));
convert_from_enumeration(buffer,sizeof(buffer),&(var->prop->access),object_access_property());
list.SetItemText(nItem,Access,buffer);
global_getvar(var->name,buffer,sizeof(buffer));
list.SetItemText(nItem,Data,buffer);
}
}
示例5: OnInitialUpdate
void RightListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
const int numofColumn=7;
int i;
CString m_ColumnLabelStr[numofColumn]={"Frequence(lp/mm)","MTF(T)","MTF(S)","LSF(T)","LSF(S)","POS(t)","POS(s)"};
CListCtrl& listctrl=GetListCtrl();
listctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_UNDERLINEHOT);
int ColumnWidth[numofColumn]={140,100,100,100,100,100,100};
for(i=0;i<numofColumn;i++)
{
listctrl.InsertColumn(i,m_ColumnLabelStr[i],LVCFMT_LEFT,ColumnWidth[i]);
}
CBackgroundWnd* FrameWndPoint=(CBackgroundWnd*)(GetParentFrame());
int arraylen=FrameWndPoint->getarraylength();
double* dpfreq=FrameWndPoint->getdFreq();
double* dpmtft=FrameWndPoint->getdMTFt();
double* dpmtfs=FrameWndPoint->getdMTFs();
double* dplsft=FrameWndPoint->getdLSFt();
double* dplsfs=FrameWndPoint->getdLSFs();
double* dppost=FrameWndPoint->getdPOSt();
double* dpposs=FrameWndPoint->getdPOSs();
char insertbuffer[100];
for(i=0;i<arraylen;i++)
{
sprintf(insertbuffer,"%.4lf",dpfreq[i]);
listctrl.InsertItem(i,insertbuffer);
sprintf(insertbuffer,"%.4lf",dpmtft[i]);
listctrl.SetItemText(i,1,insertbuffer);
sprintf(insertbuffer,"%.4lf",dpmtfs[i]);
listctrl.SetItemText(i,2,insertbuffer);
sprintf(insertbuffer,"%.4lf",dplsft[i]);
listctrl.SetItemText(i,3,insertbuffer);
sprintf(insertbuffer,"%.4lf",dplsfs[i]);
listctrl.SetItemText(i,4,insertbuffer);
sprintf(insertbuffer,"%.4lf",dppost[i]);
listctrl.SetItemText(i,5,insertbuffer);
sprintf(insertbuffer,"%.4lf",dpposs[i]);
listctrl.SetItemText(i,6,insertbuffer);
}
}
示例6: GetListCtrl
int CRuleListView::RefreshAdapter(CAdapterInfo *pAdapterInfo)
{
CListCtrl& listView = GetListCtrl();
int nIndex = 0;
CHAR szIndex[10];
RtlZeroMemory(szIndex, sizeof(szIndex));
// VirtualAdapterName
_stprintf(szIndex, _T("%d"), nIndex + 1);
listView.InsertItem(nIndex, szIndex);
listView.SetItemText(nIndex, 1, _T("VirtualAdapterName"));
listView.SetItemText(nIndex, 2, pAdapterInfo->m_strVirtualAdapterName);
// LowerAdapterName
_stprintf(szIndex, _T("%d"), ++nIndex + 1);
listView.InsertItem(nIndex, szIndex);
listView.SetItemText(nIndex, 1, _T("LowerAdapterName"));
listView.SetItemText(nIndex, 2, pAdapterInfo->m_strLowerAdapterName);
// FriendlyAdapterName
_stprintf(szIndex, _T("%d"), ++nIndex + 1);
listView.InsertItem(nIndex, szIndex);
listView.SetItemText(nIndex, 1, _T("FriendlyAdapterName"));
listView.SetItemText(nIndex, 2, pAdapterInfo->m_strFriendlyAdapterName);
// FriendlyAdapterName
_stprintf(szIndex, _T("%d"), ++nIndex + 1);
listView.InsertItem(nIndex, szIndex);
listView.SetItemText(nIndex, 1, _T("PhysicalAddress"));
listView.SetItemText(nIndex, 2, pAdapterInfo->m_strAdapterMacAddress);
return nIndex;
}
示例7: AfxMessageBox
void CTblInfoView::UpdateListInfo(CString strTblName)
{
if (m_Operation != OP_NONE)
{
AfxMessageBox("请先提交操作");
return;
}
//just need to set the header.
static CMainFrame* pMainFrame = reinterpret_cast<CMainFrame*>(AfxGetMainWnd());
static CListCtrl &ctrl = GetListCtrl();
CHeaderCtrl *pHeader = ctrl.GetHeaderCtrl();
CNetWork *pNet = &pMainFrame->m_Nets;
int nCount = pHeader->GetItemCount();
int i;
for (i = 0; i < nCount; i++)
{
//pHeader->DeleteItem(0); bug, should do like this
ctrl.DeleteColumn(0);
}
ctrl.DeleteAllItems();
//m_map_tbl_cols[strTblName];
CString strOri = pNet->GetOriName(strTblName);
CString strCols = pNet->GetColsForTbl(strOri);
CString strSub = _T("");
for (i = 0; ; i++)
{
if (!AfxExtractSubString(strSub, strCols, i, '|')
|| 0 == strSub.GetLength())
{
break;
}
//we use alias
ctrl.InsertColumn(i, pNet->GetAlias(strSub), LVCFMT_LEFT, 70);
}
m_strCurTbl = strOri;
}
示例8: GetListCtrl
// @pymethod <o LV_COLUMN>|PyCListCtrl|GetColumn|Retrieves the details of a column in the control.
PyObject *PyCListCtrl_GetColumn( PyObject *self, PyObject *args )
{
int col;
if (!PyArg_ParseTuple( args, "i:GetColumn",
&col)) // @pyparm int|column||The index of the column whose attributes are to be retrieved.
return NULL;
CListCtrl *pList = GetListCtrl(self);
if (!pList) return NULL;
TCHAR textBuf[256];
LV_COLUMN lvItem;
lvItem.pszText = textBuf;
lvItem.cchTextMax = sizeof(textBuf)/sizeof(TCHAR);
lvItem.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
GUI_BGN_SAVE;
BOOL ok = pList->GetColumn( col, &lvItem);
GUI_END_SAVE;
if (!ok)
RETURN_ERR("GetColumn failed");
return PyWinObject_FromLV_COLUMN(&lvItem);
}
示例9: make
// @pymethod int|PyCListCtrl|SetImageList|Assigns an image list to a list view control.
PyObject *PyCListCtrl_SetImageList( PyObject *self, PyObject *args )
{
CListCtrl *pList;
PyObject *obList;
int imageType;
if (!(pList=GetListCtrl(self)))
return NULL;
if (!PyArg_ParseTuple(args, "Oi:SetImageList",
&obList, // @pyparm <o PyCImageList>|imageList||The Image List to use.
&imageType )) // @pyparm int|imageType||Type of image list. It can be one of (COMMCTRL.) LVSIL_NORMAL, LVSIL_SMALL or LVSIL_STATE
return NULL;
CImageList *pImageList = PyCImageList::GetImageList(obList);
if (pImageList==NULL) return NULL;
GUI_BGN_SAVE;
CImageList *pOldList = pList->SetImageList( pImageList, imageType );
GUI_END_SAVE;
if (pOldList==NULL)
RETURN_NONE;
return ui_assoc_object::make( PyCImageList::type, pOldList )->GetGoodRet();
}
示例10: GetDocument
void CLeftView::UpdateIcon()
{
int i=0, iCount=0, iGap = 0;
double dDeviation = 0;
CFoulerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if( pDoc->m_sprt.GetReady() == FALSE ) return;
dDeviation = pDoc->m_sprt.GetDeviation();
if( dDeviation <= 0 ) return;
CListCtrl& refCtrl = GetListCtrl();
iCount = refCtrl.GetItemCount();
for( i = 0 ; i < iCount ; i++ )
{
iGap = (int)( (pDoc->m_pData[i]->GetItem()-pDoc->m_sprt.GetTheta0())/dDeviation );
iGap = abs(iGap);
if( iGap > 3 ) iGap = 3;
refCtrl.SetItem( i, 0, LVIF_IMAGE, NULL, iGap, 0, 0, 0 );
}
//refCtrl.Scroll( CSize(100, pDoc->m_iNo*20) );
}
示例11: GetListCtrl
bool CGumpListView::SaveGumpDesc(LPCTSTR szDescFile)
{
CListCtrl& ctrl = GetListCtrl();
CStdioFile file;
if (!file.Open(szDescFile, CFile::modeCreate | CFile::modeWrite)) return false;
int id = 0;
LPCTSTR desc;
for (int i = 0; i < ctrl.GetItemCount(); i++)
{
id = ctrl.GetItemData(i);
desc = GetGumpDesc(id);
file.WriteString(GfxSprintf("0x%04X=%s\n",id, desc ? desc : ""));
}
file.Close();
return true;
}
示例12:
// @pymethod int|PyCListCtrl|SetItem|Sets some of all of an items attributes.
PyObject *PyCListCtrl_SetItem( PyObject *self, PyObject *args )
{
CListCtrl *pList;
PyObject *obLVItem;
if (!(pList=GetListCtrl(self)))
return NULL;
if (!PyArg_ParseTuple(args, "O:SetItem",
&obLVItem)) // @pyparm <o LV_ITEM>|item||A tuple describing the new item.
return NULL;
LV_ITEM lvItem;
if (!PyWinObject_AsLV_ITEM(obLVItem, &lvItem))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pList->SetItem(&lvItem);
GUI_END_SAVE;
PyWinObject_FreeLV_ITEM(&lvItem);
if (!ok)
RETURN_ERR("SetItem failed");
RETURN_NONE;
}
示例13: OnColumnClick
/*
OnColumnClick()
*/
void CWallBrowserFileView::OnColumnClick(NMHDR* pnmh,LRESULT* /*pResult*/)
{
NM_LISTVIEW* pnmlv = (NM_LISTVIEW*)pnmh;
switch(pnmlv->iSubItem)
{
case 0:
g_bFileNameAscending = !g_bFileNameAscending;
break;
case 1:
g_bSizeAscending = !g_bSizeAscending;
break;
case 2:
g_bModifiedAscending = !g_bModifiedAscending;
break;
}
g_nSortOrder = pnmlv->iSubItem;
GetListCtrl().SortItems(CompareFunc,pnmlv->iSubItem);
}
示例14: ZeroMemory
void CLeftView::OnContextMenu(CWnd* pWnd, CPoint point)
{
char cStr[64];
ZeroMemory( cStr, sizeof(cStr) );
CMenu menu;
CFoulerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
menu.CreatePopupMenu();
CListCtrl& refCtrl = GetListCtrl();
int iCount = refCtrl.GetSelectedCount();
if( iCount > 0 )
{
wsprintf( cStr, "%d items have been selected", iCount );
menu.AppendMenu( MF_STRING, NULL, cStr );
menu.AppendMenu( MF_STRING, ID_EDIT_COPY, "Copy" );
}
if( CanPaste() ) menu.AppendMenu( MF_STRING, ID_EDIT_PASTE, "Paste" );
SetForegroundWindow();
menu.TrackPopupMenu( TPM_LEFTALIGN, point.x, point.y, this, NULL );
}
示例15: GetListCtrl
/**
* Dispalys the popup menu with the appropriate menu items enabled.
*/
void StageView::PopupMenu( CPoint *pt ) {
//Determine the type of object clicked on
CListCtrl &list = GetListCtrl();
ClientToScreen( pt );
CMenu FloatingMenu;
VERIFY( FloatingMenu.LoadMenu( IDR_ME_STAGELIST_POPUP ) );
CMenu *pPopupMenu = FloatingMenu.GetSubMenu( 0 );
ASSERT( pPopupMenu != NULL );
POSITION pos = list.GetFirstSelectedItemPosition();
int nItem = -1;
if( pos ) {
nItem = list.GetNextSelectedItem( pos );
}
if( nItem <= 0 ) {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_RENAMESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_DELETESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
} else {
MaterialDoc *material = materialDocManager->GetCurrentMaterialDoc();
if( material->GetAttributeInt( nItem - 1, "stagetype" ) != MaterialDoc::STAGE_TYPE_NORMAL ) {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_RENAMESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
}
}
MaterialDoc *material = materialDocManager->GetCurrentMaterialDoc();
if( material->FindStage( MaterialDoc::STAGE_TYPE_SPECIALMAP, "bumpmap" ) >= 0 ) {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_ADDBUMPMAP, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
}
if( material->FindStage( MaterialDoc::STAGE_TYPE_SPECIALMAP, "diffusemap" ) >= 0 ) {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_ADDDIFFUSEMAP, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
}
if( material->FindStage( MaterialDoc::STAGE_TYPE_SPECIALMAP, "specularmap" ) >= 0 ) {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_ADDSPECULAR, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
}
if( materialDocManager->IsCopyStage() ) {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_PASTE, MF_BYCOMMAND | MF_ENABLED );
} else {
pPopupMenu->EnableMenuItem( ID_STAGEPOPUP_PASTE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
}
pPopupMenu->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt->x, pt->y, &list );
}