• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kigo

  • sources
  • kde-4.14
  • kdegames
  • kigo
  • src
  • gui
  • graphicsview
themerenderer.h
Go to the documentation of this file.
1 /*
2  Copyright 2008 Sascha Peilicke <sasch.pe@gmx.de>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License as
6  published by the Free Software Foundation; either version 2 of
7  the License or (at your option) version 3 or any later version
8  accepted by the membership of KDE e.V. (or its successor approved
9  by the membership of KDE e.V.), which shall act as a proxy
10  defined in Section 14 of version 3 of the license.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef KIGO_THEMERENDERER_H
22 #define KIGO_THEMERENDERER_H
23 
24 #include <QObject>
25 #include <QString>
26 
27 class KPixmapCache;
28 class QSvgRenderer;
29 class QPixmap;
30 class QPainter;
31 class QSize;
32 class QRectF;
33 
34 namespace Kigo {
35 
47 class ThemeRenderer : public QObject
48 {
49  Q_OBJECT
50 
51 private:
52  ThemeRenderer();
53  ~ThemeRenderer();
54 
55 public:
59  enum Element {
60  Background = 1,
61  Board,
62  HandicapMark,
63  WhiteStone,
64  WhiteStoneTransparent,
65  WhiteTerritory,
66  BlackStone,
67  BlackStoneTransparent,
68  BlackTerritory,
69  PlacementMarker
70  };
71 
78  inline static ThemeRenderer* self()
79  {
80  static ThemeRenderer self;
81  return &self;
82  }
83 
90  bool loadTheme(const QString &themeName);
91 
99  void renderElement(Element element, QPainter *painter, const QRectF &rect) const;
106  QPixmap renderElement(Element element, const QSize &size) const;
107 
114  QSize elementSize(Element element) const;
115 
116 signals:
117  void themeChanged(const QString &);
118 
119 private:
120  QString m_currentTheme;
121  QSvgRenderer *m_renderer;
122  KPixmapCache *m_cache;
123 };
124 
125 } // End of namespace Kigo
126 
127 #endif
Kigo::ThemeRenderer::WhiteStoneTransparent
Definition: themerenderer.h:64
QSvgRenderer
Kigo::ThemeRenderer::elementSize
QSize elementSize(Element element) const
Retrieves the default size of a given theme element from the current SVG theme.
Definition: themerenderer.cpp:182
Kigo::ThemeRenderer::loadTheme
bool loadTheme(const QString &themeName)
Load the game theme specified by 'name'.
Definition: themerenderer.cpp:52
Kigo::ThemeRenderer::PlacementMarker
Definition: themerenderer.h:69
QObject
QPainter
Kigo::ThemeRenderer::Element
Element
Enumeration of all possible renderable scene element types.
Definition: themerenderer.h:59
Kigo::ThemeRenderer::themeChanged
void themeChanged(const QString &)
QString
QPixmap
QSize
Kigo::ThemeRenderer::Board
Definition: themerenderer.h:61
Kigo::ThemeRenderer::WhiteTerritory
Definition: themerenderer.h:65
Kigo::ThemeRenderer
The class ThemeRenderer loads shapes from a SVG theme file and converts them into pixmaps which can b...
Definition: themerenderer.h:47
Kigo::ThemeRenderer::BlackTerritory
Definition: themerenderer.h:68
QRectF
Kigo::ThemeRenderer::HandicapMark
Definition: themerenderer.h:62
Kigo::ThemeRenderer::BlackStone
Definition: themerenderer.h:66
Kigo::ThemeRenderer::WhiteStone
Definition: themerenderer.h:63
Kigo::ThemeRenderer::renderElement
void renderElement(Element element, QPainter *painter, const QRectF &rect) const
Renders a specific element of the current SVG theme.
Definition: themerenderer.cpp:86
Kigo::ThemeRenderer::Background
Definition: themerenderer.h:60
Kigo::ThemeRenderer::BlackStoneTransparent
Definition: themerenderer.h:67
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kigo

Skip menu "kigo"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal