PropertyList.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. public:
  31. CPropertyItem(CString propName, CString curValue,
  32. CString helpString,
  33. int nItemType, CString cmbItems)
  34. {
  35. m_NewValue = true;
  36. m_HelpString = helpString;
  37. m_Removed = false;
  38. m_propName = propName;
  39. m_curValue = curValue;
  40. m_nItemType = nItemType;
  41. m_cmbItems = cmbItems;
  42. }
  43. };
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CPropertyList window
  46. class CPropertyList : public CListBox
  47. {
  48. // Construction
  49. public:
  50. enum ItemType
  51. {
  52. COMBO = 0,
  53. EDIT,
  54. COLOR,
  55. FONT,
  56. FILE,
  57. CHECKBOX,
  58. PATH
  59. };
  60. CPropertyList();
  61. // Attributes
  62. public:
  63. CMakeSetupDialog *m_CMakeSetupDialog;
  64. // Operations
  65. public:
  66. bool IsDirty() { return m_Dirty; }
  67. void ClearDirty() { m_Dirty = false; }
  68. int AddItem(CString txt);
  69. int AddProperty(const char* name,
  70. const char* value,
  71. const char* helpString,
  72. int type,
  73. const char* comboItems,
  74. bool reverseOrder);
  75. void RemoveProperty(const char* name);
  76. void HideControls();
  77. std::set<CPropertyItem*> GetItems()
  78. {
  79. return m_PropertyItems;
  80. }
  81. void RemoveAll();
  82. CPropertyItem* GetItem(int index);
  83. // Overrides
  84. // ClassWizard generated virtual function overrides
  85. //{{AFX_VIRTUAL(CPropertyList)
  86. public:
  87. virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  88. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  89. protected:
  90. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  91. virtual void PreSubclassWindow();
  92. //}}AFX_VIRTUAL
  93. // Implementation
  94. public:
  95. virtual ~CPropertyList();
  96. // Generated message map functions
  97. protected:
  98. //{{AFX_MSG(CPropertyList)
  99. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  100. afx_msg void OnSelchange();
  101. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  102. afx_msg void OnKillFocus(CWnd* pNewWnd);
  103. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  104. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  105. afx_msg void OnRButtonUp( UINT nFlags, CPoint point );
  106. //}}AFX_MSG
  107. afx_msg void OnKillfocusCmbBox();
  108. afx_msg void OnSelchangeCmbBox();
  109. afx_msg void OnKillfocusEditBox();
  110. afx_msg void OnChangeEditBox();
  111. afx_msg void OnButton();
  112. afx_msg void OnIgnore();
  113. afx_msg void OnDelete();
  114. afx_msg void OnHelp();
  115. afx_msg void OnCheckBox();
  116. afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );
  117. DECLARE_MESSAGE_MAP()
  118. void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
  119. void DisplayButton(CRect region);
  120. int AddPropItem(CPropertyItem* pItem, bool top);
  121. void InvalidateList();
  122. CComboBox m_cmbBox;
  123. CEdit m_editBox;
  124. CButton m_btnCtrl;
  125. CButton m_CheckBoxControl;
  126. CFont m_SSerif8Font;
  127. bool m_Dirty;
  128. int m_curSel;
  129. int m_prevSel;
  130. int m_nDivider;
  131. int m_nDivTop;
  132. int m_nDivBtm;
  133. int m_nOldDivX;
  134. int m_nLastBox;
  135. BOOL m_bTracking;
  136. BOOL m_bDivIsSet;
  137. HCURSOR m_hCursorArrow;
  138. HCURSOR m_hCursorSize;
  139. std::set<CPropertyItem*> m_PropertyItems;
  140. };
  141. /////////////////////////////////////////////////////////////////////////////
  142. //{{AFX_INSERT_LOCATION}}
  143. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  144. #endif // !defined(AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_)