File indexing completed on 2024-05-26 04:26:19

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2011 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOSHAPECONNECTIONCHANGECOMMAND_H
0008 #define KOSHAPECONNECTIONCHANGECOMMAND_H
0009 
0010 #include "kritaflake_export.h"
0011 #include <kundo2command.h>
0012 #include "KoConnectionShape.h"
0013 
0014 /// A command to add a connection between two shapes
0015 class KRITAFLAKE_EXPORT KoShapeConnectionChangeCommand : public KUndo2Command
0016 {
0017 public:
0018     /**
0019      * Creates command to connect a connection shape to a shape
0020      * @param connection the connection shape to connect to the shape
0021      * @param connectionHandle the handle of the connection to connect to
0022      * @param oldConnectedShape the old shape we were connected to
0023      * @param newConnectedShape the new shape to connect to
0024      * @param connectionPointId the id of the connection point to connect to
0025      * @param parent the parent undo command
0026      */
0027     KoShapeConnectionChangeCommand(KoConnectionShape *connection, KoConnectionShape::HandleId connectionHandle,
0028                                    KoShape *oldConnectedShape, int oldConnectionPointId,
0029                                    KoShape *newConnectedShape, int newConnectionPointId, KUndo2Command *parent = 0);
0030 
0031     /// Destroys the command
0032     ~KoShapeConnectionChangeCommand() override;
0033 
0034     /// redo the command
0035     void redo() override;
0036     /// revert the actions done in redo
0037     void undo() override;
0038 
0039 private:
0040     class Private;
0041     Private * const d;
0042 };
0043 
0044 #endif // KOSHAPECONNECTIONCHANGECOMMAND_H