SoXt  1.4.1
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoXtMouse Class Reference

The SoXtMouse class is the mouse input device abstraction. More...

#include <Inventor/Xt/devices/SoXtMouse.h>

Inheritance diagram for SoXtMouse:
SoXtDevice SoXtObject

Public Types

enum  Events {
  BUTTON_PRESS = 0x01 , BUTTON_RELEASE = 0x02 , POINTER_MOTION = 0x04 , BUTTON_MOTION = 0x08 ,
  ALL_EVENTS = BUTTON_PRESS | BUTTON_RELEASE | POINTER_MOTION | BUTTON_MOTION
}
 

Public Member Functions

 SoXtMouse (int eventmask=ALL_EVENTS)
 
virtual ~SoXtMouse (void)
 
virtual void disable (Widget widget, SoXtEventHandler *handler, void *closure)
 
virtual void enable (Widget widget, SoXtEventHandler *handler, void *closure)
 
virtual const SoEvent * translateEvent (XAnyEvent *event)
 
- Public Member Functions inherited from SoXtDevice
virtual ~SoXtDevice ()
 
SbVec2s getWindowSize (void) const
 
void setWindowSize (const SbVec2s size)
 
- Public Member Functions inherited from SoXtObject
virtual SoType getTypeId (void) const =0
 
SbBool isOfType (SoType type) const
 

Additional Inherited Members

- Static Public Member Functions inherited from SoXtDevice
static void initClasses (void)
 
- Static Public Member Functions inherited from SoXtObject
static SoType getClassTypeId (void)
 
static void init (void)
 
static void initClass (void)
 
- Protected Member Functions inherited from SoXtDevice
 SoXtDevice (void)
 
void addEventHandler (Widget, SoXtEventHandler *, void *)
 
void invokeHandlers (XAnyEvent *event)
 
void removeEventHandler (Widget, SoXtEventHandler *, void *)
 
void setEventPosition (SoEvent *event, int x, int y) const
 
- Static Protected Member Functions inherited from SoXtDevice
static SbVec2s getLastEventPosition (void)
 

Detailed Description

The SoXtMouse class is the mouse input device abstraction.

The SoXtMouse class is the glue between native mouse handling and mouse interaction in the Inventor scene graph.

All components derived from the SoXtRenderArea have got an SoXtMouse device attached by default.

One important note for application programmers: our mappings to SoMouseButtonEvent::BUTTON2 and SoMouseButtonEvent::BUTTON3 do not match the mappings in SGI's InventorXt library or TGS's SoWin library for 3-button mice. They map mouse buttons like this:

  • left button: SoMouseButtonEvent::BUTTON1
  • middle button: SoMouseButtonEvent::BUTTON2
  • right button: SoMouseButtonEvent::BUTTON3

While in this SIM SoXt library the mappings are:

  • left button: SoMouseButtonEvent::BUTTON1
  • middle button: SoMouseButtonEvent::BUTTON3
  • right button: SoMouseButtonEvent::BUTTON2

This is a conscious design decision we've made. The reason is that BUTTON2 should be the right mouse button whether you have a 2-button mouse or a 3-button mouse.

Member Enumeration Documentation

◆ Events

Enumeration over supported mouse events.

Enumerator
BUTTON_PRESS 

Maskbit for mouse button press events.

BUTTON_RELEASE 

Maskbit for mouse button release events.

POINTER_MOTION 

Maskbit for mouse pointer motion events.

BUTTON_MOTION 

Maskbit for mouse pointer motion events with one or more mouse buttons pressed.

ALL_EVENTS 

Mask which includes all the maskbits in the enum (i.e. use this to signal interest in all kinds of events for the mouse device).

Constructor & Destructor Documentation

◆ SoXtMouse()

SoXtMouse::SoXtMouse ( int mask = ALL_EVENTS)

Constructor. The mask argument should contain the set of SoXtMouse::Events one is interested in tracking.

◆ ~SoXtMouse()

SoXtMouse::~SoXtMouse ( void )
virtual

Destructor.

Member Function Documentation

◆ disable()

void SoXtMouse::disable ( Widget widget,
SoXtEventHandler * handler,
void * closure )
virtual

This method will disable the handler for the device.

Implements SoXtDevice.

◆ enable()

void SoXtMouse::enable ( Widget widget,
SoXtEventHandler * handler,
void * closure )
virtual

This method will enable the device for the widget.

handler is invoked with the closure argument when an event occur in widget.

Implements SoXtDevice.

◆ translateEvent()

const SoEvent * SoXtMouse::translateEvent ( XAnyEvent * event)
virtual

Translates a native event from the underlying toolkit into a generic event.

This is then returned in the form of an instance of a subclass of the Inventor API's SoEvent class, either an SoMouseButtonEvent or an SoLocation2Event, depending on whether the native event is a mouse button press / release, or a mouse cursor movement event.

The mapping of the mouse buttons upon generation of SoMouseButtonEvent events will be done as follows:

  • left mouse button: SoMouseButtonEvent::BUTTON1
  • right mouse button: SoMouseButtonEvent::BUTTON2
  • middle mouse button, if available: SoMouseButtonEvent::BUTTON3
  • forward motion on a wheel mouse: SoMouseButtonEvent::BUTTON4
  • backward motion on a wheel mouse: SoMouseButtonEvent::BUTTON5

Note that the rightmost mouse button will always map to SoMouseButtonEvent::BUTTON2, even on a 3-button mouse.

Implements SoXtDevice.


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