File indexing completed on 2025-02-02 04:14:47

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
0003  * SPDX-FileCopyrightText: 2006, 2007 Thorsten Zachmann <zachmann@kde.org>
0004  * SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.0-or-later
0007  */
0008 
0009 #ifndef KOPARAMETERHANDLEMOVECOMMAND_H
0010 #define KOPARAMETERHANDLEMOVECOMMAND_H
0011 
0012 #include <kundo2command.h>
0013 #include <QPointF>
0014 #include "kritaflake_export.h"
0015 
0016 class KoParameterShape;
0017 
0018 /// The undo / redo command for changing a parameter
0019 class KoParameterHandleMoveCommand : public KUndo2Command
0020 {
0021 public:
0022     /**
0023      * Constructor.
0024      * @param shape the shape this command works on
0025      * @param handleId the ID under which the parameterShape knows the handle in KoParameterShape::moveHandle()
0026      * @param startPoint The old position
0027      * @param endPoint The new position
0028      * @param keyModifiers the key modifiers used while moving.
0029      * @param parent the parent command if this is a compound undo command.
0030      */
0031     KoParameterHandleMoveCommand(KoParameterShape *shape, int handleId, const QPointF &startPoint, const QPointF &endPoint, Qt::KeyboardModifiers keyModifiers, KUndo2Command *parent = 0);
0032     ~KoParameterHandleMoveCommand() override;
0033 
0034     /// redo the command
0035     void redo() override;
0036     /// revert the actions done in redo
0037     void undo() override;
0038 
0039     int id() const override;
0040     bool mergeWith(const KUndo2Command *command) override;
0041 
0042 private:
0043     KoParameterShape *m_shape;
0044     int m_handleId;
0045     QPointF m_startPoint;
0046     QPointF m_endPoint;
0047     Qt::KeyboardModifiers m_keyModifiers;
0048 };
0049 
0050 #endif // KOPARAMETERHANDLEMOVECOMMAND_H
0051