PropertyList.h 3.5 KB

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