PropertyList.h 3.6 KB

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