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

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006-2010 Thomas Zander <zander@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOTOOLPROXYPRIVATE_P
0008 #define KOTOOLPROXYPRIVATE_P
0009 
0010 #include <QTimer>
0011 #include <QElapsedTimer>
0012 #include <QPointF>
0013 #include <KoPointerEvent.h>
0014 #include <boost/optional.hpp>
0015 
0016 class KoPointerEvent;
0017 class KoToolBase;
0018 class KoCanvasController;
0019 class KoToolProxy;
0020 
0021 class KoToolProxyPrivate
0022 {
0023 public:
0024     explicit KoToolProxyPrivate(KoToolProxy *p);
0025 
0026     void timeout(); // Auto scroll the canvas
0027 
0028     void checkAutoScroll(const KoPointerEvent &event);
0029 
0030     void selectionChanged(bool newSelection);
0031 
0032     bool isActiveLayerEditable();
0033 
0034     /// the toolManager tells us which KoCanvasController this toolProxy is working for.
0035     void setCanvasController(KoCanvasController *controller);
0036 
0037     KoToolBase *activeTool {0};
0038     bool hasSelection {false};
0039     QTimer scrollTimer;
0040     QPoint widgetScrollPoint;
0041     KoCanvasController *controller {0};
0042     KoToolProxy *parent {0};
0043 
0044     // used to determine if the mouse-release is after a drag or a simple click
0045     QPoint mouseDownPoint;
0046 
0047     // up until at least 4.3.0 we get a mouse move event when the tablet leaves the canvas.
0048     bool mouseLeaveWorkaround {false};
0049 
0050     bool isToolPressed {false};
0051 
0052     // for multi clicking (double click or triple click) we need the following
0053     int multiClickCount {0};
0054     QPointF multiClickGlobalPoint;
0055     QElapsedTimer multiClickTimeStamp;
0056 
0057     boost::optional<KoPointerEventWrapper> lastPointerEvent;
0058 };
0059 
0060 #endif