3 #ifndef PYINTERP_REQUEST_H
4 #define PYINTERP_REQUEST_H
7 #include "PyInterp_Event.h"
12 class PyInterp_Interp;
13 class PyInterp_Watcher;
14 class PyInterp_Dispatcher;
15 class PyInterp_ExecuteEvent;
16 class PyConsole_Editor;
19 class PyInterp_Request
21 friend class PyInterp_Dispatcher;
22 friend class PyInterp_ExecuteEvent;
25 PyInterp_Request( const PyInterp_Request& );
28 virtual ~PyInterp_Request() {};
29 // protected destructor - to control deletion of requests
32 PyInterp_Request( QObject* listener, bool sync = false )
33 : myIsSync( sync ), myListener( listener ) {};
35 static void Destroy( PyInterp_Request* );
38 bool IsSync() const { return myIsSync; }
39 // Returns true if this request should be processed synchronously,
40 // without putting it to a queue
43 virtual void safeExecute();
45 virtual void execute() = 0;
46 // Should be redefined in successors, contains actual request code
48 virtual QEvent* createEvent();
49 // This method can be overridden to customize notification event creation
51 virtual void processEvent( QObject* );
53 QObject* listener() const { return myListener; }
54 void setListener( QObject* );
66 class PyInterp_LockRequest : public PyInterp_Request
70 PyInterp_LockRequest( PyInterp_Interp* interp, QObject* listener = 0, bool sync = false )
71 : PyInterp_Request( listener, sync ), myInterp( interp )
75 PyInterp_Interp* getInterp() const { return myInterp; }
77 virtual void safeExecute();
80 PyInterp_Interp* myInterp;
83 #endif // PYINTERP_REQUEST_H