summaryrefslogtreecommitdiffstats
path: root/blinken/src/blinken.h
blob: a266b934d1902801c616e3d8840a8f0c9e91bf71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/***************************************************************************
 *   Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es>            *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef BLINKEN_H
#define BLINKEN_H

#include <tqwidget.h>

#include "blinkengame.h"

class TQTimer;

class KAction;
class KHelpMenu;

class button;
class highScoreDialog;

class blinken : public TQWidget
{
Q_OBJECT
  TQ_OBJECT
	public:
		blinken();
		~blinken();
		
	protected:
		void paintEvent(TQPaintEvent *);
		void mouseMoveEvent(TQMouseEvent *e);
		void mousePressEvent(TQMouseEvent *e);
		void keyPressEvent(TQKeyEvent *e);
		void keyReleaseEvent(TQKeyEvent *e);
		
	private slots:
		void checkHS();
		void highlight(blinkenGame::color c, bool unhighlight);
		void unhighlight();
		
		void pressedYellow();
		void pressedRed();
		void pressedGreen();
		void pressedBlue();
		
	private:
		void selectButton(int button);
		bool insideGreen(const TQPoint &p) const;
		bool insideYellow(const TQPoint &p) const;
		bool insideRed(const TQPoint &p) const;
		bool insideBlue(const TQPoint &p) const;
		bool insideButtonsArea(const TQPoint &p) const;
		void updateCursor(const TQPoint &p);
	
		void drawMenuQuit(TQPainter &p);
		void drawScoreAndCounter(TQPainter &p);
		void drawStatusText(TQPainter &p);
		void drawLevel(TQPainter &p);
		void drawText(TQPainter &p, const TQString &text, const TQPoint &center, bool withMargin, int xMargin, int yMargin, TQRect *rect, bool highlight, bool bold);
		void updateButtonHighlighting(const TQPoint &p);
		
		
		button *m_buttons[4];
		TQPixmap *m_back, *m_highscore, *m_highscoreHover, *m_quit, *m_quitHover, *m_menu, *m_menuHover, *m_mark;
		bool m_overHighscore, m_overQuit, m_overCentralText, m_overMenu, m_overAboutKDE, m_overAboutBlinken, m_overManual, m_overLevels[3], m_overCentralLetters, m_overCounter, m_overFont, m_overSound;
		// i obviously suck but m_levelsRect[0] is 2, m_levelsRect[1] is 1 and m_levelsRect[3] is ?
		TQRect m_highscoreRect, m_quitRect, m_centralTextRect, m_menuRect, m_aboutKDERect, m_aboutBlinkenRect, m_manualRect, m_levelsRect[3], m_centralLettersRect, m_counterRect, m_soundRect, m_fontRect;
		TQColor m_fillColor, m_fontColor, m_fontHighlightColor, m_countDownColor;
		
		// Preferences setting handling
		bool m_showPreferences;
		
		// if should update the highlighting after the next repaint
		bool m_updateButtonHighlighting;
		
		// use always the non-cool font?
		bool m_alwaysUseNonCoolFont;
		
		blinkenGame::color m_highlighted;
		TQTimer *m_unhighlighter;
		
		TQString m_lastName;
		
		blinkenGame m_game;
		
		KHelpMenu *m_helpMenu;
};

#endif