File indexing completed on 2024-03-24 04:08:04

0001 /*
0002     This file is part of the KDE games lskat 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 TEXT_SPRITE_H
0009 #define TEXT_SPRITE_H
0010 
0011 // Qt includes
0012 #include <QGraphicsTextItem>
0013 
0014 // Local includes
0015 #include "thememanager.h"
0016 
0017 /**
0018  * The sprite for a text on the canvas.
0019  */
0020 class TextSprite : public QGraphicsTextItem, public virtual Themable
0021 {
0022 public:
0023     /**
0024      * Constructor for the sprite.
0025      * @param text   The text to display
0026      * @param id     The theme id for the text
0027      * @param theme  The theme manager
0028      * @param scene  The graphics scene to use
0029      */
0030     TextSprite(const QString &text, const QString &id, ThemeManager *theme, QGraphicsScene *scene);
0031 
0032     /**
0033      * Constructor for the sprite.
0034      * @param id     The theme id for the text
0035      * @param theme  The theme manager
0036      * @param scene  The graphics scene to use
0037      */
0038     TextSprite(const QString &id, ThemeManager *theme, QGraphicsScene *scene);
0039 
0040     /**
0041      * Set a new text to the sprite.
0042      * @param text The text to display
0043      */
0044     void setText(const QString &text);
0045 
0046     /**
0047      * Main theme manager function. Called when any theme change like a new
0048      * theme or a theme size change occurs. This object needs to resize and
0049      * redraw then.
0050      */
0051     void changeTheme() override;
0052 };
0053 
0054 #endif