SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / ksayit / src / ksayitsystemtray.h
blobe994e575dc372d17246ed4bf241631cd76901eae
1 /***************************************************************************
2 ksayitsystemtray.h - description
3 -------------------
4 begin : Die Sep 2 2003
5 copyright : (C) 2003 by Robert Vogl
6 email : voglrobe@saphir
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KSAYITSYSTEMTRAY_H
19 #define KSAYITSYSTEMTRAY_H
21 // QT includes
22 #include <qwidget.h>
23 #include <QPixmap>
24 //Added by qt3to4:
25 #include <QMouseEvent>
27 // KDE includes
28 #include <kapplication.h>
29 #include <ksystemtray.h>
30 #include <kmenu.h>
31 #include <kaction.h>
32 #include <kmenubar.h>
33 #include <khelpmenu.h>
34 #include <kiconloader.h>
36 // forward declarations
37 class State;
39 /**
40 *@author Robert Vogl
42 class KSayItSystemTray : public KSystemTray {
43 Q_OBJECT
45 friend class State;
47 public:
48 KSayItSystemTray(QWidget *parent=0, const char *name=0);
49 ~KSayItSystemTray();
51 signals:
52 /** Signal emitted if configuration has been changed
54 void signalCallPreferences();
56 /** Signal emitted if the Tray icon was clicked.
58 void signalSayClipboard();
60 /** Signal emitted by the control actions
62 void signalSayActivated();
64 void signalShutUpActivated();
66 void signalPauseActivated();
68 void signalNextActivated();
70 void signalPrevActivated();
72 public slots:
73 /** opens the Preferences-Dialog
75 void slotPreferences();
77 /** activated if "say" was clicked
79 void slotSayActivated();
81 /** activated if "shut up" was clicked
83 void slotStopActivated();
85 /** activated if "pause" was clicked
87 void slotPauseActivated();
89 /** activated if "next sentence" was clicked
91 void slotNextSentenceActivated();
93 /** activated if "previous sentence" was clicked
95 void slotPrevSentenceActivated();
97 public:
98 /** Changes the state of the statemachine
100 void changeState(State *state);
102 /** Enables/Diasabled the actions in the menu
104 void setActions(bool sayEnabled, bool pauseEnabled, bool shutupEnabled,
105 bool nextEnabled, bool prevEnabled);
107 protected: // Methods
108 /** Reimplementation from base class
110 void mousePressEvent(QMouseEvent *);
112 /** Reimplementation from base class
114 void mouseReleaseEvent(QMouseEvent *);
116 /** KSystemTray default mouse handling
118 void normalMousePressEvent(QMouseEvent *e);
120 /** KSystemTray default mouse handling
122 void normalMouseReleaseEvent(QMouseEvent *e);
124 /** Called if the Tray icon was clicked.
126 void sayClipboard();
128 private: // Methods
129 /** initializes the KActions of the application */
130 void initActions();
132 public:
133 KAction *say;
134 KAction *shutup;
135 KAction *pause;
136 KAction *next_sentence;
137 KAction *prev_sentence;
139 private:
140 KMenu *menu;
141 KHelpMenu *help;
142 KAction *settings;
143 KAction *help_about;
144 KAction *help_kde;
145 State *_state;
152 class State : public KSystemTray {
153 Q_OBJECT
154 public:
155 State();
156 ~State();
158 virtual void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
159 virtual void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
160 virtual void setContext(KSayItSystemTray *caller);
162 protected:
163 void changeState(KSayItSystemTray *caller, State *state);
164 void say(KSayItSystemTray *caller);
165 void mousePressEventCall(KSayItSystemTray *caller, QMouseEvent *e);
166 void mouseReleaseEventCall(KSayItSystemTray *caller, QMouseEvent *e);
172 class StateWAIT : public State {
174 public:
175 static StateWAIT* Instance();
176 ~StateWAIT();
178 protected:
179 StateWAIT();
180 void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
181 void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
182 void setContext(KSayItSystemTray *caller);
184 private:
185 static StateWAIT *_instance;
186 QPixmap m_traypixmap;
192 class StateSAY : public State {
194 public:
195 static StateSAY* Instance();
196 ~StateSAY();
198 protected:
199 StateSAY();
200 void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
201 void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
202 void setContext(KSayItSystemTray *caller);
204 private:
205 static StateSAY *_instance;
206 QPixmap m_traypixmap;
212 class StateCLIPEMPTY : public State {
214 public:
215 static StateCLIPEMPTY* Instance();
216 ~StateCLIPEMPTY();
218 protected:
219 StateCLIPEMPTY();
220 void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
221 void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
222 void setContext(KSayItSystemTray *caller);
224 private:
225 static StateCLIPEMPTY *_instance;
226 QPixmap m_traypixmap;
230 #endif