summaryrefslogtreecommitdiffstats
path: root/knights/knights.h
blob: 4eb9989b77d2f77d2e3eb2dbd46e1545315e9266 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/***************************************************************************
                          knights.h  -  description
                             -------------------
    begin                : Thu Mar  1 10:43:51 CST 2001
    copyright            : (C) 2003 by Troy Corbin Jr.
    email                : tcorbin@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KNIGHTS_H
#define KNIGHTS_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

/* KDEBase */
#include <kapp.h>
#include <tdemainwindow.h>
#include <khelpmenu.h>
#include <tdeaboutdata.h>
#include <kstatusbar.h>
#include <tdecmdlineargs.h>
/* QT */
#include <tqlayout.h>
#include <tqwidget.h>
#include <tqpixmap.h>
#include <tqstring.h>
/* Local */
#include "definitions.h"
#include "resource.h"
#include "accel.h"

class KMenuBar;
class TDEPopupMenu;
class KComboBox;
class TQLabel;
class TQFrame;
class dlg_settings;
class dlg_newmatch;
class core;
class splash;

/**
		Knights is the top-level widget of the project.
		It is responsable for creating the menu bar and it's contents,
		as well as creating an instance of the game itself ( class Grid )
**/
class Knights : public TDEMainWindow
{
  Q_OBJECT
  
  public:
		TDEAboutData			*aboutData;
		resource				*Resource;

								    Knights( TDECmdLineArgs *Args, TQWidget* parent=0, const char *name=0 );
								    ~Knights();
		bool						init( void );
		void						initMenus( void );
		void						BirthAll( void );
		void						keyPressEvent( TQKeyEvent* );

	public slots:
		void						KillAll( void );
		void						menuClose( void );
		/**		Yeah, they're sloppy, but I need my own geometry managment routines
					because I don't like the "default" look my statusbar was getting
					( double-height ). Plus, I want the console to appear only when needed. */
		void						resizeMainFrame( void );

		bool						event( TQEvent* );
		void						resizeEvent( TQResizeEvent* );
		void						hideEvent( TQHideEvent* );
		void						showEvent( TQShowEvent* );
		void						wheelEvent( TQWheelEvent* );

		void						setStatusBar( const int &ID, const TQString& MSG=TQString() );

		void						setClocks( void );
		void						initMatch( void );

		void						setNotation( void );
		void						PrevNotation( void );
		void						NextNotation( void );

		void						SelectTheme( int boardIndex, int chessmenIndex );
		void						Settings( int opt );
		void						openSettingsDialog( void );
		void						openNewMatchDialog( void );
		void						openKeyBindingDialog( void );
		bool						SaveGame( void );
		bool						SaveGamePrompt( void );
		bool						SaveGameAs( void );

		void						netConnect( void );

	signals:
		void						themesAdded( void );
		void						focus( const TQChar& );

	protected:
		bool						queryClose( void );

	protected slots:
		void						boardSmaller( void );
		void						boardBigger( void );
		void						installThemes( void );
		void						newMatch( void );

	private:
		TDECmdLineArgs 		*args;
		KMenuBar				*topMenu;
		TDEPopupMenu			*help;
		TDEPopupMenu			*fileMenu;
		TDEPopupMenu			*settingsMenu;
		TDEPopupMenu			*matchMenu;
		TDEPopupMenu			*drawMenu;
		TDEPopupMenu			*tutorialMenu;
		KComboBox				*notationBar;
		TQFrame					*MainFrame;
		TQLabel					*whiteTimeLabel;
		TQLabel					*blackTimeLabel;
		TQLabel					*Message;
		dlg_settings		*SettingsDialog;
		dlg_newmatch		*NewMatch;
		core						*Core;
		splash					*SplashScreen;
		Accel						*myAccel;

		int							NotationIndex;
		bool						InitAll;
		bool						Minimized;
		bool						ResizeFlag;
		int							margin;
};

#endif