www.pudn.com > HReportTest.rar > HFlatHeaderCtrl.h
#if !defined(AFX_HFLATHEADERCTRL_H__4CA3679B_DF26_413A_A61C_E357E052B3D9__INCLUDED_) #define AFX_HFLATHEADERCTRL_H__4CA3679B_DF26_413A_A61C_E357E052B3D9__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif #include#include "HMemDC.h" ///////////////////////////////////////////////////////////////////////////// class CHFlatHeaderCtrl : public CHeaderCtrl { DECLARE_DYNAMIC(CHFlatHeaderCtrl) public: CHFlatHeaderCtrl(); virtual ~CHFlatHeaderCtrl(); protected: int m_nOffset; // Amount to offset the sort arrow. int m_nSortedCol; // last column pressed during sort. BOOL m_bLBtnDown; // TRUE if left mouse button is pressed BOOL m_bAscending; // used when column is pressed to draw sort arrow. BOOL m_bSortArrow; // TRUE to draw a sort arrow. BOOL m_bInitControl; // true for initialization. public: virtual void ShowSortArrow(BOOL bSortArrow = TRUE) { ASSERT(::IsWindow(m_hWnd)); m_bSortArrow = bSortArrow; Invalidate(); } virtual int HitTest(CPoint pt ) const; int GetSortedCol() const { ASSERT(::IsWindow(m_hWnd)); return m_nSortedCol; } BOOL GetAscending() const { ASSERT(::IsWindow(m_hWnd)); return m_bAscending; } virtual int SetSortImage(int nCol, BOOL bAsc); void InitializeHeader(CFont* pFont) { SetFont(pFont); Invalidate(); } protected: virtual void DrawBorders(CDC* pDC, CRect& rect); void SendNotify(int iIndex); //{{AFX_VIRTUAL(CXTFlatHeaderCtrl) public: virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); protected: virtual void PreSubclassWindow(); //}}AFX_VIRTUAL //{{AFX_MSG(CXTFlatHeaderCtrl) afx_msg void OnPaint(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos); //}}AFX_MSG afx_msg LRESULT OnInitControl(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// #endif // !defined(AFX_HFLATHEADERCTRL_H__4CA3679B_DF26_413A_A61C_E357E052B3D9__INCLUDED_)