FLTKPropertyList.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 FLTKPROPERTYLIST_H
  14. #define FLTKPROPERTYLIST_H
  15. #include "../cmStandardIncludes.h"
  16. #include <string>
  17. class CMakeSetupGUIImplementation;
  18. namespace fltk {
  19. /////////////////////////////////////////////////////////////////////////////
  20. //PropertyList Items
  21. class PropertyItem
  22. {
  23. // Attributes
  24. public:
  25. std::string m_HelpString;
  26. std::string m_propName;
  27. std::string m_curValue;
  28. int m_nItemType;
  29. std::string m_cmbItems;
  30. bool m_Removed;
  31. bool m_NewValue;
  32. bool m_Dirty;
  33. public:
  34. PropertyItem( std::string propName,
  35. std::string curValue,
  36. std::string helpString,
  37. int nItemType,
  38. std::string cmbItems )
  39. {
  40. m_HelpString = helpString;
  41. m_propName = propName;
  42. m_curValue = curValue;
  43. m_nItemType = nItemType;
  44. m_cmbItems = cmbItems;
  45. m_Removed = false;
  46. m_NewValue = true;
  47. m_Dirty = false;
  48. }
  49. };
  50. /////////////////////////////////////////////////////////////////////////////
  51. // PropertyList window
  52. class PropertyList
  53. {
  54. // Construction
  55. public:
  56. enum ItemType
  57. {
  58. COMBO = 0,
  59. EDIT,
  60. COLOR,
  61. FONT,
  62. FILE,
  63. CHECKBOX,
  64. PATH
  65. };
  66. PropertyList( CMakeSetupGUIImplementation * );
  67. // Attributes
  68. public:
  69. // Operations
  70. public:
  71. int AddItem( std::string txt );
  72. int AddProperty(const char* name,
  73. const char* value,
  74. const char* helpString,
  75. int type,
  76. const char* comboItems,
  77. bool reverseOrder);
  78. void RemoveProperty(const char* name);
  79. std::set<PropertyItem*> & GetItems()
  80. {
  81. return m_PropertyItems;
  82. }
  83. void InvalidateList(void);
  84. void Invalidate(void)
  85. {
  86. // fltk redraw();
  87. }
  88. int GetCount(void) const
  89. {
  90. return m_PropertyItems.size();
  91. }
  92. void OnButton(void);
  93. void OnHelp(void);
  94. void RemoveAll();
  95. PropertyItem* GetItem(int index);
  96. PropertyItem* GetItemDataPtr(int m_curSel);
  97. void ClearDirty(void) { m_Dirty = false; }
  98. void SetDirty(void) { m_Dirty = true; }
  99. bool IsDirty(void) const { return m_Dirty; }
  100. // Implementation
  101. public:
  102. virtual ~PropertyList();
  103. protected:
  104. int AddPropItem(PropertyItem* pItem,bool reverseOrder);
  105. std::set<PropertyItem*> m_PropertyItems;
  106. CMakeSetupGUIImplementation * m_CMakeSetup;
  107. bool m_Dirty;
  108. };
  109. } // end namespace fltk
  110. #endif