# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Friends

# 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 ()
| Constructor.
virtual void | initEvent ()=0
| Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.
virtual void | destroyEvent ()=0
| Event generated right before the bound OpenGLContext is destroyed.
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().
virtual void | enableEvent (bool enabled)=0
| Event generated whenever setEnabled() is called.
virtual void | addedListenerEvent (OpenGLContext *)=0
| Event generated whenever a listener is bound to an OpenGLContext context.
virtual void | removedListenerEvent (OpenGLContext *)=0
| Event generated whenever a listener is unbound from an OpenGLContext context.
virtual void | mouseMoveEvent (int x, int y)=0
| Event generated when the mouse moves.
virtual void | mouseUpEvent (EMouseButton button, int x, int y)=0
| Event generated when one of the mouse buttons is released.
virtual void | mouseDownEvent (EMouseButton button, int x, int y)=0
| Event generated when one of the mouse buttons is pressed.
virtual void | mouseWheelEvent (int n)=0
| Event generated when the mouse wheel rotated.
virtual void | keyPressEvent (unsigned short unicode_ch, EKey key)=0
| Event generated when a key is pressed.
virtual void | keyReleaseEvent (unsigned short unicode_ch, EKey key)=0
| Event generated when a key is released.
virtual void | resizeEvent (int x, int y)=0
| Event generated when the bound OpenGLContext is resized.
virtual void | fileDroppedEvent (const std::vector< String > &files)=0
| Event generated when one or more files are dropped on the bound OpenGLContext's area.
virtual void | visibilityEvent (bool visible)=0
| Event generated when the bound OpenGLContext is shown or hidden.
virtual void | setEnabled (bool enabled)
| Enables or disables a UIEventListener.
bool | isEnabled () const
| Returns whether the UIEventListener is currently enabled or not.
OpenGLContext * | openglContext ()
| Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound.
const OpenGLContext * | openglContext () const
| Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound.

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

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

Constructor.

Definition at line 62 of file UIEventListener.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

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

Returns the name of the class.

Reimplemented from vl::Object.

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

Definition at line 59 of file UIEventListener.hpp.

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::GhostCameraManipulator, and vl::TrackballManipulator.

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

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

Event generated right before the bound OpenGLContext is destroyed.

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

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::Applet, vl::GhostCameraManipulator, and vl::TrackballManipulator.

virtual void vl::UIEventListener::enableEvent | ( | bool | enabled ) | `[pure virtual]`

Event generated whenever setEnabled() is called.

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

virtual void vl::UIEventListener::addedListenerEvent | ( | OpenGLContext * | ) | `[pure virtual]`

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

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

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

virtual void vl::UIEventListener::removedListenerEvent | ( | OpenGLContext * | ) | `[pure virtual]`

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

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

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

virtual void vl::UIEventListener::mouseMoveEvent | ( | int | x,
|  | int | y
| ) |  | `[pure virtual]`

Event generated when the mouse moves.

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

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::GhostCameraManipulator, and vl::TrackballManipulator.

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, and vl::TrackballManipulator.

virtual void vl::UIEventListener::mouseWheelEvent | ( | int | n ) | `[pure virtual]`

Event generated when the mouse wheel rotated.

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

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::GhostCameraManipulator, and vl::TrackballManipulator.

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

Event generated when a key is released.

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

virtual void vl::UIEventListener::resizeEvent | ( | int | x,
|  | int | y
| ) |  | `[pure virtual]`

Event generated when the bound OpenGLContext is resized.

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

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::Applet, vl::GhostCameraManipulator, and vl::TrackballManipulator.

virtual void vl::UIEventListener::visibilityEvent | ( | bool | visible ) | `[pure virtual]`

Event generated when the bound OpenGLContext is shown or hidden.

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

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

Enables or disables a UIEventListener.

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

Definition at line 115 of file UIEventListener.hpp.

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

Returns whether the UIEventListener is currently enabled or not.

Definition at line 118 of file UIEventListener.hpp.

OpenGLContext * UIEventListener::openglContext | ( | ) |

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

Definition at line 72 of file OpenGLContext.cpp.

Referenced by vl::TrackballManipulator::enableEvent(), vl::GhostCameraManipulator::enableEvent(), vl::Applet::keyReleaseEvent(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), vl::GhostCameraManipulator::updateEvent(), and vl::Applet::updateEvent().

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

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

## Friends And Related Function Documentation

friend class OpenGLContext`[friend]`

Definition at line 57 of file UIEventListener.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/UIEventListener.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/OpenGLContext.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:47.
Permission is granted to use this page to write and publish articles regarding Visualization Library.