本文整理汇总了C++中CHeaderCtrl::GetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderCtrl::GetItem方法的具体用法?C++ CHeaderCtrl::GetItem怎么用?C++ CHeaderCtrl::GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHeaderCtrl
的用法示例。
在下文中一共展示了CHeaderCtrl::GetItem方法的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: OnDestroy
void CSiriusView::OnDestroy()
{
HDITEM hdi;
// store columns width
CHeaderCtrl *pHdr = GetListCtrl().GetHeaderCtrl();
hdi.mask = HDI_WIDTH;
pHdr->GetItem(0, &hdi);
g_Settings.m_iListSrcAddr = hdi.cxy;
pHdr->GetItem(2, &hdi);
g_Settings.m_iListDestAddr = hdi.cxy;
pHdr->GetItem(1, &hdi);
g_Settings.m_iListSrcPort = hdi.cxy;
pHdr->GetItem(3, &hdi);
g_Settings.m_iListDestPort = hdi.cxy;
pHdr->GetItem(4, &hdi);
g_Settings.m_iListProto = hdi.cxy;
pHdr->GetItem(5, &hdi);
g_Settings.m_iListTraffic = hdi.cxy;
pHdr->GetItem(6, &hdi);
g_Settings.m_iListBS = hdi.cxy;
pHdr->GetItem(7, &hdi);
g_Settings.m_iListABS = hdi.cxy;
if (g_bStarted) {
OnCommandStop();
g_bStarted = FALSE;
}
CListView::OnDestroy();
}
示例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: 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();
}
示例5: 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();
}
示例6: 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);
}
}
}
示例7: 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
}
示例8: GetHeaderParam
LPARAM CLogViewDlg::GetHeaderParam(int nIndex)
{
CHeaderCtrl* pHeader = m_LogList.GetHeaderCtrl();
if(pHeader != NULL)
{
HDITEM hdItem = {0};
hdItem.mask = HDI_LPARAM;
pHeader->GetItem(nIndex, &hdItem);
return hdItem.lParam;
}
return 0;
}
示例9: 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);
}
}
示例10: InsertMenu
void InsertMenu(CListCtrl& list,
CMenu* pMenu,
UINT nIndex, // Menu id to remplace
CImageList* pImageList)
{
CHeaderCtrl *pHeader = list.GetHeaderCtrl();
int nbCol = pHeader->GetItemCount();
int nAfter = -1, id;
char buffer[maxTitleLength];
HDITEM hi;
if (pImageList == NULL) pImageList = pHeader->GetImageList();
hi.mask = HDI_FORMAT|HDI_IMAGE|HDI_LPARAM|HDI_TEXT;
hi.pszText = buffer;
hi.cchTextMax = maxTitleLength;
while (--nbCol >= 0) {
pHeader->GetItem(nbCol, &hi);
if (hi.lParam == 0) continue;
// there is a sort possible column
id = nIndex + nbCol;
if (nAfter < 0) {
if (!pMenu->ModifyMenu(nIndex, MF_BYCOMMAND|MF_STRING, id, buffer))
return;
} else {
pMenu->InsertMenu(nAfter, MF_BYCOMMAND|MF_STRING, id, buffer);
}
if (hi.iImage && pImageList) {
static CBitmap bm, *pOldBm;
IMAGEINFO ii;
CDC dcMem;
// fill a bitmap with the sort image
pImageList->GetImageInfo(hi.iImage, &ii);
int w = ii.rcImage.right - ii.rcImage.left;
int h = ii.rcImage.bottom - ii.rcImage.top;
dcMem.CreateCompatibleDC(NULL);
if (bm.m_hObject) bm.DeleteObject();
bm.CreateCompatibleBitmap(&dcMem, w, h);
pOldBm = dcMem.SelectObject(&bm);
dcMem.FillSolidRect(0, 0, w, h, 0xFFFFFF);
pImageList->Draw(&dcMem, hi.iImage, CPoint(0,0), ILD_NORMAL);
dcMem.SelectObject(pOldBm);
// display the sort icon
pMenu->SetMenuItemBitmaps(id, MF_BYCOMMAND, &bm, &bm);
}
nAfter = id;
}
}
示例11: OnColumnEntryClick
void CManagePSWDPols::OnColumnEntryClick(NMHDR *pNotifyStruct, LRESULT *pLResult)
{
*pLResult = 1L;
NMHEADER *pNMHeader = (NMHEADER *)pNotifyStruct;
int iIndex = pNMHeader->iItem;
HDITEM hdi;
hdi.mask = HDI_FORMAT;
CHeaderCtrl *pHdrCtrl = m_PolicyEntries.GetHeaderCtrl();
if (iIndex == m_iSortEntriesIndex) {
m_bSortEntriesAscending = !m_bSortEntriesAscending;
} else {
// Turn off all previous sort arrows
for (int i = 0; i < pHdrCtrl->GetItemCount(); i++) {
pHdrCtrl->GetItem(i, &hdi);
if ((hdi.fmt & (HDF_SORTUP | HDF_SORTDOWN)) != 0) {
hdi.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
pHdrCtrl->SetItem(i, &hdi);
}
}
m_iSortEntriesIndex = iIndex;
m_bSortEntriesAscending = true;
}
pHdrCtrl->GetItem(iIndex, &hdi);
// Turn off all arrows
hdi.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
// Turn on the correct arrow
hdi.fmt |= (m_bSortEntriesAscending ? HDF_SORTUP : HDF_SORTDOWN);
pHdrCtrl->SetItem(iIndex, &hdi);
m_PolicyEntries.SortItems(&CManagePSWDPols::SortEntries, (DWORD_PTR)this);
}
示例12: OnHdnItemclickFilelist
void CFileDiffDlg::OnHdnItemclickFilelist(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
if (m_bThreadRunning)
return;
if (m_nSortedColumn == phdr->iItem)
m_bAscending = !m_bAscending;
else
m_bAscending = TRUE;
m_nSortedColumn = phdr->iItem;
m_arSelectedFileList.RemoveAll();
Sort();
CString temp;
m_cFileList.SetRedraw(FALSE);
m_cFileList.DeleteAllItems();
m_cFilter.GetWindowText(temp);
Filter(temp);
CHeaderCtrl * pHeader = m_cFileList.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);
}
pHeader->GetItem(m_nSortedColumn, &HeaderItem);
HeaderItem.fmt |= (m_bAscending ? HDF_SORTUP : HDF_SORTDOWN);
pHeader->SetItem(m_nSortedColumn, &HeaderItem);
m_cFileList.SetRedraw(TRUE);
*pResult = 0;
}
示例13: OnColumnclickLstcMsgDetails
void CTxMsgListView::OnColumnclickLstcMsgDetails(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// If it is first column
if( pNMListView->iSubItem == 0 )
{
// Get the status from Image Index
BOOL bToBeChecked = FALSE;
// Change header Control Image Index
CHeaderCtrl* pHeader = m_omLctrMsgList.GetHeaderCtrl();
if( pHeader != nullptr )
{
// Get Current Image Index
HDITEM hditem;
hditem.mask = HDI_IMAGE | HDI_FORMAT;
if( pHeader->GetItem(0, &hditem ) == TRUE )
{
// Image Index To be Set
int nNewImageIndex = 0;
// Toggle Image Index
if( hditem.iImage == 0 )
{
bToBeChecked = TRUE;
nNewImageIndex = 1;
}
// Update Image Index
hditem.fmt |= HDF_IMAGE;
hditem.iImage = nNewImageIndex;
pHeader->SetItem(0, &hditem );
// Update Message Check Value
vSetMessageCheckValue( bToBeChecked );
CTxFunctionsView* pView = (CTxFunctionsView*)
pomGetFunctionsViewPointer();
if( pView != nullptr )
{
if(pView->m_CheckBoxAutoUpdate.GetCheck() == BST_CHECKED)
{
pView->vAccessButtonApply();
this->SetFocus();
}
}
}
}
}
*pResult = 0;
}
示例14: SortStatus
int SortStatus(CListCtrl &list,
int status) // 0..(n-1)*2 => select column code
// -1 => clear the sorted column
{ // -2 => return only the sorted column code
CHeaderCtrl *pHeader = list.GetHeaderCtrl();
int ix = pHeader->GetItemCount(), rq = (status + 2) / 2 - 1;
HDITEM hi;
if (rq >= ix) status = -1;
// search the old sorted column
hi.mask = HDI_IMAGE|HDI_LPARAM;
while (--ix >= 0) {
pHeader->GetItem(ix, &hi);
if (hi.iImage == 0) continue;
// the old sorted column is found
if (status == -2) {
// Req = -2 : put the status (state and sorted column)
return ix * 2 + (hi.iImage & 1);
} else if (rq != ix) {
// delete old display icon
hi.iImage = 0;
// hi.lParam |= STI_REVERSE; //************************
pHeader->SetItem(ix, &hi);
}
break;
}
if (status < 0) return -1; // there is not sorted column !
if (rq != ix) pHeader->GetItem(rq, &hi);
hi.lParam = (hi.lParam & ~1) | (status & 1);
hi.iImage = hi.lParam;
pHeader->SetItem(rq, &hi);
return status;
}
示例15: GetColumnTitle
CString GetColumnTitle(CListCtrl &list, int iSubItem, LPCTSTR pszTitle)
{
CHeaderCtrl *pHeader = list.GetHeaderCtrl();
char buffer[maxTitleLength] = {0, };
HDITEM hi;
hi.mask = HDI_FORMAT|HDI_TEXT;
hi.pszText = buffer;
hi.cchTextMax = maxTitleLength;
if (pHeader->GetItem(iSubItem, &hi) && pszTitle) {
hi.pszText = LPTSTR(pszTitle);
pHeader->SetItem(iSubItem, &hi);
}
return CString(buffer);
}