本文整理汇总了C++中CHeaderCtrl::SetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderCtrl::SetItem方法的具体用法?C++ CHeaderCtrl::SetItem怎么用?C++ CHeaderCtrl::SetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHeaderCtrl
的用法示例。
在下文中一共展示了CHeaderCtrl::SetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnHdnItemclickExternalslist
void CEditPropExternals::OnHdnItemclickExternalslist(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
if (m_nSortedColumn == phdr->iItem)
m_bAscending = !m_bAscending;
else
m_bAscending = TRUE;
m_nSortedColumn = phdr->iItem;
std::sort(m_externals.begin(), m_externals.end(), &CEditPropExternals::SortCompare);
m_ExtList.SetRedraw(FALSE);
m_ExtList.DeleteAllItems();
m_ExtList.SetItemCountEx((int)m_externals.size());
CHeaderCtrl * pHeader = m_ExtList.GetHeaderCtrl();
HDITEM HeaderItem = { 0 };
HeaderItem.mask = HDI_FORMAT;
const int itemCount = pHeader->GetItemCount();
for (int i = 0; i<itemCount; ++i)
{
pHeader->GetItem(i, &HeaderItem);
HeaderItem.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
pHeader->SetItem(i, &HeaderItem);
}
pHeader->GetItem(m_nSortedColumn, &HeaderItem);
HeaderItem.fmt |= (m_bAscending ? HDF_SORTUP : HDF_SORTDOWN);
pHeader->SetItem(m_nSortedColumn, &HeaderItem);
m_ExtList.SetRedraw(TRUE);
*pResult = 0;
}
示例2: Localize
void CQueueListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
if(pHeaderCtrl->GetItemCount() != 0) {
CString strRes;
strRes = GetResString(IDS_QL_USERNAME);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(0, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_FILE);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(1, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_FILEPRIO);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(2, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_QL_RATING);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(3, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_SCORE);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(4, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_ASKED);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(5, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_LASTSEEN);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(6, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_ENTERQUEUE);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(7, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_BANNED);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(8, &hdi);
strRes.ReleaseBuffer();
strRes = GetResString(IDS_UPSTATUS);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(9, &hdi);
strRes.ReleaseBuffer();
}
}
示例3: RestoreHeaderState
void CLeftView::RestoreHeaderState(CString szHeader)
{
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
CHeaderCtrl* pHeaderCtrl = ctlList.GetHeaderCtrl();
HDITEM hdi;
int nNewPos, nPos = 0;
int nCount = pHeaderCtrl->GetItemCount();
for(int i = 0; i < nCount; i++)
{
nNewPos = szHeader.Find(_T(","), nPos);
if( nNewPos != 0)
{
CString szWidth = szHeader.Mid(nPos,nNewPos-nPos);
int nWidth = _ttoi( szWidth );
if( nWidth != 0 )
{
hdi.mask = HDI_WIDTH;
pHeaderCtrl->GetItem(i, &hdi);
hdi.cxy = nWidth;
pHeaderCtrl->SetItem(i, &hdi);
nPos = nNewPos + 1;
}
}
}
}
示例4: Localize
void CKadSearchListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
CString strRes;
for (int icol = 0; icol < pHeaderCtrl->GetItemCount(); icol++)
{
switch (icol)
{
case colNum: strRes = GetResString(IDS_NUMBER); break;
case colKey: strRes = GetResString(IDS_KEY); break;
case colType: strRes = GetResString(IDS_TYPE); break;
case colName: strRes = GetResString(IDS_SW_NAME); break;
case colStop: strRes = GetResString(IDS_STATUS); break;
case colResponses: strRes = GetResString(IDS_RESPONSES); break;
case colLoad: strRes = GetResString(IDS_THELOAD); break;
case colPacketsSent: strRes = GetResString(IDS_PACKSENT); break;
default: strRes.Empty(); break;
}
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
pHeaderCtrl->SetItem(icol, &hdi);
}
int iItems = GetItemCount();
for (int i = 0; i < iItems; i++)
SearchRef((Kademlia::CSearch *)GetItemData(i));
UpdateKadSearchCount();
}
示例5: Localize
void CKadContactListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
CString strRes;
for (int icol=0;icol< pHeaderCtrl->GetItemCount() ;icol++)
{
switch (icol)
{
case colID: strRes = GetResString(IDS_ID); break;
case colType: strRes = GetResString(IDS_TYPE); break;
case colDistance: strRes = GetResString(IDS_KADDISTANCE); break;
}
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(icol, &hdi);
strRes.ReleaseBuffer();
}
int iItems = GetItemCount();
for (int i = 0; i < iItems; i++)
UpdateContact(i, (Kademlia::CContact*)GetItemData(i), true);
}
示例6: SetHeaderControlText
void LListCtrl::SetHeaderControlText( DWORD dwPos, const CUString& strValue )
{
myLockListCtrl.Lock();
if ( m_hWnd )
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
ASSERT( (int)dwPos < pHeaderCtrl->GetItemCount() );
HDITEM hdi;
memset( &hdi, 0, sizeof( HDITEM ) );
// Get header item data
pHeaderCtrl->GetItem( dwPos, &hdi );
// modify item data
CUStringConvert strCnv;
hdi.pszText = strCnv.ToT( strValue );
hdi.mask = HDI_TEXT;
// Set item data
pHeaderCtrl->SetItem( dwPos, &hdi );
}
myLockListCtrl.Unlock();
}
示例7: SetColumnIcons
// CFileOpenDlg::SetColumnIcons
//
// Correctly sets the columns sort icons
//
void CFileOpenDlg::SetColumnIcons()
{
CHeaderCtrl* pHeader = m_listFile.GetHeaderCtrl();
if(pHeader)
{
HDITEM hdi;
int i,
nItems = pHeader->GetItemCount();
for(i = 0; i < nItems; ++i)
{
hdi.mask = HDI_IMAGE | HDI_FORMAT;
pHeader->GetItem(i, &hdi);
if(i+1 == m_nSort)
{
hdi.iImage = 1;
hdi.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT;
}
else if(i+1 == -m_nSort)
{
hdi.iImage = 2;
hdi.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT;
}
else
{
hdi.iImage = 0;
hdi.fmt &= ~(HDF_IMAGE | HDF_BITMAP_ON_RIGHT);
}
pHeader->SetItem(i, &hdi);
}
}
}
示例8: OnLvnColumnclick
void CListCtrlEx::OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
*pResult = 0;
BeginWaitCursor();
SortItems(pNMLV->iSubItem);
CHeaderCtrl* pHdrCtrl = GetHeaderCtrl();
int n = pHdrCtrl->GetItemCount();
HDITEM hdi;
for( int i = 0; i < n; i++ )
{
hdi.mask = HDI_FORMAT; // 读取排序箭头图标状态,必需指定
pHdrCtrl->GetItem(i, &hdi);
//Set sort image to this column
if(i == pNMLV->iSubItem)
{
//Windows xp has a easier way to show the sort order
//in the header: i just have to set a flag and windows
//will do the drawing. No windows xp, no easy way.
hdi.fmt &= ~(HDF_SORTDOWN|HDF_SORTUP);
hdi.fmt |= CompareObject::m_iLastSort[i] ? HDF_SORTUP : HDF_SORTDOWN;
}
//Remove sort image (if exists)
//from other columns.
else
{
hdi.fmt &= ~(HDF_SORTDOWN|HDF_SORTUP);
}
pHdrCtrl->SetItem( i, &hdi );
}
EndWaitCursor();
Invalidate();
}
示例9: TranslateCT
void CCaCertExtPage::TranslateCT()
{
CHeaderCtrl * pHeader = m_CheckList.GetHeaderCtrl();
if (pHeader)
{
CString str = MiniCT_0400;
HDITEM hdi;
hdi.mask = HDI_TEXT;
hdi.pszText = (LPTSTR)((LPCTSTR)str);
pHeader->SetItem(0, &hdi);
str = MiniCT_0401;
hdi.pszText = (LPTSTR)((LPCTSTR)str);
pHeader->SetItem(1, &hdi);
}
}
示例10: OnColumnClick
LRESULT CVGMFileListView::OnColumnClick ( NMHDR* phdr )
{
CWaitCursor w;
int nCol = ((NMLISTVIEW*) phdr)->iSubItem;
// If the user clicked the column that is already sorted, reverse the sort
// direction. Otherwise, go back to ascending order.
if ( nCol == m_nSortedCol )
m_bSortAscending = !m_bSortAscending;
else
m_bSortAscending = true;
if ( g_bXPOrLater )
{
HDITEM hdi = { HDI_FORMAT };
CHeaderCtrl wndHdr = GetHeader();
// Remove the sort arrow indicator from the previously-sorted column.
if ( -1 != m_nSortedCol )
{
wndHdr.GetItem ( m_nSortedCol, &hdi );
hdi.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
wndHdr.SetItem ( m_nSortedCol, &hdi );
}
// Add the sort arrow to the new sorted column.
hdi.mask = HDI_FORMAT;
wndHdr.GetItem ( nCol, &hdi );
hdi.fmt |= m_bSortAscending ? HDF_SORTUP : HDF_SORTDOWN;
wndHdr.SetItem ( nCol, &hdi );
}
// Store the column being sorted, and do the sort
m_nSortedCol = nCol;
SortItems ( SortCallback, (LPARAM)(DWORD_PTR) this );
// Have the list ctrl indicate the sorted column by changing its color.
if ( g_bXPOrLater )
SetSelectedColumn ( nCol );
return true; // retval ignored
}
示例11: Localize
void CIrcChannelListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
CString strRes;
strRes = GetResString(IDS_IRC_NAME);
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
pHeaderCtrl->SetItem(0, &hdi);
strRes = GetResString(IDS_UUSERS);
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
pHeaderCtrl->SetItem(1, &hdi);
strRes = GetResString(IDS_DESCRIPTION);
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
pHeaderCtrl->SetItem(2, &hdi);
}
示例12: Localize
void CSearchParamsWnd::Localize()
{
SetWindowText(GetResString(IDS_SEARCHPARAMS));
GetDlgItem(IDC_MSTATIC3)->SetWindowText(GetResString(IDS_SW_NAME));
GetDlgItem(IDC_MSTATIC7)->SetWindowText(GetResString(IDS_TYPE));
GetDlgItem(IDC_SEARCH_RESET)->SetWindowText(GetResString(IDS_PW_RESET));
GetDlgItem(IDC_METH)->SetWindowText(GetResString(IDS_METHOD));
m_ctlStart.SetWindowText(GetResString(IDS_SW_START));
m_ctlCancel.SetWindowText(GetResString(IDS_CANCEL));
m_ctlMore.SetWindowText(GetResString(IDS_MORE));
SetWindowText(GetResString(IDS_SEARCHPARAMS));
InitMethodsCtrl();
InitFileTypesCtrl();
m_ctlOpts.SetItemText(orMinSize, 0, GetResString(IDS_SEARCHMINSIZE));
m_ctlOpts.SetItemText(orMaxSize, 0, GetResString(IDS_SEARCHMAXSIZE));
m_ctlOpts.SetItemText(orAvailability, 0, GetResString(IDS_SEARCHAVAIL));
m_ctlOpts.SetItemText(orExtension, 0, GetResString(IDS_SEARCHEXTENTION));
m_ctlOpts.SetItemText(orCompleteSources, 0, GetResString(IDS_COMPLSOURCES));
m_ctlOpts.SetItemText(orCodec, 0, GetResString(IDS_CODEC));
m_ctlOpts.SetItemText(orBitrate, 0, GetResString(IDS_MINBITRATE));
m_ctlOpts.SetItemText(orLength, 0, GetResString(IDS_MINLENGTH));
m_ctlOpts.SetItemText(orTitle, 0, GetResString(IDS_TITLE));
m_ctlOpts.SetItemText(orAlbum, 0, GetResString(IDS_ALBUM));
m_ctlOpts.SetItemText(orArtist, 0, GetResString(IDS_ARTIST));
CHeaderCtrl* pHeaderCtrl = m_ctlOpts.GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
CString strRes;
strRes = GetResString(IDS_PARAMETER);
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
pHeaderCtrl->SetItem(0, &hdi);
strRes = GetResString(IDS_VALUE);
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)strRes);
pHeaderCtrl->SetItem(1, &hdi);
}
示例13: SetHeaderParam
// 设置/获取某列Header的参数
void CLogViewDlg::SetHeaderParam(int nIndex, LPARAM lParam)
{
CHeaderCtrl* pHeader = m_LogList.GetHeaderCtrl();
if(pHeader != NULL)
{
HDITEM hdItem = {0};
hdItem.mask = HDI_LPARAM;
hdItem.lParam = lParam;
pHeader->SetItem(nIndex, &hdItem);
}
}
示例14: Localize
void CIrcNickListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
CString sResource;
sResource = GetResString(IDS_STATUS);
HDITEM hdi;
hdi.pszText = const_cast<LPTSTR>((LPCTSTR)sResource);
hdi.mask = HDI_TEXT;
pHeaderCtrl->SetItem(1, &hdi);
UpdateNickCount();
}
示例15: SetSortArrow
void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending)
{
if (control == NULL)
return;
// set the sort arrow
CHeaderCtrl * pHeader = control->GetHeaderCtrl();
HDITEM HeaderItem = {0};
HeaderItem.mask = HDI_FORMAT;
for (int i=0; i<pHeader->GetItemCount(); ++i)
{
pHeader->GetItem(i, &HeaderItem);
HeaderItem.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
pHeader->SetItem(i, &HeaderItem);
}
if (nColumn >= 0)
{
pHeader->GetItem(nColumn, &HeaderItem);
HeaderItem.fmt |= (bAscending ? HDF_SORTUP : HDF_SORTDOWN);
pHeader->SetItem(nColumn, &HeaderItem);
}
}