File indexing completed on 2024-05-19 04:36:36

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2013-2014 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 
0020 #ifndef TIKZ_UI_PATH_ITEM_H
0021 #define TIKZ_UI_PATH_ITEM_H
0022 
0023 #include "TikzItem.h"
0024 
0025 #include <tikz/core/tikz.h>
0026 #include <tikz/core/Uid.h>
0027 
0028 namespace tikz {
0029 namespace core {
0030     class Path;
0031     class Style;
0032 }
0033 
0034 namespace ui {
0035 
0036 class DocumentPrivate;
0037 class PathPrivate;
0038 
0039 class TIKZKITUI_EXPORT PathItem :  public TikzItem
0040 {
0041     Q_OBJECT
0042 
0043     public:
0044         /**
0045          * Constructor for @p path and parent @p parent.
0046          */
0047         PathItem(tikz::core::Path * path, QGraphicsItem * parent = nullptr);
0048 
0049         /**
0050          * Destructor
0051          */
0052         virtual ~PathItem();
0053 
0054         /**
0055          * Returns the associated document, if available.
0056          */
0057         DocumentPrivate * document() const;
0058 
0059         /**
0060          * Reimplment to return a proper UserType + 3.
0061          */
0062         int type() const override;
0063 
0064         /**
0065          * Returns the pointer to the associated Path.
0066          * @warning Use setStartNode() and setEndNode() to change nodes
0067          */
0068         tikz::core::Path * path() const;
0069 
0070         /**
0071          * Returns path().uid();
0072          */
0073         tikz::core::Uid uid() const;
0074 
0075         /**
0076          * Get the Style of this path.
0077          * The returned pointer is always valid.
0078          */
0079         tikz::core::Style* style() const;
0080 
0081     Q_SIGNALS:
0082         /**
0083          * This signal is emitted whenever this path changes in any way.
0084          * This is the same as the signal path()->changed().
0085          */
0086         void changed();
0087 
0088     //
0089     // internal
0090     //
0091     private:
0092         /**
0093          * Private default constructor, not implemented
0094          */
0095         PathItem();
0096 
0097     private:
0098         PathPrivate * const d;
0099 };
0100 
0101 }
0102 }
0103 
0104 #endif // TIKZ_UI_PATH_ITEM_H
0105 
0106 // kate: indent-width 4; replace-tabs on;