00001 #ifndef TRANSITION_GUARD_HH
00002 #define TRANSITION_GUARD_HH
00003
00004 #include <QObject>
00005 #include "python_shell_fw.hh"
00006 #include "python_interpreter.hh"
00007
00008 namespace ost { namespace gui {
00009
00010
00011
00012 class ShellHistory;
00013 class PythonShellWidget;
00014
00015
00016 class TransitionGuard: public QObject
00017 {
00018 Q_OBJECT
00019
00020 public:
00021 TransitionGuard();
00022 virtual bool check();
00023 };
00024
00025
00026
00027 class HistoryGuard : public TransitionGuard
00028 {
00029 public:
00030 HistoryGuard(ShellHistory* history, BlockEditMode mode);
00031 virtual bool check();
00032 protected:
00033 ShellHistory* history_;
00034 BlockEditMode mode_;
00035 };
00036
00037 class EditPositionGuard : public TransitionGuard
00038 {
00039 public:
00040 enum FLAGS{
00041 ALWAYSTRUE=0,
00042 SMALLER=1,
00043 EQUAL=2,
00044 BIGGER=4,
00045 ANCHORSMALLER=8,
00046 ANCHOREQUAL=16,
00047 ANCHORBIGGER=32
00048 };
00049 EditPositionGuard(PythonShellWidget* shell,int flags1, int flags2=ALWAYSTRUE);
00050 virtual bool check();
00051 protected:
00052 virtual bool check_flag(int flag);
00053 PythonShellWidget* shell_;
00054 int flags1_;
00055 int flags2_;
00056 };
00057
00058 class BlockStatusGuard : public TransitionGuard
00059 {
00060 public:
00061 BlockStatusGuard(PythonShellWidget* shell, int status);
00062 virtual bool check();
00063 protected:
00064 PythonShellWidget* shell_;
00065 int status_;
00066 };
00067
00068
00069
00070 }}
00071
00072
00073 #endif // TRANSITION_GUARD_HH