Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Friends | List of all members
vl::UIEventListener Class Referenceabstract

The UIEventListener class listens to the events emitted by an OpenGLContext. More...

#include <UIEventListener.hpp>

+ Inheritance diagram for vl::UIEventListener:

Public Member Functions

 UIEventListener ()
 Constructor. More...
 
virtual void initEvent ()=0
 Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext. More...
 
virtual void destroyEvent ()=0
 Event generated right before the bound OpenGLContext is destroyed. More...
 
virtual void updateEvent ()=0
 Event generated when the bound OpenGLContext does not have any other message to process and OpenGLContext::continuousUpdate() is set to true or somebody calls OpenGLContext::update(). More...
 
virtual void enableEvent (bool enabled)=0
 Event generated whenever setEnabled() is called. More...
 
virtual void addedListenerEvent (OpenGLContext *)=0
 Event generated whenever a listener is bound to an OpenGLContext context. More...
 
virtual void removedListenerEvent (OpenGLContext *)=0
 Event generated whenever a listener is unbound from an OpenGLContext context. More...
 
virtual void mouseMoveEvent (int x, int y)=0
 Event generated when the mouse moves. More...
 
virtual void mouseUpEvent (EMouseButton button, int x, int y)=0
 Event generated when one of the mouse buttons is released. More...
 
virtual void mouseDownEvent (EMouseButton button, int x, int y)=0
 Event generated when one of the mouse buttons is pressed. More...
 
virtual void mouseWheelEvent (int n)=0
 Event generated when the mouse wheel rotated. More...
 
virtual void keyPressEvent (unsigned short unicode_ch, EKey key)=0
 Event generated when a key is pressed. More...
 
virtual void keyReleaseEvent (unsigned short unicode_ch, EKey key)=0
 Event generated when a key is released. More...
 
virtual void resizeEvent (int x, int y)=0
 Event generated when the bound OpenGLContext is resized. More...
 
virtual void fileDroppedEvent (const std::vector< String > &files)=0
 Event generated when one or more files are dropped on the bound OpenGLContext's area. More...
 
virtual void visibilityEvent (bool visible)=0
 Event generated when the bound OpenGLContext is shown or hidden. More...
 
virtual void setEnabled (bool enabled)
 Enables or disables a UIEventListener. More...
 
bool isEnabled () const
 Returns whether the UIEventListener is currently enabled or not. More...
 
OpenGLContextopenglContext ()
 Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound. More...
 
const OpenGLContextopenglContext () const
 Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Friends

class OpenGLContext
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

The UIEventListener class listens to the events emitted by an OpenGLContext.

Remarks
  • Qt amongst others does not distinguish between left and right alt, shift and control keys, which means that you won't receive messages like Key_LeftCtrl, Key_RightCtrl, Key_LeftAlt, Key_RightAlt, Key_LeftShift and Key_RightShift but only the more general Key_Ctrl, Key_Alt and Key_Shift messages.
  • SDL supports Unicode only partially at the moment, which means that you will receive Unicode codes only for key press events and not for release events.
  • keyPressed() returns the correct state only for the keys whose messages have been received by the OpenGLContext. This means that for example if a key was pressed when the OpenGLContext did not have the keyboard focus, the function keyPressed() will wrongly report a released state for that key. If a key release event is not sent to the OpenGLContext because generated when the OpenGLContext did not have the keyboard focus, the function keyPressed() will wrongly report a pressed state for that key.

Definition at line 55 of file UIEventListener.hpp.

Constructor & Destructor Documentation

◆ UIEventListener()

vl::UIEventListener::UIEventListener ( )
inline

Constructor.

Definition at line 63 of file UIEventListener.hpp.

Member Function Documentation

◆ addedListenerEvent()

virtual void vl::UIEventListener::addedListenerEvent ( OpenGLContext )
pure virtual

Event generated whenever a listener is bound to an OpenGLContext context.

Implemented in vl::TrackballManipulator, vl::FlatManipulator, vl::Applet, and vl::GhostCameraManipulator.

Referenced by vl::OpenGLContext::addEventListener().

◆ destroyEvent()

virtual void vl::UIEventListener::destroyEvent ( )
pure virtual

Event generated right before the bound OpenGLContext is destroyed.

Implemented in vl::TrackballManipulator, vl::Applet, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ enableEvent()

virtual void vl::UIEventListener::enableEvent ( bool  enabled)
pure virtual

Event generated whenever setEnabled() is called.

Implemented in vl::Applet, vl::TrackballManipulator, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ fileDroppedEvent()

virtual void vl::UIEventListener::fileDroppedEvent ( const std::vector< String > &  files)
pure virtual

Event generated when one or more files are dropped on the bound OpenGLContext's area.

Implemented in vl::TrackballManipulator, vl::Applet, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ initEvent()

virtual void vl::UIEventListener::initEvent ( )
pure virtual

Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.

Implemented in vl::Applet, vl::TrackballManipulator, vl::FlatManipulator, and vl::GhostCameraManipulator.

Referenced by vl::OpenGLContext::addEventListener().

◆ isEnabled()

bool vl::UIEventListener::isEnabled ( ) const
inline

Returns whether the UIEventListener is currently enabled or not.

Definition at line 119 of file UIEventListener.hpp.

◆ keyPressEvent()

virtual void vl::UIEventListener::keyPressEvent ( unsigned short  unicode_ch,
EKey  key 
)
pure virtual

Event generated when a key is pressed.

Implemented in vl::Applet, vl::TrackballManipulator, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ keyReleaseEvent()

virtual void vl::UIEventListener::keyReleaseEvent ( unsigned short  unicode_ch,
EKey  key 
)
pure virtual

Event generated when a key is released.

Implemented in vl::TrackballManipulator, vl::FlatManipulator, vl::GhostCameraManipulator, and vl::Applet.

◆ mouseDownEvent()

virtual void vl::UIEventListener::mouseDownEvent ( EMouseButton  button,
int  x,
int  y 
)
pure virtual

Event generated when one of the mouse buttons is pressed.

Implemented in vl::Applet, vl::GhostCameraManipulator, vl::TrackballManipulator, and vl::FlatManipulator.

◆ mouseMoveEvent()

virtual void vl::UIEventListener::mouseMoveEvent ( int  x,
int  y 
)
pure virtual

Event generated when the mouse moves.

Implemented in vl::Applet, vl::TrackballManipulator, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ mouseUpEvent()

virtual void vl::UIEventListener::mouseUpEvent ( EMouseButton  button,
int  x,
int  y 
)
pure virtual

Event generated when one of the mouse buttons is released.

Implemented in vl::Applet, vl::TrackballManipulator, vl::GhostCameraManipulator, and vl::FlatManipulator.

◆ mouseWheelEvent()

virtual void vl::UIEventListener::mouseWheelEvent ( int  n)
pure virtual

Event generated when the mouse wheel rotated.

Implemented in vl::Applet, vl::TrackballManipulator, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ openglContext() [1/2]

OpenGLContext * UIEventListener::openglContext ( )

◆ openglContext() [2/2]

const OpenGLContext* vl::UIEventListener::openglContext ( ) const

Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound.

◆ removedListenerEvent()

virtual void vl::UIEventListener::removedListenerEvent ( OpenGLContext )
pure virtual

Event generated whenever a listener is unbound from an OpenGLContext context.

Implemented in vl::TrackballManipulator, vl::FlatManipulator, vl::Applet, and vl::GhostCameraManipulator.

Referenced by vl::OpenGLContext::removeEventListener().

◆ resizeEvent()

virtual void vl::UIEventListener::resizeEvent ( int  x,
int  y 
)
pure virtual

Event generated when the bound OpenGLContext is resized.

Implemented in vl::TrackballManipulator, vl::FlatManipulator, vl::GhostCameraManipulator, and vl::Applet.

◆ setEnabled()

virtual void vl::UIEventListener::setEnabled ( bool  enabled)
inlinevirtual

Enables or disables a UIEventListener.

Note
When an UIEventListener is enabled or disabled its enableEvent(bool enabled) method is called.

Definition at line 116 of file UIEventListener.hpp.

Referenced by vl::OpenGLContext::applyRenderStates().

◆ updateEvent()

virtual void vl::UIEventListener::updateEvent ( )
pure virtual

Event generated when the bound OpenGLContext does not have any other message to process and OpenGLContext::continuousUpdate() is set to true or somebody calls OpenGLContext::update().

Implemented in vl::TrackballManipulator, vl::Applet, vl::FlatManipulator, and vl::GhostCameraManipulator.

◆ visibilityEvent()

virtual void vl::UIEventListener::visibilityEvent ( bool  visible)
pure virtual

Event generated when the bound OpenGLContext is shown or hidden.

Implemented in vl::TrackballManipulator, vl::Applet, vl::FlatManipulator, and vl::GhostCameraManipulator.

Friends And Related Function Documentation

◆ OpenGLContext

friend class OpenGLContext
friend

Definition at line 59 of file UIEventListener.hpp.


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