FLTKPropertyList.h 2.4 KB

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