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 //------------------------------------------------------------------------------
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_TRANSITION_HH
21 #define PYTHON_SHELL_TRANSITION_HH
22 
24 #include "transition_guard.hh"
25 #include <utility>
26 
27 #include <QObject>
28 #include <QEvent>
29 //fw decl
30 class QKeyEvent;
31 class QMouseEvent;
32 
33 namespace ost { namespace gui {
34 
35 //fw decl
36 class State;
37 class PythonShellWidget;
38 class ShellHistory;
39 
40 class TransitionBase: public QObject{
41 Q_OBJECT
42 public:
43  TransitionBase(State* target, TransitionGuard* guard=new TransitionGuard());
44 signals:
45  void triggered();
46 protected:
47  void trigger_();
48  bool is_active_();
51 };
52 
54 Q_OBJECT
55 public:
57  bool checkTransition();
58 };
59 
61 Q_OBJECT
62 public:
63  SignalTransition(QObject * sender,const char * signal, State* target, TransitionGuard* guard=new TransitionGuard());
64 protected slots:
65  void onSignal();
66 };
67 
69 Q_OBJECT
70 public:
71  KeyEventTransition(int key,Qt::KeyboardModifiers modifiers, State* target, bool swallow_event=true, TransitionGuard* guard=new TransitionGuard());
72  virtual std::pair<bool,bool> checkEvent(QKeyEvent* event);
73 protected:
74  int key_;
75  Qt::KeyboardModifiers modifiers_;
76  bool swallow_;
77 };
78 
80 Q_OBJECT
81 public:
82  MouseEventTransition(QEvent::Type type,Qt::MouseButton button,Qt::KeyboardModifiers modifiers, State* target, bool swallow_event=true, TransitionGuard* guard=new TransitionGuard());
83  virtual std::pair<bool,bool> checkEvent(QMouseEvent* event);
84 protected:
86  Qt::MouseButton button_;
87  Qt::KeyboardModifiers modifiers_;
88  bool swallow_;
89 };
90 
91 
92 
93 
94 }}//ns
95 #endif // PYTHON_SHELL_TRANSITION_HH
Qt::KeyboardModifiers modifiers_
Definition: transition.hh:75
TransitionGuard * guard_
Definition: transition.hh:50
Qt::KeyboardModifiers modifiers_
Definition: transition.hh:87
virtual std::pair< bool, bool > checkEvent(QMouseEvent *event)
AutomaticTransition(State *target, TransitionGuard *guard=new TransitionGuard())
SignalTransition(QObject *sender, const char *signal, State *target, TransitionGuard *guard=new TransitionGuard())
KeyEventTransition(int key, Qt::KeyboardModifiers modifiers, State *target, bool swallow_event=true, TransitionGuard *guard=new TransitionGuard())
virtual std::pair< bool, bool > checkEvent(QKeyEvent *event)
MouseEventTransition(QEvent::Type type, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, State *target, bool swallow_event=true, TransitionGuard *guard=new TransitionGuard())
TransitionBase(State *target, TransitionGuard *guard=new TransitionGuard())