# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::UIEventListener Class Reference

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

`#include <UIEventListener.hpp>`

Inheritance diagram for vl::UIEventListener:

List of all members.

## Public Member Functions
virtual const char * | className ()
| Returns the name of the class.
| UIEventListener ()
virtual | ~UIEventListener ()
virtual void | initEvent ()
virtual void | mouseMoveEvent (int, int)
virtual void | mouseUpEvent (EMouseButton, int, int)
virtual void | mouseDownEvent (EMouseButton, int, int)
virtual void | mouseWheelEvent (int)
virtual void | keyPressEvent (unsigned short, EKey)
virtual void | keyReleaseEvent (unsigned short, EKey)
virtual void | resizeEvent (int, int)
virtual void | destroyEvent ()
virtual void | runEvent ()
virtual void | visibilityEvent (bool)
virtual void | fileDroppedEvent (const std::vector< String > &)
virtual void | openglContextBoundEvent (OpenGLContext *)
void | setRank (int rank)
int | rank () const
OpenGLContext * | openglContext ()
| Returns the OpenGL context to which this UIEventListener is bound or NULL if no context is bound.
virtual void | setEnabled (bool enabled)
| Enables or disables a UIEventListener.
virtual void | prepareToReconnect ()
| Reimplement this in order to react to a setEnabled(true), see setEnabled() for more information.
bool | isEnabled () const
bool | operator< (const UIEventListener &other) const
## Protected Attributes
OpenGLContext * | mOpenGLContext
int | mRank
bool | mEnabled
## Friends
class | OpenGLContext

## 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 BanckendAdaper 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.

## Constructor & Destructor Documentation

vl::UIEventListener::UIEventListener | ( |  | ) | `[inline]`

virtual vl::UIEventListener::~UIEventListener | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

virtual const char* vl::UIEventListener::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::GhostCameraManipulator, vl::TrackballManipulator, and vlut::Applet.

virtual void vl::UIEventListener::initEvent | ( |  | ) | `[inline, virtual]`

Reimplemented in vlut::Applet.

virtual void vl::UIEventListener::mouseMoveEvent | ( | int | ,
|  | int |  |
| ) |  |  | `[inline, virtual]`

Reimplemented in vl::GhostCameraManipulator, and vl::TrackballManipulator.

virtual void vl::UIEventListener::mouseUpEvent | ( | EMouseButton | ,
|  | int | ,
|  | int |  |
| ) |  |  | `[inline, virtual]`

Reimplemented in vl::TrackballManipulator.

virtual void vl::UIEventListener::mouseDownEvent | ( | EMouseButton | ,
|  | int | ,
|  | int |  |
| ) |  |  | `[inline, virtual]`

Reimplemented in vl::TrackballManipulator.

virtual void vl::UIEventListener::mouseWheelEvent | ( | int |  | ) | `[inline, virtual]`

virtual void vl::UIEventListener::keyPressEvent | ( | unsigned | short,
|  | EKey |  |
| ) |  |  | `[inline, virtual]`

virtual void vl::UIEventListener::keyReleaseEvent | ( | unsigned | short,
|  | EKey |  |
| ) |  |  | `[inline, virtual]`

Reimplemented in vlut::Applet.

virtual void vl::UIEventListener::resizeEvent | ( | int | ,
|  | int |  |
| ) |  |  | `[inline, virtual]`

Reimplemented in vlut::Applet.

virtual void vl::UIEventListener::destroyEvent | ( |  | ) | `[inline, virtual]`

Reimplemented in vlut::Applet.

virtual void vl::UIEventListener::runEvent | ( |  | ) | `[inline, virtual]`

Reimplemented in vl::GhostCameraManipulator, and vlut::Applet.

virtual void vl::UIEventListener::visibilityEvent | ( | bool |  | ) | `[inline, virtual]`

virtual void vl::UIEventListener::fileDroppedEvent | ( | const std::vector< String > & |  | ) | `[inline, virtual]`

virtual void vl::UIEventListener::openglContextBoundEvent | ( | OpenGLContext * |  | ) | `[inline, virtual]`

Reimplemented in vlut::Applet.

void UIEventListener::setRank | ( | int | rank | ) |

int UIEventListener::rank | ( |  | ) | const

OpenGLContext * UIEventListener::openglContext | ( |  | ) |

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

virtual void vl::UIEventListener::setEnabled | ( | bool | enabled | ) | `[inline, virtual]`

Enables or disables a UIEventListener.

Note:
  When an UIEventListener is enabled its prepareToReconnect() method is called so that it can be appropriately setup before it starts to receive events.

virtual void vl::UIEventListener::prepareToReconnect | ( |  | ) | `[inline, virtual]`

Reimplement this in order to react to a setEnabled(true), see setEnabled() for more information.

Reimplemented in vl::GhostCameraManipulator, and vl::TrackballManipulator.

bool vl::UIEventListener::isEnabled | ( |  | ) | const`[inline]`

bool vl::UIEventListener::operator< | ( | const UIEventListener & | other | ) | const`[inline]`

## Friends And Related Function Documentation

friend class OpenGLContext`[friend]`

## Member Data Documentation

OpenGLContext* vl::UIEventListener::mOpenGLContext`[protected]`

int vl::UIEventListener::mRank`[protected]`

bool vl::UIEventListener::mEnabled`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/UIEventListener.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/OpenGLContext.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 29 11:11:55 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.