FLTKPropertyList.h 2.1 KB

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