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

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2009 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOSHAPETRANSPARENCYCOMMAND_H
0008 #define KOSHAPETRANSPARENCYCOMMAND_H
0009 
0010 #include "kritaflake_export.h"
0011 
0012 #include <kundo2command.h>
0013 #include <QList>
0014 
0015 class KoShape;
0016 
0017 /// The undo / redo command for setting the shape transparency
0018 class KRITAFLAKE_EXPORT KoShapeTransparencyCommand : public KUndo2Command
0019 {
0020 public:
0021     /**
0022      * Command to set a new shape transparency.
0023      * @param shapes a set of all the shapes that should get the new background.
0024      * @param transparency the new shape transparency
0025      * @param parent the parent command used for macro commands
0026      */
0027     KoShapeTransparencyCommand(const QList<KoShape*> &shapes, qreal transparency, KUndo2Command *parent = 0);
0028 
0029     /**
0030      * Command to set a new shape transparency.
0031      * @param shape a single shape that should get the new transparency.
0032      * @param transparency the new shape transparency
0033      * @param parent the parent command used for macro commands
0034      */
0035     KoShapeTransparencyCommand(KoShape *shape, qreal transparency, KUndo2Command *parent = 0);
0036 
0037     /**
0038      * Command to set new shape transparencies.
0039      * @param shapes a set of all the shapes that should get a new transparency.
0040      * @param fills the new transparencies, one for each shape
0041      * @param parent the parent command used for macro commands
0042      */
0043     KoShapeTransparencyCommand(const QList<KoShape*> &shapes, const QList<qreal> &transparencies, KUndo2Command *parent = 0);
0044 
0045     ~KoShapeTransparencyCommand() override;
0046     /// redo the command
0047     void redo() override;
0048     /// revert the actions done in redo
0049     void undo() override;
0050 
0051     int id() const override;
0052     bool mergeWith(const KUndo2Command *command) override;
0053 
0054 private:
0055     class Private;
0056     Private * const d;
0057 };
0058 
0059 #endif // KOSHAPETRANSPARENCYCOMMAND_H