File indexing completed on 2024-07-14 04:00:05

0001 /*
0002     This file is part of the KDE games kwin4 program
0003     SPDX-FileCopyrightText: 2006 Martin Heni <kde@heni-online.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef SPRITE_NOTIFY_H
0009 #define SPRITE_NOTIFY_H
0010 
0011 // Qt
0012 #include <QGraphicsItem>
0013 #include <QObject>
0014 
0015 /**
0016  * SpriteNotify provides a QObject to a sprite that allows to emit
0017  * a signal from athis sprite if it is necessary to notify another object
0018  * with an action of the sprite, like animation or movement finished.
0019  */
0020 class SpriteNotify : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     /**
0026      * Create the object.
0027      * @param parent The parent graphics item.
0028      */
0029     explicit SpriteNotify(QGraphicsItem *parent);
0030 
0031     /**
0032      * Emit the notification signal.
0033      * @param mode A user defined parameter.
0034      */
0035     void emitSignal(int mode);
0036 
0037 Q_SIGNALS:
0038     /**
0039      * Signal the event for the graphics item and the mode parameter.
0040      * @param item The sprite
0041      * @param mode The user defined mode
0042      */
0043     void signalNotify(QGraphicsItem *item, int mode);
0044 
0045 private:
0046     // The sprite
0047     QGraphicsItem *mParent;
0048 };
0049 
0050 #endif