File indexing completed on 2024-04-28 04:05:02

0001 /*
0002     SPDX-FileCopyrightText: 2010-2012 Stefan Majewsky <majewsky@gmx.net>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #ifndef KGAMEGRAPHICSVIEWRENDERER_H
0008 #define KGAMEGRAPHICSVIEWRENDERER_H
0009 
0010 // own
0011 #include "kdegames_export.h"
0012 #include "kgamerenderer.h"
0013 
0014 class QGraphicsView;
0015 
0016 class KGameGraphicsViewRendererPrivate;
0017 
0018 class KDEGAMES_EXPORT KGameGraphicsViewRenderer : public KGameRenderer
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit KGameGraphicsViewRenderer(KGameThemeProvider *prov, unsigned cacheSize = 0);
0024     /// overload that allows to use KGameRenderer without a theme provider
0025     ///           (useful when there is only one theme)
0026     /// @note Takes ownership of @a theme.
0027     explicit KGameGraphicsViewRenderer(KGameTheme *theme, unsigned cacheSize = 0);
0028     /// Deletes this KGameRenderer instance, as well as all clients using it.
0029     ~KGameGraphicsViewRenderer() override;
0030 
0031 public:
0032     /// @return the primary view which is used by newly created
0033     /// KGameRenderedItem instances associated with this renderer
0034     /// @see KGameRenderedItem::setPrimaryView
0035     QGraphicsView *defaultPrimaryView() const;
0036 
0037     /// Set the primary view which will be used by newly created
0038     /// KGameRenderedItem instances associated with this renderer.
0039     /// Calls to this method will have no effect on existing instances.
0040     /// @see KGameRenderedItem::setPrimaryView
0041     void setDefaultPrimaryView(QGraphicsView *view);
0042 
0043 private:
0044     std::unique_ptr<KGameGraphicsViewRendererPrivate> const d_ptr;
0045     Q_DECLARE_PRIVATE(KGameGraphicsViewRenderer)
0046 };
0047 
0048 #endif // KGAMEGRAPHICSVIEWRENDERER_H