fix i18nc typo in last commit
[kdeaccessibility.git] / ksayit / src / ksayitsystemtray.h
blobd9e0cc9e14e2b32d3169b5fa781596be7757be76
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 <QtGui/QWidget>
23 #include <QtGui/QPixmap>
24 #include <QtGui/QMouseEvent>
26 // KDE includes
27 #include <ksystemtray.h>
28 #include <kmenu.h>
29 #include <kaction.h>
30 #include <kmenubar.h>
31 #include <khelpmenu.h>
32 #include <kiconloader.h>
34 // forward declarations
35 class State;
37 /**
38 *@author Robert Vogl
40 class KSayItSystemTray : public KSystemTray {
41 Q_OBJECT
43 friend class State;
45 public:
46 KSayItSystemTray(QWidget *parent=0, const char *name=0);
47 ~KSayItSystemTray();
49 signals:
50 /** Signal emitted if configuration has been changed
52 void signalCallPreferences();
54 /** Signal emitted if the Tray icon was clicked.
56 void signalSayClipboard();
58 /** Signal emitted by the control actions
60 void signalSayActivated();
62 void signalShutUpActivated();
64 void signalPauseActivated();
66 void signalNextActivated();
68 void signalPrevActivated();
70 public slots:
71 /** opens the Preferences-Dialog
73 void slotPreferences();
75 /** activated if "say" was clicked
77 void slotSayActivated();
79 /** activated if "shut up" was clicked
81 void slotStopActivated();
83 /** activated if "pause" was clicked
85 void slotPauseActivated();
87 /** activated if "next sentence" was clicked
89 void slotNextSentenceActivated();
91 /** activated if "previous sentence" was clicked
93 void slotPrevSentenceActivated();
95 public:
96 /** Changes the state of the statemachine
98 void changeState(State *state);
100 /** Enables/Diasabled the actions in the menu
102 void setActions(bool sayEnabled, bool pauseEnabled, bool shutupEnabled,
103 bool nextEnabled, bool prevEnabled);
105 protected: // Methods
106 /** Reimplementation from base class
108 void mousePressEvent(QMouseEvent *);
110 /** Reimplementation from base class
112 void mouseReleaseEvent(QMouseEvent *);
114 /** KSystemTray default mouse handling
116 void normalMousePressEvent(QMouseEvent *e);
118 /** KSystemTray default mouse handling
120 void normalMouseReleaseEvent(QMouseEvent *e);
122 /** Called if the Tray icon was clicked.
124 void sayClipboard();
126 private: // Methods
127 /** initializes the KActions of the application */
128 void initActions();
130 public:
131 KAction *say;
132 KAction *shutup;
133 KAction *pause;
134 KAction *next_sentence;
135 KAction *prev_sentence;
137 private:
138 KMenu *menu;
139 KHelpMenu *help;
140 KAction *settings;
141 KAction *help_about;
142 KAction *help_kde;
143 State *_state;
150 class State : public KSystemTray {
151 Q_OBJECT
152 public:
153 State();
154 ~State();
156 virtual void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
157 virtual void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
158 virtual void setContext(KSayItSystemTray *caller);
160 protected:
161 void changeState(KSayItSystemTray *caller, State *state);
162 void say(KSayItSystemTray *caller);
163 void mousePressEventCall(KSayItSystemTray *caller, QMouseEvent *e);
164 void mouseReleaseEventCall(KSayItSystemTray *caller, QMouseEvent *e);
170 class StateWAIT : public State {
172 public:
173 static StateWAIT* Instance();
174 ~StateWAIT();
176 protected:
177 StateWAIT();
178 void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
179 void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
180 void setContext(KSayItSystemTray *caller);
182 private:
183 static StateWAIT *_instance;
184 QPixmap m_traypixmap;
190 class StateSAY : public State {
192 public:
193 static StateSAY* Instance();
194 ~StateSAY();
196 protected:
197 StateSAY();
198 void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
199 void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
200 void setContext(KSayItSystemTray *caller);
202 private:
203 static StateSAY *_instance;
204 QPixmap m_traypixmap;
210 class StateCLIPEMPTY : public State {
212 public:
213 static StateCLIPEMPTY* Instance();
214 ~StateCLIPEMPTY();
216 protected:
217 StateCLIPEMPTY();
218 void mousePressEvent(KSayItSystemTray *caller, QMouseEvent *e);
219 void mouseReleaseEvent(KSayItSystemTray *caller, QMouseEvent *e);
220 void setContext(KSayItSystemTray *caller);
222 private:
223 static StateCLIPEMPTY *_instance;
224 QPixmap m_traypixmap;
228 #endif