2 * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of version 2 of the GNU General Public
6 License as published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #ifndef KHANGMANVIEW_H
19 #define KHANGMANVIEW_H
23 #include <krandomsequence.h>
25 #include <keduvocdata.h>
27 * This is the main view class for KHangMan. Most of the non-menu,
28 * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
32 class KHangManView
: public QWidget
37 KHangManView(KHangMan
*parent
=0, const char *name
=0);
39 virtual ~KHangManView();
43 ///Paint the animated hanged K sequence
48 ///true if hint exists
50 ///true if language = es, ca, pt or pt_BR
57 ///The area where the user enter the letter. Upper case is transformed into lower case.
59 ///After you entered a letter in the line edit click this button to see if the letter is in the word or not
60 KPushButton
*guessButton
;
67 void paintEvent( QPaintEvent
* );
68 ///necessary to have it all resize correctly
69 void resizeEvent(QResizeEvent
*);
70 ///set the background pixmap to the QPixmap argument
71 void slotSetPixmap(QPixmap
& );
72 ///Store the missed letters
76 ///store the hint when there is one
79 QString stripWord
, sword
;
82 ///word is the random word to be guessed
84 ///goodWord is the hidden word that is filled in
86 ///how many times you missed, when it reaches 10, you are hanged
88 ///tmp is to check if not twice the same random number
90 ///true if only one instance of each letter is displayed
92 ///true if Type accents is enabled for the languages that support it
94 ///allWords contains all letters already guessed
96 ///If true, the word contains the QString
97 bool containsChar(const QString
&);
98 void replaceLetters(const QString
&);
99 ///the hanged K animation sequence
101 ///Background picture (sea or desert)
103 ///part of Sea background used to repaint word and missed letters
104 QPixmap bluePic
, miss_bluePic
, miss_desertPic
, greenPic
;
105 ///Draw the word to be guessed
107 ///Reset everything to start a new game, missed letters is empty
109 ///Play a game: look for a word to be guessed and load its tip
111 ///Load kvtml file and get a word and its tip in random
113 ///If true, the uppercase and lower case are disctincts (world capitals)
115 ///KDE random generator
116 KRandomSequence random
;
117 ///Enable hints on mouse right click if Hints exist
118 virtual void mousePressEvent(QMouseEvent
*mouse
);
119 ///Paint an already guessed letter in red in Missed Letters
120 void paintMissedTwice();
121 ///Paint an already guessed letter in red in word
122 void paintWordTwice();
123 ///index of the already guessed letter
125 ///load the K animated sequence depending of the theme
126 void loadAnimation();
129 ///paint the Misses label
133 ///if you want to play with a new word
137 ///after you click on Guess button or hit Enter when guessing a new letter, see if the letter is in the word or not
139 ///when an already guessed letter is entered, if it is in Missed, redraw the missed letters area
141 ///when an already guessed letter is entered, if it is in the word, redraw the word area
142 void timerWordDone();
146 * Use this signal to change the content of the statusbar
148 void signalChangeLanguage(int);
149 ///emit this signal to say if this is a kvtml file or not (hints enabled or not)
150 void signalKvtml(bool);
153 #endif // KHANGMANVIEW_H