Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
3.7 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1996 - 1999
  3. //
  4. // File: lcx.h
  5. //
  6. // History:
  7. // 07/13/96 Abolade Gbadegesin Created, based on C code by Steve Cobb
  8. //
  9. // Contains declarations for an enhanced list-control.
  10. //============================================================================
  11. #ifndef _LISTCTRL_H_
  12. #define _LISTCTRL_H_
  13. #ifndef _COMMON_UTIL_H_
  14. #include "util.h"
  15. #endif
  16. //
  17. // Notification sent by CListCtrlEx when an item's checked state changes.
  18. //
  19. #define LVXN_SETCHECK (LVN_LAST + 1)
  20. //----------------------------------------------------------------------------
  21. // Structs: SLcxRow
  22. // SLcxColumn
  23. //
  24. // Describes rows and columns in customizable list-controls.
  25. //----------------------------------------------------------------------------
  26. struct SLcxRow {
  27. UINT uiRowId;
  28. UINT idsTitle;
  29. BOOL bEnabled;
  30. };
  31. struct SLcxColumn {
  32. INT iSubItem;
  33. UINT idsTitle;
  34. INT cx;
  35. BOOL bEnabled;
  36. INT iIndex;
  37. };
  38. //----------------------------------------------------------------------------
  39. // Class: CListCtrlEx
  40. //
  41. // Controls a list-control which has extended capabilities,
  42. // including the ability to show checkboxes next to its items,
  43. // and the ability to maintain row-information in the registry.
  44. //----------------------------------------------------------------------------
  45. class CListCtrlEx : public CListCtrl
  46. {
  47. DECLARE_DYNAMIC(CListCtrlEx)
  48. public:
  49. CListCtrlEx()
  50. : m_pimlChecks(NULL), m_pimlOldState(NULL)
  51. { }
  52. virtual ~CListCtrlEx( );
  53. enum {
  54. LCXI_UNCHECKED = 1,
  55. LCXI_CHECKED = 2
  56. };
  57. INT GetColumnCount( );
  58. BOOL SetColumnText(INT iCol, LPCTSTR pszText, INT fmt = LVCFMT_LEFT );
  59. BOOL SetColumnText(INT iCol, UINT nID, INT fmt = LVCFMT_LEFT)
  60. {
  61. // Needed for Loadstring
  62. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  63. CString sCol;
  64. sCol.LoadString(nID);
  65. return SetColumnText(iCol, sCol, fmt);
  66. }
  67. //--------------------------------------------------------------------
  68. // Functions: InstallChecks
  69. // UninstallChecks
  70. // GetCheck
  71. // SetCheck
  72. //
  73. // Checkbox-handling functions.
  74. //--------------------------------------------------------------------
  75. BOOL InstallChecks( );
  76. VOID UninstallChecks( );
  77. BOOL GetCheck(INT iItem );
  78. VOID SetCheck( INT iItem, BOOL fCheck );
  79. protected:
  80. CImageList* m_pimlChecks;
  81. CImageList* m_pimlOldState;
  82. //{{AFX_MSG(CListCtrlEx)
  83. afx_msg VOID OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  84. afx_msg VOID OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  85. afx_msg VOID OnLButtonDown(UINT nFlags, CPoint pt);
  86. //}}AFX_MSG
  87. DECLARE_MESSAGE_MAP()
  88. };
  89. //----------------------------------------------------------------------------
  90. // Function: AdjustColumnWidth
  91. //
  92. // Called to adjust the width of column 'iCol' so that the string 'pszContent'
  93. // can be displayed in the column without truncation.
  94. //
  95. // If 'NULL' is specified for 'pszContent', the function adjusts the column
  96. // so that the first string in the column is displayed without truncation.
  97. //
  98. // Returns the new width of the column.
  99. //----------------------------------------------------------------------------
  100. INT
  101. AdjustColumnWidth(
  102. IN CListCtrl& listCtrl,
  103. IN INT iCol,
  104. IN LPCTSTR pszContent
  105. );
  106. INT
  107. AdjustColumnWidth(
  108. IN CListCtrl& listCtrl,
  109. IN INT iCol,
  110. IN UINT idsContent
  111. );
  112. #endif // _LISTCTRL_H_