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

klettres

kltheme.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) Copyright (C) 2007      Pino Toscano <pino@kde.org>                                            *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program; if not, write to the                         *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
00018  ***************************************************************************/
00019 
00020 //project headers
00021 #include "kltheme.h"
00022 
00023 #include <KLocale>
00024 
00025 KLTheme::KLTheme()
00026 {
00027 }
00028 
00029 KLTheme::~KLTheme()
00030 {
00031 }
00032 
00034 class KLThemeKid : public KLTheme
00035 {
00036 public:
00037     KLThemeKid()
00038         : KLTheme()
00039     {
00040     }
00041 
00042     virtual QString name() const
00043     {
00044         return "kids";
00045     }
00046 
00047     virtual QString uiName() const
00048     {
00049         return i18nc("@item:inlistbox", "Kid");
00050     }
00051 
00052     virtual QString svgFileName() const
00053     {
00054         return "klettres_kids.svg";
00055     }
00056 
00057     virtual QColor letterColor() const
00058     {
00059         return QColor(215, 215, 215); 
00060     }
00061 
00062     virtual QColor backgroundInputColor() const
00063     {
00064         return QColor(187, 76, 58); 
00065     }
00066 
00067     virtual QColor letterInputColor() const
00068     {
00069         return QColor(215, 215, 215); 
00070     }
00071 
00072     virtual QRect wordRect(const QSize& windowsize) const
00073     {
00074         return QRect(windowsize.width()*200/800, windowsize.height()*200/600, 250, 160);
00075     }
00076 
00077     virtual QRect inputRect(const QSize& windowsize) const
00078     {
00079         return QRect(windowsize.width()*188/800, windowsize.height()*468/600, 25, 90);
00080     }
00081 };
00082 
00084 class KLThemeDesert : public KLTheme
00085 {
00086 public:
00087     KLThemeDesert()
00088         : KLTheme()
00089     {
00090     }
00091 
00092     virtual QString name() const
00093     {
00094         return "desert";
00095     }
00096 
00097     virtual QString uiName() const
00098     {
00099         return i18nc("@item:inlistbox desert theme for the interface", "Desert");
00100     }
00101 
00102     virtual QString svgFileName() const
00103     {
00104         return "klettres_desert.svg";
00105     }
00106 
00107     virtual QColor letterColor() const
00108     {
00109         return QColor(115, 50, 95); 
00110     }
00111 
00112     virtual QColor backgroundInputColor() const
00113     {
00114         return QColor(202, 217, 84); 
00115     }
00116 
00117     virtual QColor letterInputColor() const
00118     {
00119         return QColor(141, 80, 17); 
00120     }
00121 
00122     virtual QRect wordRect(const QSize& windowsize) const
00123     {
00124     return QRect(windowsize.width()*230/800, windowsize.height()*140/600, 250, 160);
00125     }
00126 
00127     virtual QRect inputRect(const QSize& windowsize) const
00128     {
00129         return QRect(windowsize.width()*380/800, windowsize.height()*480/600, 250, 160);
00130     }
00131 };
00132 
00134 class KLThemeSavannah : public KLTheme
00135 {
00136 public:
00137     KLThemeSavannah()
00138         : KLTheme()
00139     {
00140     }
00141 
00142     virtual QString name() const
00143     {
00144         return "savannah";
00145     }
00146 
00147     virtual QString uiName() const
00148     {
00149         return i18nc("@item:inlistbox", "Savannah");
00150     }
00151 
00152     virtual QString svgFileName() const
00153     {
00154         return "klettres_savannah.svg";
00155     }
00156 
00157     virtual QColor letterColor() const
00158     {
00159         return QColor(215, 215, 215); 
00160     }
00161 
00162     virtual QColor backgroundInputColor() const
00163     {
00164         return QColor(196, 189, 94); 
00165     }
00166 
00167     virtual QColor letterInputColor() const
00168     {
00169         return QColor(141, 80, 17); 
00170     }
00171 
00172     virtual QRect wordRect(const QSize& windowsize) const
00173     {
00174         return QRect(windowsize.width()*230/800, windowsize.height()*80/600, 250, 160);
00175     }
00176 
00177     virtual QRect inputRect(const QSize& windowsize) const
00178     {
00179         return QRect(windowsize.width()*540/800, windowsize.height()*480/600, 250, 160);
00180     }
00181 };
00182 
00183 KLThemeFactory* KLThemeFactory::instance()
00184 {
00185     static KLThemeFactory factory;
00186     return &factory;
00187 }
00188 
00189 KLThemeFactory::KLThemeFactory()
00190 {
00191 }
00192 
00193 KLThemeFactory::~KLThemeFactory()
00194 {
00195 }
00196 
00197 KLTheme* KLThemeFactory::buildTheme(int id) const
00198 {
00199     switch (id)
00200     {
00201         case 0:
00202             return new KLThemeKid();
00203         case 1:
00204             return new KLThemeDesert();
00205         case 2:
00206             return new KLThemeSavannah();
00207     }
00208     return 0;
00209 }
00210 
00211 #define ADD_THEME_NAME( themeclass, list ) \
00212 { \
00213    themeclass x; \
00214    list.append( x.uiName() ); \
00215 }
00216 QStringList KLThemeFactory::themeList() const
00217 {
00218     QStringList ret;
00219     ADD_THEME_NAME( KLThemeKid, ret )
00220     ADD_THEME_NAME( KLThemeDesert, ret )
00221     ADD_THEME_NAME( KLThemeSavannah, ret )
00222     return ret;
00223 }
00224 
00225 
00226 
00227 

klettres

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

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal