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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
/*
This file is part of the TDE games library
Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
// this class was shamelessy stolen from tdelibs/tdeui/kstdction.[cpp|h] and
// after that just edited for our needs
#ifndef KSTDGAMEACTION_H
#define KSTDGAMEACTION_H
class KAction;
class KToggleAction;
class TQObject;
class KActionCollection;
class KRecentFilesAction;
class KSelectAction;
#include <kdemacros.h>
//-----------------------------------------------------------------------------
/**
* Replacement for KStdAction for TDE Games
*
* This class is an extension to the usual KStdAction class which provides
* easy access to often used KDE actions
*
* Games often use different menu entries than other programs, e.g. games use
* the menu "game" instead of "file". This class provides the entries which
* differ from the usual KStdAction entries.
*
* @see KStdAction
*
* @author Andreas Beckermann <b_mann@gmx.de>
*/
// #### KDE4: transform in namespace
class KDE_EXPORT KStdGameAction
{
public:
/**
* The standard menubar and toolbar actions.
**/
enum StdGameAction {
// Game menu
New=1, Load, LoadRecent, Save, SaveAs, End, Pause, Highscores,
Print, Quit,
// Move menu
Repeat, Undo, Redo, Roll, EndTurn,
// Settings menu
Carddecks,
ChooseGameType, // @since 3.2
ConfigureHighscores, // @since 3.2
Restart, // @since 3.2
Hint, // @since 3.2
Demo, // @since 3.2
Solve, // @since 3.2
ActionNone // @since 3.2
};
KStdGameAction();
~KStdGameAction();
/**
* Creates an action corresponding to the
* KStdAction::StdAction enum.
* @since 3.2
*/
static KAction* create( StdGameAction id, const char *name,
const TQObject *recvr, const char *slot,
KActionCollection* parent );
/**
* @since 3.2
*/
static KAction* create( StdGameAction id,
const TQObject *recvr, const char *slot,
KActionCollection* parent )
{ return create( id, 0, recvr, slot, parent ); }
/**
* Retrieve the action corresponding to the
* KStdGameAction::StdGameAction enum.
* @deprecated
*/
static KAction *action(StdGameAction act_enum, const TQObject *recvr = 0,
const char *slot = 0, KActionCollection *parent = 0,
const char *name = 0L );
/**
* This will return the internal name of a given standard action.
* @since 3.2
*/
static const char* name( StdGameAction id );
/**
* This will return the internal name of a given standard action.
* @deprecated
*/
static const char* stdName(StdGameAction act_enum);
/**
* Start a new game
**/
static KAction *gameNew(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Load a previousely saved game
*/
static KAction *load(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Load a recently loaded game.
*/
static KRecentFilesAction *loadRecent(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Save the current game.
*/
static KAction *save(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Save the current game under a different filename.
*/
static KAction *saveAs(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Pause the game
**/
static KToggleAction *pause(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Show the highscores.
*/
static KAction *highscores(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* End the current game, but do not quit the program. Think of a "close"
* entry.
*/
static KAction *end(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Print the current screen? Game? Whatever - hardly used in games but there
* is at least one example (ktuberling)
*/
static KAction *print(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Quit the game.
*/
static KAction *quit(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Repeat the last move.
**/
static KAction *repeat(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Undo the last move
**/
static KAction *undo(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Redo the last move (which has been undone)
**/
static KAction *redo(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Roll die or dice
**/
static KAction *roll(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* End the current turn (not the game). Usually to let the next player
* start
**/
static KAction *endTurn(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Display configure carddecks dialog.
*/
static KAction *carddecks(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Display configure highscores dialog.
* @since 3.2
*/
static KAction *configureHighscores(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Give an advice/hint.
* @since 3.2
*/
static KAction *hint(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Show a demo.
* @since 3.2
*/
static KToggleAction *demo(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Solve the game.
* @since 3.2
*/
static KAction *solve(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Choose game type.
* @since 3.2
*/
static KSelectAction *chooseGameType(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
/**
* Restart game.
* @since 3.2
*/
static KAction *restart(const TQObject *recvr = 0, const char *slot = 0,
KActionCollection *parent = 0, const char *name = 0L );
};
#endif
|