]> Shamusworld >> Repos - architektonas/blob - src/base/rs_commandevent.h
Initial import
[architektonas] / src / base / rs_commandevent.h
1 #ifndef RS_COMMANDEVENT_H
2 #define RS_COMMANDEVENT_H
3
4 /**
5  * Command Events.
6  */
7 class RS_CommandEvent
8 {
9         public:
10                 /**
11                 * Creates a new command event that is not yet accepted.
12                 *
13                 * @param cmd the command that was triggered.
14                 */
15                 RS_CommandEvent(const QString & cmd)
16                 {
17                         this->cmd = cmd;
18                         accepted = false;
19                 }
20
21                 /**
22                 * @return the command that was triggered, usually by
23                 * the user.
24                 */
25                 QString getCommand()
26                 {
27                         return cmd;
28                 }
29
30                 /**
31                 * Sets the event state to accepted.
32                 */
33                 void accept()
34                 {
35                         accepted = true;
36                 }
37
38                 /**
39                 * @return Whether the event was already accepted or not.
40                 */
41                 bool isAccepted()
42                 {
43                         return accepted;
44                 }
45
46         protected:
47                 QString cmd;
48                 bool accepted;
49 };
50
51 #endif