Warning, file /education/khangman/src/khmtheme.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  *   Copyright (C) 2007-2010 Pino Toscano <pino@kde.org>                   *
0003  *   Updated by Adam Rakowski <foo-script@o2.pl> (GSoC 2010)               *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 
0021 //project headers
0022 #include "khmtheme.h"
0023 
0024 #include <KLocalizedString>
0025 
0026 KHMTheme::KHMTheme( const QString &name, const QString &uiName, const QString &svgFileName, const QString &author, const QString &themeVersion,
0027             QRect wordRect, QRect hintRect, QRect kRect,
0028             QColor letterColor, QColor guessButtonTextColor, QColor guessButtonColor, QColor guessButtonHoverColor, QColor letterInputTextColor,
0029             QPoint goodWordPos)
0030     :KHMname(name),
0031       KHMuiName(uiName),
0032       KHMsvgFileName(svgFileName),
0033       KHMauthor(author),
0034       KHMthemeVersion(themeVersion),
0035       KHMwordRect(wordRect),
0036       KHMhintRect(hintRect),
0037       KHMkRect(kRect),
0038       KHMletterColor(letterColor),
0039       KHMguessButtonTextColor(guessButtonTextColor),
0040       KHMguessButtonColor(guessButtonColor),
0041       KHMguessButtonHoverColor(guessButtonHoverColor),
0042       KHMletterInputTextColor(letterInputTextColor),
0043       KHMgoodWordPos(goodWordPos)
0044 {
0045 }
0046 
0047 QString KHMTheme::uiName() const
0048 {
0049     return i18n(KHMuiName.toLatin1().constData());
0050 }
0051 
0052 QRect KHMTheme::wordRect(const QSize& windowsize) const
0053 {
0054     return QRect(windowsize.width()*KHMwordRect.x()/10000,    windowsize.height()*KHMwordRect.y()/10000,
0055            windowsize.width()*KHMwordRect.width()/10000,    windowsize.height()*KHMwordRect.height()/10000);
0056 }
0057 
0058 QRect KHMTheme::hintRect(const QSize& windowsize) const
0059 {
0060     return QRect(windowsize.width()*KHMhintRect.x()/10000,    windowsize.height()*KHMhintRect.y()/10000,
0061            windowsize.width()*KHMhintRect.width()/10000,    windowsize.height()*KHMhintRect.height()/10000);
0062 }
0063 
0064 QRect KHMTheme::kRect(const QSize& windowsize) const
0065 {
0066     return QRect(windowsize.width()*KHMkRect.x()/10000,       windowsize.height()*KHMkRect.y()/10000,
0067             windowsize.width()*KHMkRect.width()/10000,       windowsize.height()*KHMkRect.height()/10000);
0068 }
0069 
0070 QPoint KHMTheme::goodWordPos(const QSize& windowsize, const QPoint& popupPos) const  //works good
0071 {
0072     return QPoint(popupPos.x() + windowsize.width()*KHMgoodWordPos.x()/10000,
0073                     popupPos.y() + windowsize.height()*KHMgoodWordPos.y()/10000);
0074 }
0075 
0076 // kate: space-indent on; tab-width 4; indent-width 4; mixed-indent off; replace-tabs on;
0077 // vim: set et sw=4 ts=4 cino=l1,cs,U1:
0078