summaryrefslogtreecommitdiffstats
path: root/ktuberling/toplevel.h
blob: 04ceaa96602ca49d6a8eb87b792fa67b90b39b23 (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
/* -------------------------------------------------------------
   KDE Tuberling
   Top level window
   mailto:e.bischoff@noos.fr
 ------------------------------------------------------------- */


#ifndef _TOPLEVEL_H_
#define _TOPLEVEL_H_

#include <kmainwindow.h>
#include <kurl.h>

class TQDomDocument;
class PlayGround;
class SoundFactory;

class TopLevel : public KMainWindow
{
  Q_OBJECT
  TQ_OBJECT

public:

  TopLevel();
  ~TopLevel();

  void open(const KURL &url);
  void enableUndo(bool enable) const;
  void enableRedo(bool enable) const;
  void registerGameboard(const TQString &menuItem, const char *actionId);
  void registerLanguage(const TQString &menuItem, const char *actionId, bool enabled);
  void changeGameboard(uint newGameboard);
  void changeLanguage(uint newLanguage);
  bool loadLayout(TQDomDocument &tqlayoutDocument);
  void playSound(const TQString &ref) const;

  inline bool isSoundEnabled() const {return soundEnabled;}
  inline uint getSelectedGameboard() const {return selectedGameboard;}

protected:

  void readOptions();
  void writeOptions();
  void setupKAction();

private slots:

  void fileNew();
  void fileOpen();
  void fileSave();
  void filePicture();
  void filePrint();
  void editCopy();
  void editUndo();
  void editRedo();
  void gameboard0();
  void gameboard1();
  void gameboard2();
  void gameboard3();
  void gameboard4();
  void gameboard5();
  void gameboard6();
  void gameboard7();
  void soundOff();
  void language0();
  void language1();
  void language2();
  void language3();
  void language4();
  void language5();
  void language6();
  void language7();
  void language8();
  void language9();
  void language10();
  void language11();
  void language12();
  void language13();
  void language14();
  void language15();

private:

  int                           // Menu items identificators
      newID, openID, saveID, pictureID, printID, quitID,
      copyID, undoID, redoID,
      gameboardID, speechID;
  enum {                        // Tool bar buttons identificators
      ID_NEW, ID_OPEN, ID_SAVE, ID_PRINT,
      ID_UNDO, ID_REDO,
      ID_HELP };

  bool soundEnabled;            // True if the sound is enabled by user, even if there is no audio server
  uint selectedGameboard,	// Number of currently selected gameboard
       gameboards;		// Total number of gameboards
  uint selectedLanguage,	// Number of selected language
       languages;		// Total number of languages
  TQString gameboardActions[8],	// Name of actions for registered gameboards
          languageActions[16];	// Name of actions for registered languages

  PlayGround *playGround;	// Play ground central widget
  SoundFactory *soundFactory;	// Speech organ
};

#endif