summaryrefslogtreecommitdiffstats
path: root/kpacman/kpacman.h
blob: e577f38747b60dcfab93bbbacd496e5b27c84c65 (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
/***************************************************************************
                          kpacman.h  -  description
                             -------------------
    begin                : Sam Jan 19 13:37:57 CET 2002
    copyright            : (C) 1998-2003 by Jörg Thönnissen
    email                : joe@dsite.de
 ***************************************************************************/

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


#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

// include files for TQt
#include <tqptrlist.h>
#include <tqfileinf.h>
#include <tqregexp.h>

//include files for KDE
#include <kapp.h>
#include <tdemainwindow.h>
#include <tdepopupmenu.h>
#include <tdeaction.h>
#include <tdelocale.h>
#include <tdemenubar.h>

// application specific includes
#include "kpacmanview.h"
#include "referee.h"
#include "status.h"
#include "score.h"
#include "keys.h"

// forward declaration of the Kpacman classes
class KpacmanView;

/**
 * The base class for Kpacman application.
 */
class KpacmanApp : public TDEMainWindow
{
  Q_OBJECT

  friend class KpacmanView;

  public:
    /** constructor of KpacmanApp, calls all init functions to create the application.
     */
    KpacmanApp(TQWidget *parent = 0, const char *name = 0);
    virtual ~KpacmanApp();

  protected:
    /** save general Options like all bar positions and status as well as the application specific
     * Options to the configuration file
     */
    void saveOptions();
    /** read general Options again and initialize all variables
     */
    void readOptions();
    /** read graphic schemes and build menu items for selection
     */
    void readSchemes();
    /** initializes the TDEActions of the application */
    void initActions();
    /** sets up the statusbar for the main window by initialzing a statuslabel.
     */
    void initStatusBar();
    /** creates the centerwidget of the KTMainWindow instance and sets it as the view
     */
    void initView();
    /** queryExit is called by KTMainWindow when the last window of the application is going to be closed
     * during the closeEvent().
     * Against the default implementation that just returns true, this calls saveOptions() to save the
     * settings of the window's properties.
     * @see KTMainWindow#queryExit
     * @see KTMainWindow#closeEvent
     */
    virtual bool queryExit();


  public slots:
    /** play new game
     */
    void slotGameNew();
    /** pause (continue) game
     */
    void slotGamePause();
    /** pause (continue) game triggered by focus events
     */
    void slotFocusedGamePause();
    /** toggle the highscores
     */
    void slotGameHighscores();
    /** toggle the highscores, forced by the referee
     */
    void slotForcedGameHighscores();
    /** save the options, then quits the application.
     */
    void slotGameQuit();
    /** toggles the menubar
     */
    void slotShowMenuBar();
    /** toggles the toolbar
     */
    void slotShowToolBar();
    /** toggles the statusbar
     */
    void slotShowStatusBar();
    /** toggles the mousecursor
     */
    void slotShowMouseCursor();
    /** graphic scheme activated
     * @param id the id of the activated/selected menuitem
     */
    void slotSchemeActivated(int id);
    /** toggles the focus out pause
     */
    void slotFocusOutPause();
    /** toggles the focus in continue
     */
    void slotFocusInContinue();
    /** changes the statusbar contents for the standard label permanently, used to indicate current actions.
     * @param text the text that is displayed in the statusbar
     */
    void slotStatusMsg(const TQString &text);
    /** configure keysbindings dialog
     */
    void slotKeyBindings();
    /** game (including highscores displayed) has been finished
     */
    void slotGameFinished();

  private:
    /** the configuration object of the application */
    TDEConfig *config;
    /** view is the main widget which represents your working area. The View
     * class should handle all events of the view widget.  It is kept empty so
     * you can create your view according to your application's needs by
     * changing the view class.
     */
    KpacmanView *view;

    // TDEAction pointers to enable/disable actions
    TDEAction* gameNew;
    TDEToggleAction* gamePause;
    TDEAction* gameHighscores;
    TDEAction* gameQuit;
    TDEToggleAction* showMenuBar;
    TDEToggleAction* showToolBar;
    TDEToggleAction* showStatusBar;
    TDEToggleAction* showMouseCursor;
    TDEToggleAction* focusOutPause;
    TDEToggleAction* focusInContinue;
    TDEActionMenu* selectGraphicScheme;

    // active scheme/mode
    int scheme;
    int mode;

    TDEPopupMenu *modesPopup;						// TDEAction main scheme selection menu
    TQPtrList<TDEPopupMenu> *schemesPopup;	// submenus for selecting scheme

    // ID's of the menuitem(s) for finding/selecting scheme by id
    TQMemArray<int> modeID;
    TQMemArray<int> schemeID;

    TQMemArray<int> schemeMode;						// mode(group) of the schemes, -1 if no group

    bool highscoresChecked;						// highscores display active
    bool focusedPause;								// Pause caused by focusEvents
};

#endif // KPACMAN_H