File indexing completed on 2025-07-06 04:09:23
0001 /*************************************************************************** 0002 kstscalar.h - the base scalar type 0003 ------------------- 0004 begin : March 24, 2003 0005 copyright : (C) 2003 by cbn 0006 email : netterfield@astro.utoronto.ca 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef SCALAR_H 0019 #define SCALAR_H 0020 0021 #include "primitive.h" 0022 0023 class QXmlStreamWriter; 0024 0025 namespace Kst { 0026 0027 /** The base class for all scalars. */ 0028 class KSTCORE_EXPORT Scalar : public Primitive 0029 { 0030 Q_OBJECT 0031 Q_PROPERTY(bool orphan READ orphan WRITE setOrphan) 0032 Q_PROPERTY(double value READ value WRITE setValue) 0033 Q_PROPERTY(bool displayable READ displayable WRITE setDisplayable) 0034 0035 protected: 0036 Scalar(ObjectStore *store); 0037 0038 friend class ObjectStore; 0039 0040 virtual QString _automaticDescriptiveName() const; 0041 0042 virtual void _initializeShortName(); 0043 0044 public: 0045 virtual ~Scalar(); 0046 0047 /** Update the scalar.*/ 0048 virtual void internalUpdate(); 0049 0050 virtual const QString& typeString() const; 0051 static const QString staticTypeString; 0052 static const QString staticTypeTag; 0053 0054 /* return a string representation of the scalar */ 0055 QString label() const; 0056 0057 /** Save scalar information */ 0058 virtual void save(QXmlStreamWriter &s); 0059 0060 Scalar& operator=(double v); 0061 0062 virtual QString descriptionTip() const; 0063 0064 virtual QString propertyString() const; 0065 virtual QString sizeString() const; 0066 0067 virtual ObjectList<Primitive> outputPrimitives() const { return ObjectList<Primitive>(); } 0068 virtual PrimitiveMap metas() const { return PrimitiveMap(); } 0069 virtual ScriptInterface* createScriptInterface(); 0070 0071 public slots: 0072 double value() const; 0073 0074 /** Set the value of the scalar - ignored for some types */ 0075 void setValue(double inV); 0076 0077 bool orphan() const; 0078 void setOrphan(bool orphan); 0079 0080 bool displayable() const; 0081 void setDisplayable(bool displayable); 0082 0083 bool editable() const; 0084 void setEditable(bool editable); 0085 0086 protected: 0087 double _value; 0088 0089 private: 0090 bool _orphan; 0091 bool _displayable; 0092 bool _editable; 0093 }; 0094 0095 typedef SharedPtr<Scalar> ScalarPtr; 0096 typedef ObjectList<Scalar> ScalarList; 0097 typedef ObjectMap<Scalar> ScalarMap; 0098 0099 } 0100 0101 Q_DECLARE_METATYPE(Kst::Scalar*) 0102 0103 #endif 0104 // vim: ts=2 sw=2 et