31#include "RConfigure.h"
63 fLastMouseOverPos (-1, -1),
64 fLastMouseOverShape (0),
70 fMouseTimerRunning (
kFALSE),
73 fTooltipPixelTolerance (3),
75 fDoInternalSelection(
kTRUE),
76 fViewerCentricControls(
kFALSE)
239 Event_t eventSt = {
kOtherEvent, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
240 kFALSE, 0, 0, {0, 0, 0, 0, 0} };
355 Error(
"TGLEventHandler::HandleEvent",
"active drag-action at focus-in.");
362 Warning(
"TGLEventHandler::HandleEvent",
"drag-action active at focus-out.");
381 Error(
"TGLEventHandler::HandleFocusChange",
"active drag-action at focus-in.");
389 Warning(
"TGLEventHandler::HandleFocusChange",
"drag-action active at focus-out.");
406 if (
event->fCode != 0) {
413 Error(
"TGLEventHandler::HandleCrossing",
"active drag-action at enter-notify.");
422 Warning(
"TGLEventHandler::HandleCrossing",
"drag-action active at leave-notify.");
439 Info(
"TGLEventHandler::HandleButton",
"ignored - viewer is %s",
489#if defined(R__HAS_COCOA)
525 Int_t x =
event->fX,
y =
event->fY;
553 switch (
event->fCode)
592 Warning(
"TGLEventHandler::HandleButton",
"Unexpected button-release.");
675 Info(
"TGLEventHandler::HandleDoubleClick",
"ignored - viewer is %s",
681 if (
event->fCode > 3)
708 Info(
"TGLEventHandler::HandleConfigureNotify",
"ignored - viewer is %s",
715 Int_t x =
event->fX,
y =
event->fY,
w =
event->fWidth,
h =
event->fHeight;
732 Info(
"TGLViewer::HandleExpose",
"ignored - viewer is %s",
759 Info(
"TGLEventHandler::HandleKey",
"ignored - viewer is %s",
771 keysym =
event->fCode;
870 Info(
"OpenGL viewer FORCED rebuild",
" ");
894 Info(
"TGLEventHandler::HandleMotion",
"ignored - viewer is %s",
923 Info(
"TGLEventHandler::HandleMotion",
"Redraw pending, ignoring.");
939 processed =
Rotate(xDelta, yDelta, mod1, mod2);
964 if (processed || changed) {
983 else return cam.
Rotate (xDelta, -yDelta, mod1, mod2);
997 Info(
"TGLEventHandler::HandleTimer",
"Redraw pending, ignoring.");
1051 Info(
"TGLViewer::HandleExpose",
"ignored - viewer is %s",
1091 static UInt_t screenW = 0, screenH = 0;
1096 if (screenW == 0 || screenH == 0) {
1097 screenW =
gClient->GetDisplayWidth();
1098 screenH =
gClient->GetDisplayHeight();
const Mask_t kButtonPressMask
const Mask_t kKeyMod1Mask
typically the Alt key
Handle_t Window_t
Window handle.
const Mask_t kPointerMotionMask
const Mask_t kKeyShiftMask
const Mask_t kKeyControlMask
const Mask_t kKeyMod2Mask
typically mod on numeric keys
const Mask_t kButtonReleaseMask
Option_t Option_t TPoint TPoint const char text
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2)
Dolly the camera - 'move camera along eye line, retaining lens focal length'.
virtual Bool_t Truck(Double_t xDelta, Double_t yDelta)
Truck the camera - 'move camera parallel to film plane'.
virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Rotate the camera round view volume center established in Setup().
virtual Bool_t Zoom(Int_t delta, Bool_t mod1, Bool_t mod2)=0
void WindowToViewport(Int_t &, Int_t &y) const
Bool_t GetExternalCenter()
void SetExternalCenter(Bool_t x)
Set camera center diffrent than scene center, if enable is kTRUE.
void SetCenterVec(Double_t x, Double_t y, Double_t z)
Set camera center vector.
virtual Bool_t RotateArcBall(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Rotate the camera round view volume center established in Setup().
TGLVertex3 ViewportToWorld(const TGLVertex3 &viewportVertex, TGLMatrix *modviewMat=nullptr) const
Convert a '3D' viewport vertex to 3D world one.
Base-class and default implementation of event-handler for TGLViewer.
virtual void GrabMouse()
Acquire mouse grab.
void SetMouseOverSelectDelay(Int_t ms)
Set delay of mouse-over probe (highlight).
virtual Bool_t HandleTimer(TTimer *t)
If mouse delay timer times out emit signal.
TGLEventHandler(TGWindow *w, TObject *obj)
Constructor.
virtual void SelectForClicked(Event_t *event)
Run selection (optionally with on secondary selection) and emit corresponding Clicked() signals.
TGLPhysicalShape * fLastMouseOverShape
virtual void UnGrabMouse()
Release mouse grab.
virtual Bool_t HandleExpose(Event_t *event)
Handle window expose 'event' - show.
virtual void StartMouseTimer()
Start mouse timer in single-shot mode.
virtual void TriggerTooltip(const char *text)
Trigger display of tooltip.
virtual void StopMouseTimer()
Make sure mouse timers are not running.
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle mouse double click 'event'.
virtual Bool_t HandleEvent(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes and terminate any interaction i...
virtual void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy)
Popup context menu.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button 'event'.
virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Method to handle action TGLViewer::kDragCameraRotate.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion 'event'.
Bool_t fMouseTimerRunning
Float_t fMouseWheelFactor
virtual Bool_t HandleCrossing(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes and terminate any interaction i...
Bool_t fViewerCentricControls
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handle configure notify 'event' - a window resize/movement.
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard 'event'.
void SetMouseOverTooltipDelay(Int_t ms)
Set delay of tooltip timer.
Bool_t fDoInternalSelection
virtual void Repaint()
Handle window expose 'event' - show.
virtual ~TGLEventHandler()
Destructor.
virtual void ClearMouseOver()
Clear mouse-over state and emit mouse-over signals.
virtual void SelectForMouseOver()
Run selection (optionally with on secondary selection) and emit corresponding MouseOver() signals.
Int_t fTooltipPixelTolerance
virtual void RemoveTooltip()
Hide the tooltip.
virtual Bool_t HandleFocusChange(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes and terminate any interaction i...
Int_t ControlValue(Int_t v)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Process event of type 'event' - one of EEventType types, occurring at window location px,...
ELock CurrentLock() const
static const char * LockName(ELock lock)
Return name-string for given lock-type.
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Virtual method called-back after a secondary selection hit is recorded (see TGLViewer::HandleButton()...
virtual Bool_t AlwaysSecondarySelect() const
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
Concrete physical shape - a GL drawable.
void InvokeContextMenu(TContextMenu &menu, UInt_t x, UInt_t y) const
Request creation of context menu on shape, attached to 'menu' at screen position 'x' 'y'.
Viewport (pixel base) 2D rectangle class.
void RequestDraw(Int_t milliSec, Short_t redrawLOD)
void SetEventKeySym(UInt_t k)
Standard selection record including information about containing scene and details ob out selected ob...
@ kModifyingInternalSelection
ESecSelResult GetSecSelResult() const
void SetHighlight(Bool_t hlt)
void SetMultiple(Bool_t multi)
TObject * GetObject() const
TGLLogicalShape * GetLogShape() const
TGLPhysicalShape * GetPhysShape() const
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
3 component (x/y/z) vector class.
void SetStyle(Short_t st)
Base GL viewer object - used by both standalone and embedded (in pad) GL.
TGLRedrawTimer * fRedrawTimer
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
virtual void RefreshPadEditor(TObject *obj=nullptr)
Update GED editor if it is set.
EPushAction GetPushAction() const
TGLSelectRecord fSelRec
select record in use as selected
virtual void ReMouseOver(TObject *obj, UInt_t state)
Emit MouseOver signal.
virtual void Clicked(TObject *obj)
Emit Clicked signal.
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state)
Emit UnClicked signal with button id and modifier state.
Bool_t RequestOverlaySelect(Int_t x, Int_t y)
Post request for secondary selection rendering of selected object around the window point (x,...
virtual void MouseIdle(TGLPhysicalShape *, UInt_t, UInt_t)
Emit MouseIdle signal.
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
void SwitchColorSet()
Switch between dark and light colorsets.
TGLSelectRecord fSecSelRec
select record from last select (should go to context)
TGLCamera & CurrentCamera() const
TContextMenu * fContextMenu
external pad - remove replace with signal
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
TGLSelectRecord & GetSelRec()
void SetViewport(Int_t x, Int_t y, Int_t width, Int_t height)
Set viewer viewport (window area) with bottom/left at (x,y), with dimensions 'width'/'height'.
virtual void UnMouseOver(TObject *obj, UInt_t state)
Emit UnMouseOver signal.
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left.
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it.
Bool_t RequestSelect(Int_t x, Int_t y)
Post request for selection render pass viewer, picking objects around the window point (x,...
virtual void DoubleClicked()
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
Bool_t fDebugMode
cache logicals during scene rebuilds
TGLOvlSelectRecord fOvlSelRec
current overlay element
TGLOverlayElement * fCurrentOvlElm
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
TGLWidget * GetGLWidget()
ROOT GUI Window base class.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual const char * GetTitle() const
Returns title of object.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Handles synchronous and a-synchronous timer events.
virtual void TurnOff()
Remove timer from system timer list.
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
virtual void TurnOn()
Add the timer to the system timer list.
void Reset()
Reset the timer.
void SetTime(Long_t milliSec)
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
UInt_t fState
key or button mask
Int_t fYRoot
coordinates relative to root
UInt_t fCode
key or button code