File indexing completed on 2024-05-12 04:35:04

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2016 Dominik Haumann <dhaumann@kde.org>
0004  *
0005  * This library is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU Library General Public License as published
0007  * by the Free Software Foundation, either version 2 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, see
0017  * <http://www.gnu.org/licenses/>.
0018  */
0019 #ifndef TIKZ_CORE_POS_PROPERTY_H
0020 #define TIKZ_CORE_POS_PROPERTY_H
0021 
0022 #include "Property.h"
0023 #include "Pos.h"
0024 
0025 namespace tikz {
0026 namespace core {
0027 
0028 /**
0029  * Color property.
0030  */
0031 class TIKZKITCORE_EXPORT PosProperty : public Property
0032 {
0033 public:
0034     /**
0035      * Constructor that creates a property @p propertyName as part of @p entity.
0036      */
0037     explicit PosProperty(const QString & propertyName, PropertyInterface * interface);
0038 
0039     /**
0040      * Virtual destructor.
0041      */
0042     virtual ~PosProperty();
0043 
0044 public:
0045     /**
0046      * Set the value or this property to @p pos.
0047      */
0048     void setPos(const Pos & pos);
0049 
0050     /**
0051      * Returns the Pos of this property.
0052      */
0053     Pos pos() const;
0054 
0055 public: // Property overrides
0056     /**
0057      * Returns the type of the property.
0058      * The type is used to cast the property to the respective derived type.
0059      */
0060     const char * propertyType() const override;
0061 
0062     /**
0063      * Reset the property to its default value.
0064      * @see isSet()
0065      */
0066     void unset() override;
0067 
0068 protected:
0069     /**
0070      * Load the payload of the Property state from the @p json object.
0071      */
0072     void loadData(const QJsonObject & json) override;
0073 
0074     /**
0075      * Save the payload of the Property state to the @p json object.
0076      */
0077     void saveData(QJsonObject & json) override;
0078 
0079 private:
0080     Pos m_pos;
0081 };
0082 
0083 } //namespace core
0084 } //namespace tikz
0085 
0086 #endif // TIKZ_CORE_POS_PROPERTY_H
0087 
0088 // kate: indent-width 4; replace-tabs on;