klettres
klettresview.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2001-2007 by Anne-Marie Mahfouf * 00003 * annemarie.mahfouf@free.fr * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef KLETTRESVIEW_H 00022 #define KLETTRESVIEW_H 00023 00024 #include <KLineEdit> 00025 00026 class QPixmap; 00027 class QRect; 00028 class QSvgRenderer; 00029 class KLettres; 00030 class KLTheme; 00031 00042 class KLettresView : public QWidget 00043 { 00044 Q_OBJECT 00045 public: 00049 explicit KLettresView(KLettres *parent); 00050 00054 virtual ~KLettresView(); 00056 void enterLetter(QString letter) { m_letterEdit->setText(letter); } 00057 00059 int m_timer; 00061 int randomInt; 00063 KLettres *m_klettres; 00065 KLineEdit *m_letterEdit; 00067 void setTheme(KLTheme *theme); 00068 00069 protected: 00071 int m_cursorPos; 00073 int m_random; 00075 int m_length; 00077 void chooseSound(); 00079 QString m_currentLetter; 00081 QString m_upperLetter; 00083 void paintEvent( QPaintEvent * ); 00084 //Paint the background picture 00085 void paintBackground(QPainter &p, const QRect& rect); 00087 void paintLetter(QPainter &p, const QRect& rect); 00089 KLTheme *m_theme; 00090 00091 // Graphics ---------------- 00092 QSvgRenderer *m_renderer; 00093 QPixmap m_backgroundCache; 00094 00095 public slots: 00097 void game(); 00098 00099 protected slots: 00101 void slotPlayAgain(); 00102 00103 void slotProcess(const QString &inputLetter); 00104 00105 void slotTimerDone(); 00106 00107 }; 00108 00109 #endif // KLETTRESVIEW_H
KDE 4.0 API Reference