PropertyList.h 4.3 KB

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