OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
transition.hh
Go to the documentation of this file.
1 #ifndef PYTHON_SHELL_TRANSITION_HH
2 #define PYTHON_SHELL_TRANSITION_HH
3 
4 #include <utility>
6 
7 #include <QObject>
8 #include <QEvent>
9 #include "transition_guard.hh"
10 //fw decl
11 class QKeyEvent;
12 class QMouseEvent;
13 
14 namespace ost { namespace gui {
15 
16 //fw decl
17 class State;
18 class PythonShellWidget;
19 class ShellHistory;
20 
21 class TransitionBase: public QObject{
22 Q_OBJECT
23 public:
24  TransitionBase(State* target, TransitionGuard* guard=new TransitionGuard());
25 signals:
26  void triggered();
27 protected:
28  void trigger_();
29  bool is_active_();
32 };
33 
35 Q_OBJECT
36 public:
38  bool checkTransition();
39 };
40 
42 Q_OBJECT
43 public:
44  SignalTransition(QObject * sender,const char * signal, State* target, TransitionGuard* guard=new TransitionGuard());
45 protected slots:
46  void onSignal();
47 };
48 
50 Q_OBJECT
51 public:
52  KeyEventTransition(int key,Qt::KeyboardModifiers modifiers, State* target, bool swallow_event=true, TransitionGuard* guard=new TransitionGuard());
53  virtual std::pair<bool,bool> checkEvent(QKeyEvent* event);
54 protected:
55  int key_;
56  Qt::KeyboardModifiers modifiers_;
57  bool swallow_;
58 };
59 
61 Q_OBJECT
62 public:
63  MouseEventTransition(QEvent::Type type,Qt::MouseButton button,Qt::KeyboardModifiers modifiers, State* target, bool swallow_event=true, TransitionGuard* guard=new TransitionGuard());
64  virtual std::pair<bool,bool> checkEvent(QMouseEvent* event);
65 protected:
67  Qt::MouseButton button_;
68  Qt::KeyboardModifiers modifiers_;
69  bool swallow_;
70 };
71 
72 
73 
74 
75 }}//ns
76 #endif // PYTHON_SHELL_TRANSITION_HH