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

klettres

  • sources
  • kde-4.14
  • kdeedu
  • klettres
  • src
kltheme.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) Copyright (C) 2007 Pino Toscano <pino@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18  ***************************************************************************/
19 
20 //project headers
21 #include "kltheme.h"
22 
23 #include <KLocale>
24 
25 KLTheme::KLTheme()
26 {
27 }
28 
29 KLTheme::~KLTheme()
30 {
31 }
32 
34 class KLThemeKid : public KLTheme
35 {
36 public:
37  KLThemeKid()
38  : KLTheme()
39  {
40  }
41 
42  virtual QString name() const
43  {
44  return "kids";
45  }
46 
47  virtual QString uiName() const
48  {
49  return i18nc("@item:inlistbox", "Kid");
50  }
51 
52  virtual QString svgFileName() const
53  {
54  return "klettres_kids.svg";
55  }
56 
57  virtual QColor letterColor() const
58  {
59  return QColor(215, 215, 215);
60  }
61 
62  virtual QColor backgroundInputColor() const
63  {
64  return QColor(187, 76, 58);
65  }
66 
67  virtual QColor letterInputColor() const
68  {
69  return QColor(215, 215, 215);
70  }
71 
72  virtual QRect wordRect(const QSize& windowsize) const
73  {
74  return QRect(windowsize.width()*200/800, windowsize.height()*200/600, 250, 160);
75  }
76 
77  virtual QRect inputRect(const QSize& windowsize) const
78  {
79  return QRect(windowsize.width()*188/800, windowsize.height()*468/600, 25, 90);
80  }
81 };
82 
84 class KLThemeDesert : public KLTheme
85 {
86 public:
87  KLThemeDesert()
88  : KLTheme()
89  {
90  }
91 
92  virtual QString name() const
93  {
94  return "desert";
95  }
96 
97  virtual QString uiName() const
98  {
99  return i18nc("@item:inlistbox desert theme for the interface", "Desert");
100  }
101 
102  virtual QString svgFileName() const
103  {
104  return "klettres_desert.svg";
105  }
106 
107  virtual QColor letterColor() const
108  {
109  return QColor(115, 50, 95);
110  }
111 
112  virtual QColor backgroundInputColor() const
113  {
114  return QColor(202, 217, 84);
115  }
116 
117  virtual QColor letterInputColor() const
118  {
119  return QColor(141, 80, 17);
120  }
121 
122  virtual QRect wordRect(const QSize& windowsize) const
123  {
124  return QRect(windowsize.width()*230/800, windowsize.height()*140/600, 250, 160);
125  }
126 
127  virtual QRect inputRect(const QSize& windowsize) const
128  {
129  return QRect(windowsize.width()*380/800, windowsize.height()*480/600, 250, 160);
130  }
131 };
132 
134 class KLThemeSavannah : public KLTheme
135 {
136 public:
137  KLThemeSavannah()
138  : KLTheme()
139  {
140  }
141 
142  virtual QString name() const
143  {
144  return "savannah";
145  }
146 
147  virtual QString uiName() const
148  {
149  return i18nc("@item:inlistbox", "Savannah");
150  }
151 
152  virtual QString svgFileName() const
153  {
154  return "klettres_savannah.svg";
155  }
156 
157  virtual QColor letterColor() const
158  {
159  return QColor(215, 215, 215);
160  }
161 
162  virtual QColor backgroundInputColor() const
163  {
164  return QColor(196, 189, 94);
165  }
166 
167  virtual QColor letterInputColor() const
168  {
169  return QColor(141, 80, 17);
170  }
171 
172  virtual QRect wordRect(const QSize& windowsize) const
173  {
174  return QRect(windowsize.width()*230/800, windowsize.height()*80/600, 250, 160);
175  }
176 
177  virtual QRect inputRect(const QSize& windowsize) const
178  {
179  return QRect(windowsize.width()*540/800, windowsize.height()*480/600, 250, 160);
180  }
181 };
182 
184 
185 class KLThemeAqua : public KLTheme
186 {
187 public:
188  KLThemeAqua()
189  : KLTheme()
190  {
191  }
192 
193  virtual QString name() const
194  {
195  return "aqua";
196  }
197 
198  virtual QString uiName() const
199  {
200  return i18nc("@item:inlistbox", "Aqua");
201  }
202 
203  virtual QString svgFileName() const
204  {
205  return "klettres_aqua.svg";
206  }
207 
208  virtual QColor letterColor() const
209  {
210  return QColor(215, 215, 215);
211  }
212 
213  virtual QColor backgroundInputColor() const
214  {
215  return QColor(0, 0, 100);
216  }
217 
218  virtual QColor letterInputColor() const
219  {
220  return QColor(0, 0, 215);
221  }
222 
223  virtual QRect wordRect(const QSize& windowsize) const
224  {
225  return QRect(windowsize.width()*150/800, windowsize.height()*180/600, 250, 160);
226  }
227 
228  virtual QRect inputRect(const QSize& windowsize) const
229  {
230  return QRect(windowsize.width()*600/800, windowsize.height()*480/600, 250, 160);
231  }
232 };
233 
234 KLThemeFactory* KLThemeFactory::instance()
235 {
236  static KLThemeFactory factory;
237  return &factory;
238 }
239 
240 KLThemeFactory::KLThemeFactory()
241 {
242 }
243 
244 KLThemeFactory::~KLThemeFactory()
245 {
246 }
247 
248 KLTheme* KLThemeFactory::buildTheme(int id) const
249 {
250  switch (id)
251  {
252  case 0:
253  return new KLThemeKid();
254  case 1:
255  return new KLThemeDesert();
256  case 2:
257  return new KLThemeSavannah();
258  case 3:
259  return new KLThemeAqua();
260  }
261  return 0;
262 }
263 
264 #define ADD_THEME_NAME( themeclass, list ) \
265 { \
266  themeclass x; \
267  list.append( x.uiName() ); \
268 }
269 QStringList KLThemeFactory::themeList() const
270 {
271  QStringList ret;
272  ADD_THEME_NAME( KLThemeKid, ret )
273  ADD_THEME_NAME( KLThemeDesert, ret )
274  ADD_THEME_NAME( KLThemeSavannah, ret )
275  ADD_THEME_NAME( KLThemeAqua, ret)
276  return ret;
277 }
278 
279 
280 
281 
QSize::width
int width() const
KLTheme::letterInputColor
virtual QColor letterInputColor() const =0
returns the color for the letter in the LineEdit box
KLTheme::inputRect
virtual QRect inputRect(const QSize &windowsize) const =0
KLThemeFactory
Definition: kltheme.h:46
KLTheme::uiName
virtual QString uiName() const =0
QRect
KLThemeFactory::~KLThemeFactory
~KLThemeFactory()
Definition: kltheme.cpp:244
KLTheme::name
virtual QString name() const =0
ADD_THEME_NAME
#define ADD_THEME_NAME(themeclass, list)
Definition: kltheme.cpp:264
KLTheme::backgroundInputColor
virtual QColor backgroundInputColor() const =0
returns the color for the background of the LineEdit box
KLTheme::letterColor
virtual QColor letterColor() const =0
returns the color for displaying the letter/syllable
QString
QColor
KLThemeFactory::themeList
QStringList themeList() const
Definition: kltheme.cpp:269
QStringList
QSize
KLThemeFactory::instance
static KLThemeFactory * instance()
Definition: kltheme.cpp:234
KLTheme::wordRect
virtual QRect wordRect(const QSize &windowsize) const =0
KLThemeFactory::buildTheme
KLTheme * buildTheme(int id) const
Definition: kltheme.cpp:248
KLTheme::~KLTheme
virtual ~KLTheme()
Definition: kltheme.cpp:29
QSize::height
int height() const
KLTheme
Definition: kltheme.h:26
kltheme.h
KLTheme::KLTheme
KLTheme()
Definition: kltheme.cpp:25
KLTheme::svgFileName
virtual QString svgFileName() const =0
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

klettres

Skip menu "klettres"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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