File indexing completed on 2024-12-22 04:09:14

0001 /* This file is part of the KDE project
0002  *
0003  * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
0004  * SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.0-or-later
0007  */
0008 
0009 #ifndef KOZOOMTOOL_H
0010 #define KOZOOMTOOL_H
0011 
0012 #include "KoInteractionTool.h"
0013 
0014 #include <QCursor>
0015 
0016 class KoCanvasBase;
0017 class KoCanvasController;
0018 
0019 /// \internal
0020 class KoZoomTool : public KoInteractionTool
0021 {
0022 public:
0023     /**
0024      * Create a new tool; typically not called by applications, only by the KoToolManager
0025      * @param canvas the canvas this tool works for.
0026      */
0027     explicit KoZoomTool(KoCanvasBase *canvas);
0028     void mouseReleaseEvent(KoPointerEvent *event) override;
0029     void mouseMoveEvent(KoPointerEvent *event) override;
0030     void keyPressEvent(QKeyEvent *event) override;
0031     void keyReleaseEvent(QKeyEvent *event) override;
0032     void activate(const QSet<KoShape*> &shapes) override;
0033     void mouseDoubleClickEvent(KoPointerEvent *event) override;
0034 
0035     void setCanvasController(KoCanvasController *controller) {
0036         m_controller = controller;
0037     }
0038 
0039     void setZoomInMode(bool zoomIn);
0040 
0041 protected:
0042     QWidget *createOptionWidget() override;
0043 
0044 private:
0045     KoInteractionStrategy *createStrategy(KoPointerEvent *event) override;
0046 
0047     void updateCursor(bool swap);
0048 
0049     KoCanvasController *m_controller;
0050     QCursor m_inCursor;
0051     QCursor m_outCursor;
0052     bool m_zoomInMode;
0053 };
0054 
0055 #endif