00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PYTHON_SHELL_TRANSITION_HH
00021 #define PYTHON_SHELL_TRANSITION_HH
00022
00023 #include <ost/gui/python_shell/python_interpreter.hh>
00024 #include "transition_guard.hh"
00025 #include <utility>
00026
00027 #include <QObject>
00028 #include <QEvent>
00029
00030 class QKeyEvent;
00031 class QMouseEvent;
00032
00033 namespace ost { namespace gui {
00034
00035
00036 class State;
00037 class PythonShellWidget;
00038 class ShellHistory;
00039
00040 class TransitionBase: public QObject{
00041 Q_OBJECT
00042 public:
00043 TransitionBase(State* target, TransitionGuard* guard=new TransitionGuard());
00044 signals:
00045 void triggered();
00046 protected:
00047 void trigger_();
00048 bool is_active_();
00049 State* target_;
00050 TransitionGuard* guard_;
00051 };
00052
00053 class AutomaticTransition: public TransitionBase{
00054 Q_OBJECT
00055 public:
00056 AutomaticTransition(State* target, TransitionGuard* guard=new TransitionGuard());
00057 bool checkTransition();
00058 };
00059
00060 class SignalTransition: public TransitionBase{
00061 Q_OBJECT
00062 public:
00063 SignalTransition(QObject * sender,const char * signal, State* target, TransitionGuard* guard=new TransitionGuard());
00064 protected slots:
00065 void onSignal();
00066 };
00067
00068 class KeyEventTransition: public TransitionBase{
00069 Q_OBJECT
00070 public:
00071 KeyEventTransition(int key,Qt::KeyboardModifiers modifiers, State* target, bool swallow_event=true, TransitionGuard* guard=new TransitionGuard());
00072 virtual std::pair<bool,bool> checkEvent(QKeyEvent* event);
00073 protected:
00074 int key_;
00075 Qt::KeyboardModifiers modifiers_;
00076 bool swallow_;
00077 };
00078
00079 class MouseEventTransition: public TransitionBase{
00080 Q_OBJECT
00081 public:
00082 MouseEventTransition(QEvent::Type type,Qt::MouseButton button,Qt::KeyboardModifiers modifiers, State* target, bool swallow_event=true, TransitionGuard* guard=new TransitionGuard());
00083 virtual std::pair<bool,bool> checkEvent(QMouseEvent* event);
00084 protected:
00085 QEvent::Type type_;
00086 Qt::MouseButton button_;
00087 Qt::KeyboardModifiers modifiers_;
00088 bool swallow_;
00089 };
00090
00091
00092
00093
00094 }}
00095 #endif // PYTHON_SHELL_TRANSITION_HH