summaryrefslogtreecommitdiffstats
path: root/kgoldrunner/src/kgrdialog.h
blob: 1e62a3eb3c1ede9507923ac0ae3800cdf4c293e9 (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/***************************************************************************
 *   Copyright (C) 2003 by Ian Wadham and Marco Krüger                     *
 *   ianw2@optusnet.com.au                                                  *
 *                                                                         *
 *   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 KGRDIALOG_TQT_H
#define KGRDIALOG_TQT_H

// If portable version, use TQDialog and TQMessageBox.
// If KDE version, use KDialogBase and KMessageBox.

#ifdef KGR_PORTABLE
#include <tqdialog.h>
#define KGR_DIALOG TQDialog
#include <tqmessagebox.h>

#else
#include <klocale.h>
#include <kdialogbase.h>
#define KGR_DIALOG KDialogBase
#include <kmessagebox.h>
#endif

#include <tqlayout.h>

#include <tqlistbox.h>
#include <tqscrollbar.h>
#include <tqlineedit.h>
#include <tqhbox.h>
#include <tqpushbutton.h>
#include <tqbuttongroup.h>
#include <tqradiobutton.h>
#ifdef QT3
#include <tqtextedit.h>
#else
#include <tqmultilineedit.h>
#endif

#include <tqptrlist.h>

/**
@author Ian Wadham and Marco Krüger
*/

class KGrCanvas;
class KGrGame;
class KGrCollection;
class KGrThumbNail;

/******************************************************************************/
/*******************    DIALOG TO SELECT A GAME AND LEVEL   *******************/
/******************************************************************************/

class KGrSLDialog : public KGR_DIALOG	// KGR_PORTABLE sets TQDialog/KDialogBase
{
Q_OBJECT
  
public:
    KGrSLDialog (int action, int requestedLevel, int collnIndex,
			TQPtrList<KGrCollection> & gamesList, KGrGame * theGame,
			TQWidget * parent = 0, const char *name = 0);
    ~KGrSLDialog();

    int selectedLevel()	{return (number->value());}
    int selectedGame()	{return (slCollnIndex);}

private slots:
    void slSetCollections (int cIndex);
    void slColln (int i);
    void slAboutColln ();
    void slShowLevel (int i);
    void slUpdate (const TQString & text);
    void slPaintLevel ();
    void slotHelp ();				// Will replace KDE slotHelp().

private:
    int			slAction;
    TQPtrList<KGrCollection> collections;	// List of games.
    int			defaultLevel;
    int			defaultGame;
    int			slCollnIndex;
    KGrGame *		game;
    KGrCollection *	collection;
    TQWidget *		slParent;

    TQLabel *		collnL;
    TQListBox *		colln;
    TQLabel *		collnN;
    TQLabel *		collnD;
    TQPushButton *	collnA;

    TQLabel *		numberL;
    TQLineEdit *		display;
    TQScrollBar *	number;
    TQPushButton *	levelNH;
    TQLabel *		slName;
    KGrThumbNail *	thumbNail;

#ifdef KGR_PORTABLE
    TQPushButton *	OK;
    TQPushButton *	HELP;
    TQPushButton *	CANCEL;
#endif
};

/*******************************************************************************
*************** DIALOG BOX TO CREATE/EDIT A LEVEL NAME AND HINT ****************
*******************************************************************************/

class KGrNHDialog : public KGR_DIALOG	// KGR_PORTABLE sets TQDialog/KDialogBase
{
Q_OBJECT
  
public:
    KGrNHDialog (const TQString & levelName, const TQString & levelHint,
			TQWidget * parent = 0, const char * name = 0);
    ~KGrNHDialog();

    TQString	getName()	{return (nhName->text());}
    TQString	getHint()	{return (mle->text());}

private:
    TQLineEdit *	nhName;
#ifdef QT3
    TQTextEdit *	mle;
#else
    TQMultiLineEdit * mle;
#endif
};

/*******************************************************************************
***************** DIALOG TO CREATE OR EDIT A GAME (COLLECTION) *****************
*******************************************************************************/

class KGrECDialog : public KGR_DIALOG	// KGR_PORTABLE sets TQDialog/KDialogBase
{
Q_OBJECT
  
public:
    KGrECDialog (int action, int collnIndex,
			TQPtrList<KGrCollection> & gamesList,
			TQWidget *parent = 0, const char *name = 0);
    ~KGrECDialog();

    TQString	getName()	{return (ecName->text());}
    TQString	getPrefix()	{return (ecPrefix->text());}
    bool	isTrad()	{return (ecTradB->isChecked());}
    TQString	getAboutText()	{return (mle->text());}

private slots:
    void ecSetRules (const char settings);
    void ecSetKGr();	// Radio button slots.
    void ecSetTrad();

private:
    TQPtrList<KGrCollection> collections;	// List of existing games.
    int			defaultGame;

    TQLabel *		nameL;
    TQLineEdit *		ecName;
    TQLabel *		prefixL;
    TQLineEdit *		ecPrefix;
    TQButtonGroup *	ecGrp;
    TQRadioButton *	ecKGrB;
    TQRadioButton *	ecTradB;
    TQLabel *		nLevL;

    TQLabel *		mleL;
#ifdef QT3
    TQTextEdit *		mle;
#else
    TQMultiLineEdit *	mle;
#endif

#ifdef KGR_PORTABLE
    TQPushButton *	OK;
    TQPushButton *	CANCEL;
#endif
};

/*******************************************************************************
***************  DIALOG TO SELECT A SAVED GAME TO BE RE-LOADED  ****************
*******************************************************************************/

#include <tqfile.h>
#include <tqtextstream.h>

class KGrLGDialog : public KGR_DIALOG	// KGR_PORTABLE sets TQDialog/KDialogBase
{
Q_OBJECT
  
public:
    KGrLGDialog (TQFile * savedGames, TQPtrList<KGrCollection> & collections,
			TQWidget * parent, const char * name);
    TQString getCurrentText() {return (lgList->currentText());}

private slots:
    void lgSelect (int n);

private:
    TQListBox * lgList;
    int lgHighlight;
};

/*******************************************************************************
******************  PORTABLE MESSAGE FUNCTIONS (TQt Version)  *******************
*******************************************************************************/

class KGrMessage : public TQDialog
{
public:
    static void information (TQWidget * parent, const TQString &caption, const TQString &text);
    static int warning (TQWidget * parent, TQString caption, TQString text,
			TQString label0, TQString label1, TQString label2 = "");
    static void wrapped (TQWidget * parent, TQString caption, TQString text);
};

#endif