OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
state.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2014 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 
20 #ifndef PYTHON_SHELL_STATE_HH
21 #define PYTHON_SHELL_STATE_HH
22 
23 #include <QObject>
24 #include <QList>
25 
26 //fw decl
27 class QKeyEvent;
28 class QMouseEvent;
29 
30 namespace ost { namespace gui {
31 
32 //fw decl
33 class SignalTransition;
34 class MouseEventTransition;
35 class KeyEventTransition;
36 class AutomaticTransition;
37 
38 class State: public QObject{
39 Q_OBJECT
40 public:
41  State();
42  void addTransition(SignalTransition * transition);
43  void addTransition(MouseEventTransition * transition);
44  void addTransition(KeyEventTransition* transition);
45  void addTransition(AutomaticTransition* transition);
46  bool isActive();
47  void setActive();
48  bool checkEvent(QKeyEvent* event);
49  bool checkEvent(QMouseEvent* event);
51  virtual void onEntry();
52  virtual void onExit();
53 signals:
54  void entered();
55  void exited();
56 protected:
57  QList<MouseEventTransition*> mouse_event_transitions_;
58  QList<KeyEventTransition*> key_event_transitions_;
59  QList<AutomaticTransition*> automatic_transitions_;
60 };
61 
62 
63 }}//ns
64 #endif // PYTHON_SHELL_STATE_HH
void addTransition(SignalTransition *transition)
QList< MouseEventTransition * > mouse_event_transitions_
Definition: state.hh:57
QList< KeyEventTransition * > key_event_transitions_
Definition: state.hh:58
virtual void onEntry()
bool checkAutomaticTransitions()
virtual void onExit()
QList< AutomaticTransition * > automatic_transitions_
Definition: state.hh:59
bool checkEvent(QKeyEvent *event)