File indexing completed on 2024-05-12 15:56:46

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOSELECTEDSHAPESPROXY_H
0008 #define KOSELECTEDSHAPESPROXY_H
0009 
0010 #include <QObject>
0011 #include "kritaflake_export.h"
0012 
0013 class KoSelection;
0014 class KoShapeLayer;
0015 
0016 /**
0017  * @brief The KoSelectedShapesProxy class is a special interface of KoCanvasBase to
0018  * have a stable connection to shape selection signals in an environment when the
0019  * active shape manager can switch (e.g. when shape layers are switched in Krita)
0020  */
0021 
0022 class KRITAFLAKE_EXPORT KoSelectedShapesProxy : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit KoSelectedShapesProxy(QObject *parent = 0);
0027 
0028     /**
0029      * Returns a pointer to a currently active shape selection. Don't connect to the
0030      * selection, unless you really know what you are doing. Use the signals provided
0031      * by KoSelectedShapesProxy itself. They are guaranteed to be valid all the time.
0032      */
0033     virtual KoSelection *selection() = 0;
0034 
0035 
0036     /**
0037       * @brief The shape wants to edited. This is used when a shape is passed
0038       * between two different tools. This notifies the new tool that it needs
0039       * to enter some extra edit mode.
0040       *
0041       */
0042     bool isRequestingToBeEdited();
0043     void setRequestingToBeEdited(bool value);
0044 
0045 Q_SIGNALS:
0046 
0047     // forwards a corresponding signal of KoShapeManager
0048     void selectionChanged();
0049 
0050     // forwards a corresponding signal of KoShapeManager
0051     void selectionContentChanged();
0052 
0053     // forwards a corresponding signal of KoSelection
0054     void currentLayerChanged(const KoShapeLayer *layer);
0055 
0056 private:
0057     bool m_isRequestingEditing = false;
0058 };
0059 
0060 #endif // KOSELECTEDSHAPESPROXY_H