OpenStructure
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-2020 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);
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
QList< MouseEventTransition * > mouse_event_transitions_
Definition: state.hh:57
bool checkEvent(QMouseEvent *event)
bool checkAutomaticTransitions()
bool checkEvent(QKeyEvent *event)
virtual void onEntry()
void addTransition(MouseEventTransition *transition)
void addTransition(SignalTransition *transition)
QList< AutomaticTransition * > automatic_transitions_
Definition: state.hh:59
void addTransition(KeyEventTransition *transition)
QList< KeyEventTransition * > key_event_transitions_
Definition: state.hh:58
virtual void onExit()
void addTransition(AutomaticTransition *transition)
Definition: base.dox:1