XHeaderCtrl.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // XHeaderCtrl.h Version 1.4
  2. //
  3. // Author: Hans Dietrich
  4. // hdietrich@gmail.com
  5. //
  6. // License:
  7. // This software is released into the public domain. You are free to use
  8. // it in any way you like, except that you may not sell this source code.
  9. //
  10. // This software is provided "as is" with no expressed or implied warranty.
  11. // I accept no liability for any damage or loss of business that this
  12. // software may cause.
  13. //
  14. ///////////////////////////////////////////////////////////////////////////////
  15. #ifndef XHEADERCTRL_H
  16. #define XHEADERCTRL_H
  17. #define DT_DEFAULT ((UINT)-1) //+++
  18. #define FLATHEADER_TEXT_MAX 80
  19. #define XHEADERCTRL_NO_IMAGE 0
  20. #define XHEADERCTRL_UNCHECKED_IMAGE 1
  21. #define XHEADERCTRL_CHECKED_IMAGE 2
  22. ///////////////////////////////////////////////////////////////////////////////
  23. // CXHeaderCtrl window
  24. #define FH_PROPERTY_SPACING 1
  25. #define FH_PROPERTY_ARROW 2
  26. #define FH_PROPERTY_STATICBORDER 3
  27. #define FH_PROPERTY_DONTDROPCURSOR 4
  28. #define FH_PROPERTY_DROPTARGET 5
  29. class CXHeaderCtrl : public CHeaderCtrl
  30. {
  31. DECLARE_DYNCREATE(CXHeaderCtrl)
  32. // Construction
  33. public:
  34. CXHeaderCtrl();
  35. virtual ~CXHeaderCtrl();
  36. // Attributes
  37. public:
  38. void SetListCtrl(CListCtrl *pListCtrl) { m_pListCtrl = pListCtrl; }
  39. BOOL ModifyProperty(WPARAM wParam, LPARAM lParam);
  40. int GetSpacing() { return m_iSpacing; }
  41. void SetSpacing(int nSpacing) { m_iSpacing = nSpacing; }
  42. UINT GetAlignment() { return m_nFormat; } //+++
  43. void SetAlignment(UINT nFormat) { m_nFormat = nFormat; } //+++
  44. COLORREF GetTextColor() { return m_rgbText; } //+++
  45. void SetTextColor(COLORREF rgbText) { m_rgbText = rgbText; } //+++
  46. BOOL GetDividerLines() { return m_bDividerLines; } //+++
  47. void EnableDividerLines(BOOL bEnable) { m_bDividerLines = bEnable; } //+++
  48. // Overrides
  49. public:
  50. virtual void DrawItem(LPDRAWITEMSTRUCT);
  51. virtual void DrawItem(CDC* pDC, CRect rect, LPHDITEM lphdi);
  52. // ClassWizard generated virtual function overrides
  53. //{{AFX_VIRTUAL(CXHeaderCtrl)
  54. //}}AFX_VIRTUAL
  55. // Implementation
  56. protected:
  57. CListCtrl * m_pListCtrl; //+++
  58. UINT m_nFormat; //+++
  59. COLORREF m_rgbText; //+++
  60. BOOL m_bDividerLines; //+++
  61. BOOL m_bDoubleBuffer;
  62. BOOL m_bStaticBorder;
  63. BOOL m_bResizing;
  64. int m_iSpacing;
  65. SIZE m_sizeImage;
  66. SIZE m_sizeArrow;
  67. UINT m_nDontDropCursor;
  68. UINT m_nClickFlags;
  69. CPoint m_ptClickPoint;
  70. COLORREF m_cr3DHighLight;
  71. COLORREF m_cr3DShadow;
  72. COLORREF m_cr3DFace;
  73. COLORREF m_crBtnText;
  74. void DrawCtrl(CDC* pDC);
  75. int DrawImage(CDC* pDC, CRect rect, LPHDITEM hdi, BOOL bRight);
  76. int DrawBitmap(CDC* pDC, CRect rect, LPHDITEM hdi, CBitmap* pBitmap,
  77. BITMAP* pBitmapInfo, BOOL bRight);
  78. int DrawText (CDC* pDC, CRect rect, LPHDITEM lphdi);
  79. // Generated message map functions
  80. protected:
  81. //{{AFX_MSG(CXHeaderCtrl)
  82. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  83. afx_msg void OnPaint();
  84. afx_msg void OnSysColorChange();
  85. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  86. //}}AFX_MSG
  87. afx_msg LRESULT OnDeleteItem(WPARAM wparam, LPARAM lparam);
  88. afx_msg LRESULT OnInsertItem(WPARAM wparam, LPARAM lparam);
  89. afx_msg LRESULT OnLayout(WPARAM wparam, LPARAM lparam);
  90. afx_msg LRESULT OnSetImageList(WPARAM wparam, LPARAM lparam);
  91. DECLARE_MESSAGE_MAP()
  92. };
  93. ///////////////////////////////////////////////////////////////////////////////
  94. //{{AFX_INSERT_LOCATION}}
  95. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  96. #endif //XHEADERCTRL_H