File indexing completed on 2025-02-23 04:09:01
0001 /* 0002 * SPDX-FileCopyrightText: 2013 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_INFINITY_MANAGER_H 0008 #define __KIS_INFINITY_MANAGER_H 0009 0010 #include "kis_canvas_decoration.h" 0011 0012 #include <QPointer> 0013 #include <QPainterPath> 0014 #include <QCursor> 0015 0016 #include <kis_canvas2.h> 0017 0018 class KisView; 0019 0020 static const QString INFINITY_DECORATION_ID = "infinity-decorations"; 0021 0022 class KRITAUI_EXPORT KisInfinityManager : public KisCanvasDecoration 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 KisInfinityManager(QPointer<KisView>view, KisCanvas2 *canvas); 0028 0029 protected: 0030 void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter, KisCanvas2 *canvas) override; 0031 bool eventFilter(QObject *obj, QEvent *event) override; 0032 0033 public Q_SLOTS: 0034 void imagePositionChanged(); 0035 0036 private: 0037 enum Side { 0038 Right = 0, 0039 Bottom, 0040 Left, 0041 Top, 0042 0043 NSides 0044 }; 0045 inline void addDecoration(const QRect &areaRect, const QPointF &handlePoint, qreal angle, Side side); 0046 0047 private: 0048 QPainterPath m_decorationPath; 0049 0050 bool m_filteringEnabled; 0051 bool m_cursorSwitched; 0052 QCursor m_oldCursor; 0053 QVector<QTransform> m_handleTransform; 0054 0055 QVector<QRect> m_sideRects; 0056 0057 QPointer<KisCanvas2> m_canvas; 0058 }; 0059 0060 #endif /* __KIS_INFINITY_MANAGER_H */