예제 #1
0
BOOL CReportCtrl::SetHeaderText(int nColumn, LPCTSTR lpText)
{
	if(!HasColumnHeader())
	{
		return(FALSE);
	}

	LPTSTR	psz = NULL;
	if(lpText == NULL)
	{
		psz = new TCHAR[1];
		*psz = _T('\0');
	}
	else
	{
		psz = _tcsdup(lpText);
	}

	HDITEM	hd;
	hd.mask = HDI_TEXT;
	hd.pszText = psz;
	hd.cchTextMax = _tcslen(psz);

	const BOOL	RES = CListCtrl :: GetHeaderCtrl()->SetItem(nColumn, &hd);
	delete[] psz;
	return(RES);
}
예제 #2
0
DWORD CReportCtrl::_GetHeaderTextFormat(int nColumn) const
{
	if(!HasColumnHeader())
	{
		return(ES_LEFT);
	}

	HDITEM	hd;
	hd.mask = HDI_FORMAT;
	if(!GetHeaderCtrl()->GetItem(nColumn, &hd))
	{
		return(ES_LEFT);
	}

	if(hd.fmt & HDF_CENTER)
	{
		return(ES_CENTER);
	}
	else if(hd.fmt & HDF_RIGHT)
	{
		return(ES_RIGHT);
	}
	else
	{
		return(ES_LEFT);
	}
}
예제 #3
0
BOOL CReportCtrl::IsSortable() const
{
	if (!HasColumnHeader())
		return FALSE;

	LONG lStyle = ::GetWindowLong(GetHeaderCtrl()->GetSafeHwnd(), GWL_STYLE);
	return (lStyle & HDS_BUTTONS) != 0;
}
예제 #4
0
CString CReportCtrl::GetHeaderText(int nColumn) const
{
	if (!HasColumnHeader())
		return _T("");

	HDITEM hd;
	TCHAR  szBuffer[256] = _T("");
	hd.mask = HDI_TEXT;
	hd.pszText = szBuffer;
	hd.cchTextMax = 255;
	return GetHeaderCtrl()->GetItem(nColumn, &hd) ? hd.pszText : _T("");
}
예제 #5
0
BOOL CReportCtrl::SetSortable(BOOL bSet)
{
	if (!HasColumnHeader())
		return FALSE;

	LONG lStyle = ::GetWindowLong(GetHeaderCtrl()->GetSafeHwnd(), GWL_STYLE);
	if (bSet)
	{
		lStyle |= HDS_BUTTONS;
	}
	else
	{
		lStyle &= ~HDS_BUTTONS;
		_UnsetSortedColumn();
	}
	::SetWindowLong(GetHeaderCtrl()->GetSafeHwnd(), GWL_STYLE, lStyle);
	CListCtrl::GetHeaderCtrl()->RedrawWindow();
	return TRUE;
}