00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGLEventHandler
00013 #define ROOT_TGLEventHandler
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ROOT_TGEventHandler
00022 #include "TGEventHandler.h"
00023 #endif
00024 #ifndef ROOT_TPoint
00025 #include "TPoint.h"
00026 #endif
00027
00028 class TGToolTip;
00029
00030 class TGLViewer;
00031 class TGLPhysicalShape;
00032
00033 class TGLEventHandler : public TGEventHandler
00034 {
00035 protected:
00036 TGLViewer *fGLViewer;
00037 TTimer *fMouseTimer;
00038 TPoint fButtonPushPos;
00039 TPoint fLastPos;
00040 TPoint fLastMouseOverPos;
00041 TGLPhysicalShape *fLastMouseOverShape;
00042 TGToolTip *fTooltip;
00043 TPoint fLastGlobalPos;
00044 TPoint fTooltipPos;
00045 UInt_t fActiveButtonID;
00046 UInt_t fLastEventState;
00047 Bool_t fIgnoreButtonUp;
00048 Bool_t fInPointerGrab;
00049 Bool_t fMouseTimerRunning;
00050 Bool_t fTooltipShown;
00051 Int_t fTooltipPixelTolerance;
00052 Int_t fSecSelType;
00053 Bool_t fDoInternalSelection;
00054 Bool_t fViewerCentricControls;
00055 Float_t fArrowKeyFactor;
00056 Float_t fMouseDragFactor;
00057 Float_t fMouseWheelFactor;
00058
00059 virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
00060
00061 virtual void GrabMouse();
00062 virtual void UnGrabMouse();
00063
00064 virtual void SelectForClicked(Event_t *event);
00065 virtual void SelectForMouseOver();
00066
00067 Int_t ControlValue(Int_t v) { return fViewerCentricControls ? -v : v; }
00068
00069 public:
00070 TGLEventHandler(TGWindow *w, TObject *obj);
00071 virtual ~TGLEventHandler();
00072
00073 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
00074 virtual Bool_t HandleEvent(Event_t *event);
00075 virtual Bool_t HandleExpose(Event_t * event);
00076 virtual Bool_t HandleFocusChange(Event_t *event);
00077 virtual Bool_t HandleCrossing(Event_t *event);
00078 virtual Bool_t HandleButton(Event_t * event);
00079 virtual Bool_t HandleDoubleClick(Event_t *event);
00080 virtual Bool_t HandleConfigureNotify(Event_t *event);
00081 virtual Bool_t HandleKey(Event_t *event);
00082 virtual Bool_t HandleMotion(Event_t * event);
00083 virtual Bool_t HandleTimer(TTimer *t);
00084 virtual void StartMouseTimer();
00085 virtual void StopMouseTimer();
00086 virtual void ClearMouseOver();
00087 virtual void Repaint();
00088
00089 virtual void PopupContextMenu(TGLPhysicalShape* pshp, Event_t *event, Int_t gx, Int_t gy);
00090
00091 virtual void TriggerTooltip(const char* text);
00092 virtual void RemoveTooltip();
00093
00094 void SetMouseOverSelectDelay(Int_t ms);
00095 void SetMouseOverTooltipDelay(Int_t ms);
00096
00097 Int_t GetTooltipPixelTolerance() const { return fTooltipPixelTolerance; }
00098 void SetTooltipPixelTolerance(Int_t t) { fTooltipPixelTolerance = t; }
00099
00100 Int_t GetSecSelType() const { return fSecSelType; }
00101 void SetSecSelType(Int_t t) { fSecSelType = t; }
00102
00103 Bool_t GetDoInternalSelection() const { return fDoInternalSelection; }
00104 void SetDoInternalSelection(Bool_t x) { fDoInternalSelection = x; }
00105
00106 ClassDef(TGLEventHandler, 0);
00107 };
00108
00109 #endif
00110