Open CASCADE Technology 7.8.0
Public Member Functions
Aspect_WindowInputListener Class Referenceabstract

Defines a listener for window input events. More...

#include <Aspect_WindowInputListener.hxx>

Inheritance diagram for Aspect_WindowInputListener:
Inheritance graph
[legend]

Public Member Functions

virtual ~Aspect_WindowInputListener ()
 DEFINE_STANDARD_ALLOC.
 
double EventTime () const
 Return event time (e.g. current time).
 
virtual void ProcessExpose ()=0
 Handle expose event (window content has been invalidation and should be redrawn).
 
virtual void ProcessConfigure (bool theIsResized)=0
 Handle window resize event.
 
virtual void ProcessInput ()=0
 Handle window input event immediately (flush input buffer or ignore).
 
virtual void ProcessFocus (bool theIsActivated)=0
 Handle focus event.
 
virtual void ProcessClose ()=0
 Handle window close event.
 
keyboard input
const Aspect_VKeySetKeys () const
 Return keyboard state.
 
Aspect_VKeySetChangeKeys ()
 Return keyboard state.
 
virtual void KeyDown (Aspect_VKey theKey, double theTime, double thePressure=1.0)=0
 Press key. Default implementation updates internal cache.
 
virtual void KeyUp (Aspect_VKey theKey, double theTime)=0
 Release key. Default implementation updates internal cache.
 
virtual void KeyFromAxis (Aspect_VKey theNegative, Aspect_VKey thePositive, double theTime, double thePressure)=0
 Simulate key up/down events from axis value. Default implementation updates internal cache.
 
mouse input
virtual bool UpdateMouseScroll (const Aspect_ScrollDelta &theDelta)=0
 Update mouse scroll event. This method is expected to be called from UI thread.
 
virtual bool UpdateMouseButtons (const Graphic3d_Vec2i &thePoint, Aspect_VKeyMouse theButtons, Aspect_VKeyFlags theModifiers, bool theIsEmulated)=0
 Handle mouse button press/release event. This method is expected to be called from UI thread.
 
virtual bool UpdateMousePosition (const Graphic3d_Vec2i &thePoint, Aspect_VKeyMouse theButtons, Aspect_VKeyFlags theModifiers, bool theIsEmulated)=0
 Handle mouse cursor movement event. This method is expected to be called from UI thread. Default implementation does nothing.
 
bool PressMouseButton (const Graphic3d_Vec2i &thePoint, Aspect_VKeyMouse theButton, Aspect_VKeyFlags theModifiers, bool theIsEmulated)
 Handle mouse button press event. This method is expected to be called from UI thread. Default implementation redirects to UpdateMousePosition().
 
bool ReleaseMouseButton (const Graphic3d_Vec2i &thePoint, Aspect_VKeyMouse theButton, Aspect_VKeyFlags theModifiers, bool theIsEmulated)
 Handle mouse button release event. This method is expected to be called from UI thread. Default implementation redirects to UpdateMousePosition().
 
Aspect_VKeyMouse PressedMouseButtons () const
 Return currently pressed mouse buttons.
 
Aspect_VKeyFlags LastMouseFlags () const
 Return active key modifiers passed with last mouse event.
 
const Graphic3d_Vec2iLastMousePosition () const
 Return last mouse position.
 
multi-touch input
bool HasTouchPoints () const
 Return TRUE if touches map is not empty.
 
const Aspect_TouchMapTouchPoints () const
 Return map of active touches.
 
virtual void AddTouchPoint (Standard_Size theId, const Graphic3d_Vec2d &thePnt, Standard_Boolean theClearBefore=false)
 Add touch point with the given ID. This method is expected to be called from UI thread.
 
virtual bool RemoveTouchPoint (Standard_Size theId, Standard_Boolean theClearSelectPnts=false)
 Remove touch point with the given ID. This method is expected to be called from UI thread.
 
virtual void UpdateTouchPoint (Standard_Size theId, const Graphic3d_Vec2d &thePnt)
 Update touch point with the given ID. If point with specified ID was not registered before, it will be added. This method is expected to be called from UI thread.
 

Protected Attributes

keyboard input variables
Aspect_VKeySet myKeys
 keyboard state
 
mouse input variables
Graphic3d_Vec2i myMousePositionLast
 last mouse position
 
Aspect_VKeyMouse myMousePressed
 active mouse buttons
 
Aspect_VKeyFlags myMouseModifiers
 active key modifiers passed with last mouse event
 
Aspect_TouchMap myTouchPoints
 map of active touches
 
3d mouse input variables
bool my3dMouseButtonState [32]
 cached button state
 
NCollection_Vec3< boolmy3dMouseNoRotate
 ignore 3d mouse rotation axes
 
NCollection_Vec3< boolmy3dMouseToReverse
 reverse 3d mouse rotation axes
 
float my3dMouseAccelTrans
 acceleration ratio for translation event
 
float my3dMouseAccelRotate
 acceleration ratio for rotation event
 
bool my3dMouseIsQuadric
 quadric acceleration
 

3d mouse input

OSD_Timer myEventTimer
 timer for timestamping events
 
float Get3dMouseTranslationScale () const
 Return acceleration ratio for translation event; 2.0 by default.
 
void Set3dMouseTranslationScale (float theScale)
 Set acceleration ratio for translation event.
 
float Get3dMouseRotationScale () const
 Return acceleration ratio for rotation event; 4.0 by default.
 
void Set3dMouseRotationScale (float theScale)
 Set acceleration ratio for rotation event.
 
bool To3dMousePreciseInput () const
 Return quadric acceleration flag; TRUE by default.
 
void Set3dMousePreciseInput (bool theIsQuadric)
 Set quadric acceleration flag.
 
const NCollection_Vec3< bool > & Get3dMouseIsNoRotate () const
 Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.
 
NCollection_Vec3< bool > & Change3dMouseIsNoRotate ()
 Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.
 
const NCollection_Vec3< bool > & Get3dMouseToReverse () const
 Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.
 
NCollection_Vec3< bool > & Change3dMouseToReverse ()
 Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.
 
virtual bool Update3dMouse (const WNT_HIDSpaceMouse &theEvent)=0
 Process 3d mouse input event (redirects to translation, rotation and keys).
 
virtual bool update3dMouseTranslation (const WNT_HIDSpaceMouse &theEvent)
 Process 3d mouse input translation event.
 
virtual bool update3dMouseRotation (const WNT_HIDSpaceMouse &theEvent)
 Process 3d mouse input rotation event.
 
virtual bool update3dMouseKeys (const WNT_HIDSpaceMouse &theEvent)
 Process 3d mouse input keys event.
 
 Aspect_WindowInputListener ()
 Empty constructor.
 

Detailed Description

Defines a listener for window input events.

Constructor & Destructor Documentation

◆ ~Aspect_WindowInputListener()

virtual Aspect_WindowInputListener::~Aspect_WindowInputListener ( )
virtual

DEFINE_STANDARD_ALLOC.

Destructor.

◆ Aspect_WindowInputListener()

Aspect_WindowInputListener::Aspect_WindowInputListener ( )
protected

Empty constructor.

Member Function Documentation

◆ AddTouchPoint()

virtual void Aspect_WindowInputListener::AddTouchPoint ( Standard_Size  theId,
const Graphic3d_Vec2d thePnt,
Standard_Boolean  theClearBefore = false 
)
virtual

Add touch point with the given ID. This method is expected to be called from UI thread.

Parameters
theIdtouch unique identifier
thePnttouch coordinates
theClearBeforeif TRUE previously registered touches will be removed

Reimplemented in AIS_ViewController.

◆ Change3dMouseIsNoRotate()

NCollection_Vec3< bool > & Aspect_WindowInputListener::Change3dMouseIsNoRotate ( )
inline

Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.

◆ Change3dMouseToReverse()

NCollection_Vec3< bool > & Aspect_WindowInputListener::Change3dMouseToReverse ( )
inline

Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.

◆ ChangeKeys()

Aspect_VKeySet & Aspect_WindowInputListener::ChangeKeys ( )
inline

Return keyboard state.

◆ EventTime()

double Aspect_WindowInputListener::EventTime ( ) const
inline

Return event time (e.g. current time).

◆ Get3dMouseIsNoRotate()

const NCollection_Vec3< bool > & Aspect_WindowInputListener::Get3dMouseIsNoRotate ( ) const
inline

Return 3d mouse rotation axes (tilt/roll/spin) ignore flag; (FALSE, FALSE, FALSE) by default.

◆ Get3dMouseRotationScale()

float Aspect_WindowInputListener::Get3dMouseRotationScale ( ) const
inline

Return acceleration ratio for rotation event; 4.0 by default.

◆ Get3dMouseToReverse()

const NCollection_Vec3< bool > & Aspect_WindowInputListener::Get3dMouseToReverse ( ) const
inline

Return 3d mouse rotation axes (tilt/roll/spin) reverse flag; (TRUE, FALSE, FALSE) by default.

◆ Get3dMouseTranslationScale()

float Aspect_WindowInputListener::Get3dMouseTranslationScale ( ) const
inline

Return acceleration ratio for translation event; 2.0 by default.

◆ HasTouchPoints()

bool Aspect_WindowInputListener::HasTouchPoints ( ) const
inline

Return TRUE if touches map is not empty.

◆ KeyDown()

virtual void Aspect_WindowInputListener::KeyDown ( Aspect_VKey  theKey,
double  theTime,
double  thePressure = 1.0 
)
pure virtual

Press key. Default implementation updates internal cache.

Parameters
theKeykey pressed
theTimeevent timestamp

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ KeyFromAxis()

virtual void Aspect_WindowInputListener::KeyFromAxis ( Aspect_VKey  theNegative,
Aspect_VKey  thePositive,
double  theTime,
double  thePressure 
)
pure virtual

Simulate key up/down events from axis value. Default implementation updates internal cache.

Implemented in AIS_ViewController.

◆ Keys()

const Aspect_VKeySet & Aspect_WindowInputListener::Keys ( ) const
inline

Return keyboard state.

◆ KeyUp()

virtual void Aspect_WindowInputListener::KeyUp ( Aspect_VKey  theKey,
double  theTime 
)
pure virtual

Release key. Default implementation updates internal cache.

Parameters
theKeykey pressed
theTimeevent timestamp

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ LastMouseFlags()

Aspect_VKeyFlags Aspect_WindowInputListener::LastMouseFlags ( ) const
inline

Return active key modifiers passed with last mouse event.

◆ LastMousePosition()

const Graphic3d_Vec2i & Aspect_WindowInputListener::LastMousePosition ( ) const
inline

Return last mouse position.

◆ PressedMouseButtons()

Aspect_VKeyMouse Aspect_WindowInputListener::PressedMouseButtons ( ) const
inline

Return currently pressed mouse buttons.

◆ PressMouseButton()

bool Aspect_WindowInputListener::PressMouseButton ( const Graphic3d_Vec2i thePoint,
Aspect_VKeyMouse  theButton,
Aspect_VKeyFlags  theModifiers,
bool  theIsEmulated 
)
inline

Handle mouse button press event. This method is expected to be called from UI thread. Default implementation redirects to UpdateMousePosition().

Parameters
thePointmouse cursor position
theButtonpressed button
theModifierskey modifiers
theIsEmulatedif TRUE then mouse event comes NOT from real mouse but emulated from non-precise input like touch on screen
Returns
TRUE if window content should be redrawn

◆ ProcessClose()

virtual void Aspect_WindowInputListener::ProcessClose ( )
pure virtual

Handle window close event.

Implemented in AIS_ViewController.

◆ ProcessConfigure()

virtual void Aspect_WindowInputListener::ProcessConfigure ( bool  theIsResized)
pure virtual

Handle window resize event.

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ ProcessExpose()

virtual void Aspect_WindowInputListener::ProcessExpose ( )
pure virtual

Handle expose event (window content has been invalidation and should be redrawn).

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ ProcessFocus()

virtual void Aspect_WindowInputListener::ProcessFocus ( bool  theIsActivated)
pure virtual

Handle focus event.

Implemented in AIS_ViewController.

◆ ProcessInput()

virtual void Aspect_WindowInputListener::ProcessInput ( )
pure virtual

Handle window input event immediately (flush input buffer or ignore).

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ ReleaseMouseButton()

bool Aspect_WindowInputListener::ReleaseMouseButton ( const Graphic3d_Vec2i thePoint,
Aspect_VKeyMouse  theButton,
Aspect_VKeyFlags  theModifiers,
bool  theIsEmulated 
)
inline

Handle mouse button release event. This method is expected to be called from UI thread. Default implementation redirects to UpdateMousePosition().

Parameters
thePointmouse cursor position
theButtonreleased button
theModifierskey modifiers
theIsEmulatedif TRUE then mouse event comes NOT from real mouse but emulated from non-precise input like touch on screen
Returns
TRUE if window content should be redrawn

◆ RemoveTouchPoint()

virtual bool Aspect_WindowInputListener::RemoveTouchPoint ( Standard_Size  theId,
Standard_Boolean  theClearSelectPnts = false 
)
virtual

Remove touch point with the given ID. This method is expected to be called from UI thread.

Parameters
theIdtouch unique identifier
theClearSelectPntsif TRUE will initiate clearing of selection points
Returns
TRUE if point has been removed

Reimplemented in AIS_ViewController.

◆ Set3dMousePreciseInput()

void Aspect_WindowInputListener::Set3dMousePreciseInput ( bool  theIsQuadric)
inline

Set quadric acceleration flag.

◆ Set3dMouseRotationScale()

void Aspect_WindowInputListener::Set3dMouseRotationScale ( float  theScale)
inline

Set acceleration ratio for rotation event.

◆ Set3dMouseTranslationScale()

void Aspect_WindowInputListener::Set3dMouseTranslationScale ( float  theScale)
inline

Set acceleration ratio for translation event.

◆ To3dMousePreciseInput()

bool Aspect_WindowInputListener::To3dMousePreciseInput ( ) const
inline

Return quadric acceleration flag; TRUE by default.

◆ TouchPoints()

const Aspect_TouchMap & Aspect_WindowInputListener::TouchPoints ( ) const
inline

Return map of active touches.

◆ Update3dMouse()

virtual bool Aspect_WindowInputListener::Update3dMouse ( const WNT_HIDSpaceMouse theEvent)
pure virtual

Process 3d mouse input event (redirects to translation, rotation and keys).

Implemented in AIS_ViewController.

◆ update3dMouseKeys()

virtual bool Aspect_WindowInputListener::update3dMouseKeys ( const WNT_HIDSpaceMouse theEvent)
virtual

Process 3d mouse input keys event.

◆ update3dMouseRotation()

virtual bool Aspect_WindowInputListener::update3dMouseRotation ( const WNT_HIDSpaceMouse theEvent)
virtual

Process 3d mouse input rotation event.

◆ update3dMouseTranslation()

virtual bool Aspect_WindowInputListener::update3dMouseTranslation ( const WNT_HIDSpaceMouse theEvent)
virtual

Process 3d mouse input translation event.

◆ UpdateMouseButtons()

virtual bool Aspect_WindowInputListener::UpdateMouseButtons ( const Graphic3d_Vec2i thePoint,
Aspect_VKeyMouse  theButtons,
Aspect_VKeyFlags  theModifiers,
bool  theIsEmulated 
)
pure virtual

Handle mouse button press/release event. This method is expected to be called from UI thread.

Parameters
thePointmouse cursor position
theButtonspressed buttons
theModifierskey modifiers
theIsEmulatedif TRUE then mouse event comes NOT from real mouse but emulated from non-precise input like touch on screen
Returns
TRUE if window content should be redrawn

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ UpdateMousePosition()

virtual bool Aspect_WindowInputListener::UpdateMousePosition ( const Graphic3d_Vec2i thePoint,
Aspect_VKeyMouse  theButtons,
Aspect_VKeyFlags  theModifiers,
bool  theIsEmulated 
)
pure virtual

Handle mouse cursor movement event. This method is expected to be called from UI thread. Default implementation does nothing.

Parameters
thePointmouse cursor position
theButtonspressed buttons
theModifierskey modifiers
theIsEmulatedif TRUE then mouse event comes NOT from real mouse but emulated from non-precise input like touch on screen
Returns
TRUE if window content should be redrawn

Implemented in AIS_ViewController.

◆ UpdateMouseScroll()

virtual bool Aspect_WindowInputListener::UpdateMouseScroll ( const Aspect_ScrollDelta theDelta)
pure virtual

Update mouse scroll event. This method is expected to be called from UI thread.

Parameters
theDeltamouse cursor position and delta
Returns
TRUE if new event has been created or FALSE if existing one has been updated

Implemented in AIS_ViewController, and ViewerTest_EventManager.

◆ UpdateTouchPoint()

virtual void Aspect_WindowInputListener::UpdateTouchPoint ( Standard_Size  theId,
const Graphic3d_Vec2d thePnt 
)
virtual

Update touch point with the given ID. If point with specified ID was not registered before, it will be added. This method is expected to be called from UI thread.

Parameters
theIdtouch unique identifier
thePnttouch coordinates

Reimplemented in AIS_ViewController.

Field Documentation

◆ my3dMouseAccelRotate

float Aspect_WindowInputListener::my3dMouseAccelRotate
protected

acceleration ratio for rotation event

◆ my3dMouseAccelTrans

float Aspect_WindowInputListener::my3dMouseAccelTrans
protected

acceleration ratio for translation event

◆ my3dMouseButtonState

bool Aspect_WindowInputListener::my3dMouseButtonState[32]
protected

cached button state

◆ my3dMouseIsQuadric

bool Aspect_WindowInputListener::my3dMouseIsQuadric
protected

quadric acceleration

◆ my3dMouseNoRotate

NCollection_Vec3<bool> Aspect_WindowInputListener::my3dMouseNoRotate
protected

ignore 3d mouse rotation axes

◆ my3dMouseToReverse

NCollection_Vec3<bool> Aspect_WindowInputListener::my3dMouseToReverse
protected

reverse 3d mouse rotation axes

◆ myEventTimer

OSD_Timer Aspect_WindowInputListener::myEventTimer
protected

timer for timestamping events

◆ myKeys

Aspect_VKeySet Aspect_WindowInputListener::myKeys
protected

keyboard state

◆ myMouseModifiers

Aspect_VKeyFlags Aspect_WindowInputListener::myMouseModifiers
protected

active key modifiers passed with last mouse event

◆ myMousePositionLast

Graphic3d_Vec2i Aspect_WindowInputListener::myMousePositionLast
protected

last mouse position

◆ myMousePressed

Aspect_VKeyMouse Aspect_WindowInputListener::myMousePressed
protected

active mouse buttons

◆ myTouchPoints

Aspect_TouchMap Aspect_WindowInputListener::myTouchPoints
protected

map of active touches


The documentation for this class was generated from the following file: