File indexing completed on 2024-12-22 04:12:42

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_PAN_ACTION_H
0008 #define KIS_PAN_ACTION_H
0009 
0010 #include "kis_abstract_input_action.h"
0011 
0012 /**
0013  * \brief Pan Canvas implementation of KisAbstractInputAction.
0014  *
0015  * The Pan Canvas action pans the canvas.
0016  */
0017 class KisPanAction : public KisAbstractInputAction
0018 {
0019 public:
0020     /**
0021      * The different behaviours for this action.
0022      */
0023     enum Shortcut {
0024         PanModeShortcut, ///< Toggle the pan mode.
0025         PanLeftShortcut, ///< Pan left by a fixed amount.
0026         PanRightShortcut, ///< Pan right by a fixed amount.
0027         PanUpShortcut, ///< Pan up by a fixed amount.
0028         PanDownShortcut ///< Pan down by a fixed amount.
0029     };
0030 
0031     explicit KisPanAction();
0032     ~KisPanAction() override;
0033 
0034     int priority() const override;
0035 
0036     void activate(int shortcut) override;
0037     void deactivate(int shortcut) override;
0038 
0039     void begin(int shortcut, QEvent *event) override;
0040     void end(QEvent *event) override;
0041 
0042     void inputEvent(QEvent* event) override;
0043     void cursorMovedAbsolute(const QPointF &lastPos, const QPointF &pos) override;
0044 
0045     bool isShortcutRequired(int shortcut) const override;
0046 
0047     KisInputActionGroup inputActionGroup(int shortcut) const override;
0048     bool supportsHiResInputEvents(int shortcut) const override;
0049 
0050 private:
0051     class Private;
0052     Private * const d;
0053 };
0054 
0055 #endif // KIS_PAN_ACTION_H