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

klettres

  • sources
  • kde-4.12
  • 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 
183 KLThemeFactory* KLThemeFactory::instance()
184 {
185  static KLThemeFactory factory;
186  return &factory;
187 }
188 
189 KLThemeFactory::KLThemeFactory()
190 {
191 }
192 
193 KLThemeFactory::~KLThemeFactory()
194 {
195 }
196 
197 KLTheme* KLThemeFactory::buildTheme(int id) const
198 {
199  switch (id)
200  {
201  case 0:
202  return new KLThemeKid();
203  case 1:
204  return new KLThemeDesert();
205  case 2:
206  return new KLThemeSavannah();
207  }
208  return 0;
209 }
210 
211 #define ADD_THEME_NAME( themeclass, list ) \
212 { \
213  themeclass x; \
214  list.append( x.uiName() ); \
215 }
216 QStringList KLThemeFactory::themeList() const
217 {
218  QStringList ret;
219  ADD_THEME_NAME( KLThemeKid, ret )
220  ADD_THEME_NAME( KLThemeDesert, ret )
221  ADD_THEME_NAME( KLThemeSavannah, ret )
222  return ret;
223 }
224 
225 
226 
227 
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
KLThemeFactory::~KLThemeFactory
~KLThemeFactory()
Definition: kltheme.cpp:193
KLTheme::name
virtual QString name() const =0
ADD_THEME_NAME
#define ADD_THEME_NAME(themeclass, list)
Definition: kltheme.cpp:211
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
KLThemeFactory::themeList
QStringList themeList() const
Definition: kltheme.cpp:216
KLThemeFactory::instance
static KLThemeFactory * instance()
Definition: kltheme.cpp:183
KLTheme::wordRect
virtual QRect wordRect(const QSize &windowsize) const =0
KLThemeFactory::buildTheme
KLTheme * buildTheme(int id) const
Definition: kltheme.cpp:197
KLTheme::~KLTheme
virtual ~KLTheme()
Definition: kltheme.cpp:29
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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:13 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
  • Namespace List
  • 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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