TDE graphics utilities
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.1KB

  1. /* This file is part of the KDE project
  2. Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public
  5. License as published by the Free Software Foundation, version 2.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; see the file COPYING. If not, write to
  12. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  13. Boston, MA 02110-1301, USA.
  14. */
  15. #ifndef PROPERTYSHEET_H
  16. #define PROPERTYSHEET_H
  17. #include <tqdom.h>
  18. #include <tqstring.h>
  19. #include <tqptrlist.h>
  20. class TQWidget;
  21. namespace KMrml
  22. {
  23. class PropertySheet
  24. {
  25. public:
  26. enum Type
  27. {
  28. MultiSet = 1, // ??
  29. Subset, // radio-button/combobox or listbox
  30. SetElement, // CheckBox -> disables/enables children?
  31. Boolean, // CheckBox
  32. Numeric, // Slider/Spinbox
  33. Textual, // lineedit
  34. Panel, // groupbox?
  35. Clone,
  36. Reference
  37. };
  38. enum Visibility
  39. {
  40. Visible,
  41. Invisible,
  42. Popup
  43. };
  44. enum SendType
  45. {
  46. Element = 1,
  47. Attribute,
  48. AttributeName,
  49. AttributeValue,
  50. Children,
  51. None
  52. };
  53. PropertySheet();
  54. PropertySheet( const TQDomElement& elem );
  55. PropertySheet( const PropertySheet& ps );
  56. ~PropertySheet() {};
  57. PropertySheet& operator=( const PropertySheet& ps );
  58. bool isValid() const {
  59. // required mrml attributes
  60. return !m_id.isNull() && m_type != 0 && m_sendType != 0;
  61. }
  62. void initFromDOM( const TQDomElement& elem );
  63. void toElement( TQDomElement& parent );
  64. TQWidget * createWidget( TQWidget *parent, const char *name = 0 );
  65. private:
  66. static Visibility getVisibility( const TQString& value );
  67. static Type getType( const TQString& value );
  68. static SendType getSendType( const TQString& value );
  69. static int toInt( const TQString& value, int defaultValue = 0 );
  70. void init();
  71. // update operator=() when adding data members!
  72. TQPtrList<PropertySheet> m_subSheets;
  73. Visibility m_visibility;
  74. Type m_type;
  75. TQString m_caption;
  76. TQString m_id;
  77. SendType m_sendType;
  78. TQString m_sendName;
  79. TQString m_sendValue;
  80. int m_minRange;
  81. int m_maxRange;
  82. int m_stepSize;
  83. // Type = Subset && m_minSubsetSize == m_maxSubsetSize == 1 -> Combobox
  84. // or radio buttons.
  85. // > max > 1 -> Listbox with multiselection
  86. int m_minSubsetSize;
  87. int m_maxSubsetSize;
  88. };
  89. }
  90. #endif // PROPERTYSHEET_H