PropertyList.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef CPROPERTYLIST_H
  14. #define CPROPERTYLIST_H
  15. #include "../cmStandardIncludes.h"
  16. class CMakeSetupDialog;
  17. /////////////////////////////////////////////////////////////////////////////
  18. //CPropertyList Items
  19. class CPropertyItem
  20. {
  21. // Attributes
  22. public:
  23. CString m_HelpString;
  24. CString m_propName;
  25. CString m_curValue;
  26. int m_nItemType;
  27. CString m_cmbItems;
  28. bool m_NewValue;
  29. bool m_Removed;
  30. bool m_Advanced;
  31. public:
  32. CPropertyItem(CString propName, CString curValue,
  33. CString helpString,
  34. int nItemType, CString cmbItems)
  35. {
  36. m_NewValue = true;
  37. m_HelpString = helpString;
  38. m_Removed = false;
  39. m_propName = propName;
  40. m_curValue = curValue;
  41. m_nItemType = nItemType;
  42. m_cmbItems = cmbItems;
  43. m_Advanced = false;
  44. }
  45. };
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CPropertyList window
  48. class CPropertyList : public CListBox
  49. {
  50. // Construction
  51. public:
  52. enum ItemType
  53. {
  54. COMBO = 0,
  55. EDIT,
  56. COLOR,
  57. FONT,
  58. FILE,
  59. CHECKBOX,
  60. PATH
  61. };
  62. CPropertyList();
  63. // Attributes
  64. public:
  65. CMakeSetupDialog *m_CMakeSetupDialog;
  66. // Operations
  67. public:
  68. bool GetShowAdvanced() {return m_ShowAdvanced;}
  69. bool IsDirty() { return m_Dirty; }
  70. void ClearDirty() { m_Dirty = false; }
  71. int AddItem(CString txt);
  72. void AddProperty(const char* name,
  73. const char* value,
  74. const char* helpString,
  75. int type,
  76. const char* comboItems,
  77. bool reverseOrder,
  78. bool advanced);
  79. void RemoveProperty(const char* name);
  80. void HideControls();
  81. void ShowAdvanced();
  82. void HideAdvanced();
  83. std::set<CPropertyItem*> GetItems()
  84. {
  85. return m_PropertyItems;
  86. }
  87. void RemoveAll();
  88. CPropertyItem* GetItem(int index);
  89. // Overrides
  90. // ClassWizard generated virtual function overrides
  91. //{{AFX_VIRTUAL(CPropertyList)
  92. public:
  93. virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  94. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  95. protected:
  96. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  97. virtual void PreSubclassWindow();
  98. //}}AFX_VIRTUAL
  99. // Implementation
  100. public:
  101. virtual ~CPropertyList();
  102. // Generated message map functions
  103. protected:
  104. //{{AFX_MSG(CPropertyList)
  105. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  106. afx_msg void OnSelchange();
  107. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  108. afx_msg void OnKillFocus(CWnd* pNewWnd);
  109. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  110. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  111. afx_msg void OnRButtonUp( UINT nFlags, CPoint point );
  112. //}}AFX_MSG
  113. afx_msg void OnKillfocusCmbBox();
  114. afx_msg void OnSelchangeCmbBox();
  115. afx_msg void OnKillfocusEditBox();
  116. afx_msg void OnChangeEditBox();
  117. afx_msg void OnButton();
  118. afx_msg void OnIgnore();
  119. afx_msg void OnDelete();
  120. afx_msg void OnHelp();
  121. afx_msg void OnCheckBox();
  122. afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );
  123. DECLARE_MESSAGE_MAP()
  124. void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
  125. void DisplayButton(CRect region);
  126. // order = 0 sorted
  127. // order = 1 add to top
  128. // order = 2 add to bottom
  129. int AddPropItem(CPropertyItem* pItem, int order);
  130. void InvalidateList();
  131. CComboBox m_cmbBox;
  132. CEdit m_editBox;
  133. CButton m_btnCtrl;
  134. CButton m_CheckBoxControl;
  135. CFont m_SSerif8Font;
  136. bool m_Dirty;
  137. int m_curSel;
  138. int m_prevSel;
  139. int m_nDivider;
  140. int m_nDivTop;
  141. int m_nDivBtm;
  142. int m_nOldDivX;
  143. int m_nLastBox;
  144. BOOL m_bTracking;
  145. BOOL m_bDivIsSet;
  146. HCURSOR m_hCursorArrow;
  147. HCURSOR m_hCursorSize;
  148. bool m_ShowAdvanced;
  149. std::set<CPropertyItem*> m_PropertyItems;
  150. };
  151. /////////////////////////////////////////////////////////////////////////////
  152. //{{AFX_INSERT_LOCATION}}
  153. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  154. #endif // !defined(AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_)