File indexing completed on 2024-11-15 09:57:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGLEventHandler
0013 #define ROOT_TGLEventHandler
0014
0015
0016
0017
0018
0019
0020
0021 #include "TGEventHandler.h"
0022 #include "TPoint.h"
0023
0024 class TGToolTip;
0025
0026 class TGLViewer;
0027 class TGLPhysicalShape;
0028
0029 class TGLEventHandler : public TGEventHandler
0030 {
0031 protected:
0032 TGLViewer *fGLViewer;
0033 TTimer *fMouseTimer;
0034 TPoint fButtonPushPos;
0035 TPoint fLastPos;
0036 TPoint fLastMouseOverPos;
0037 TGLPhysicalShape *fLastMouseOverShape;
0038 TGToolTip *fTooltip;
0039 TPoint fLastGlobalPos;
0040 TPoint fTooltipPos;
0041 UInt_t fActiveButtonID;
0042 UInt_t fLastEventState;
0043 Bool_t fIgnoreButtonUp;
0044 Bool_t fInPointerGrab;
0045 Bool_t fMouseTimerRunning;
0046 Bool_t fTooltipShown;
0047 Bool_t fArcBall;
0048 Int_t fTooltipPixelTolerance;
0049 Int_t fSecSelType;
0050 Bool_t fDoInternalSelection;
0051 Bool_t fViewerCentricControls;
0052 Float_t fArrowKeyFactor;
0053 Float_t fMouseDragFactor;
0054 Float_t fMouseWheelFactor;
0055
0056 virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
0057
0058 virtual void GrabMouse();
0059 virtual void UnGrabMouse();
0060
0061 virtual void SelectForClicked(Event_t *event);
0062 virtual void SelectForMouseOver();
0063
0064 Int_t ControlValue(Int_t v) { return fViewerCentricControls ? -v : v; }
0065
0066 public:
0067 TGLEventHandler(TGWindow *w, TObject *obj);
0068 ~TGLEventHandler() override;
0069
0070 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0071 Bool_t HandleEvent(Event_t *event) override;
0072 virtual Bool_t HandleExpose(Event_t * event);
0073 Bool_t HandleFocusChange(Event_t *event) override;
0074 Bool_t HandleCrossing(Event_t *event) override;
0075 Bool_t HandleButton(Event_t * event) override;
0076 Bool_t HandleDoubleClick(Event_t *event) override;
0077 Bool_t HandleConfigureNotify(Event_t *event) override;
0078 Bool_t HandleKey(Event_t *event) override;
0079 Bool_t HandleMotion(Event_t * event) override;
0080 Bool_t HandleTimer(TTimer *t) override;
0081 virtual void StartMouseTimer();
0082 virtual void StopMouseTimer();
0083 virtual void ClearMouseOver();
0084 void Repaint() override;
0085
0086 virtual void PopupContextMenu(TGLPhysicalShape* pshp, Event_t *event, Int_t gx, Int_t gy);
0087
0088 virtual void TriggerTooltip(const char* text);
0089 virtual void RemoveTooltip();
0090
0091 void SetMouseOverSelectDelay(Int_t ms);
0092 void SetMouseOverTooltipDelay(Int_t ms);
0093
0094 Int_t GetTooltipPixelTolerance() const { return fTooltipPixelTolerance; }
0095 void SetTooltipPixelTolerance(Int_t t) { fTooltipPixelTolerance = t; }
0096
0097 Int_t GetSecSelType() const { return fSecSelType; }
0098 void SetSecSelType(Int_t t) { fSecSelType = t; }
0099
0100 Bool_t GetDoInternalSelection() const { return fDoInternalSelection; }
0101 void SetDoInternalSelection(Bool_t x) { fDoInternalSelection = x; }
0102
0103 Bool_t GetArcBall() const { return fArcBall; }
0104 void SetArcBall(Bool_t a) { fArcBall = a; }
0105
0106 ClassDefOverride(TGLEventHandler, 0);
0107 };
0108
0109 #endif
0110