Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvEvent Class Reference

Event handling class. More...

#include <ilviews/base/event.h>

Public Member Functions

IlUShort getButton () const
 Retrieves the mouse button. More...
 
void getGLocation (IlvPoint &p) const
 Retrieves the global location of the event. More...
 
const IlvPointgetGLocation () const
 Retrieves the global location of the event. More...
 
IlvPos getGx () const
 Retrieves the global x location of the event. More...
 
IlvPos getGy () const
 Retrieves the global y location of the event. More...
 
IlvDim getH () const
 Retrieves the height of the exposed area. More...
 
IlAny getInternal () const
 The underlying system object reflected by this IlvEvent. More...
 
IlUShort getKey () const
 Retrieves the key code. More...
 
void getLocation (IlvPoint &p) const
 Retrieves the location of the event. More...
 
IlUShort getModifiers () const
 Retrieves the modifiers. More...
 
int getMultiClickCount () const
 Retrieves the mouse clicks count. More...
 
IlUShort getTouchPoint () const
 Retrieves the ID of a touch point for WM_TOUCH events. More...
 
IlvEventType getType () const
 Returns the event type. More...
 
IlvAbstractViewgetView () const
 Retrieves the view in which the event occurred. More...
 
IlvDim getW () const
 Retrieves the width of the exposed area. More...
 
IlvPos getX () const
 Retrieves the x location of the event. More...
 
IlvPos getY () const
 Retrieves the y location of the event. More...
 

Detailed Description

Event handling class.

Library: xviews or winviews or mviews (mutually exclusive)

The IlvEvent class handles all the events that the views can receive, such as mouse and keyboard events.

Member Function Documentation

IlUShort IlvEvent::getButton ( ) const

Retrieves the mouse button.

Returns
A number indicating the relevant mouse button. Its value is meaningful only when the event has something to do with a mouse-button event (that is, when getType() returns either IlvButtonDown, IlvButtonUp, or IlvButtonDragged). Several mouse buttons are envisaged and can be combined for multiple button situations: IlvLeftButton, IlvMiddleButton, IlvRightButton and others values that are rarely used.

You can check whether any of the pointing device buttons is pressed by masking the getButton() value with IlvAnyButton. If the result of an AND operation between those two values is not 0, then a button has been pressed.

void IlvEvent::getGLocation ( IlvPoint p) const

Retrieves the global location of the event.

The returned point indicates the location of the event, relatively to the upper left-hand corner of the screen.

Parameters
pIs set to the global location of the event.
const IlvPoint& IlvEvent::getGLocation ( ) const

Retrieves the global location of the event.

The returned point indicates the location of the event, relatively to the upper left-hand corner of the screen.

Returns
The global location of the event.
IlvPos IlvEvent::getGx ( ) const

Retrieves the global x location of the event.

Returns
The global x location of the event.
See also
getGLocation().
IlvPos IlvEvent::getGy ( ) const

Retrieves the global y location of the event.

Returns
The global y location of the event.
See also
getGLocation().
IlvDim IlvEvent::getH ( ) const

Retrieves the height of the exposed area.

This value is meaningful only in the case of an Expose event (of the IlvRepaint type).

Returns
The height of the exposed area (the rectangle for which the display system requests a region update). The other parameters of this rectangle are available using getX(), getY() and getW().
IlAny IlvEvent::getInternal ( ) const

The underlying system object reflected by this IlvEvent.

Returns
A pointer to the system event object that generated this IlvEvent. This object is system dependent.
IlUShort IlvEvent::getKey ( ) const

Retrieves the key code.

Returns
The code of a keyboard key that may have been pressed. It is relevant only when the member function type of your IlvEvent object has returned IlvKeyUp or IlvKeyDown. The value returned by this member function is either the ASCII code of the key that was pressed or a special code corresponding to one of the many keys available on the majority of keyboards. (see IlvDeleteKey, IlvF0Key...IlvF19Key, and so on).

Not every kind of keyboard will be able to produce each of these key codes. The values IlvUpKey, IlvDownKey, IlvLeftKey and IlvRightKey identify the arrow-pad keys. States of modifier keys such as Shift, Control and CAPS LOCK are managed internally. To ensure portability, do not define any other keyboard keys.

void IlvEvent::getLocation ( IlvPoint p) const

Retrieves the location of the event.

The returned point indicates the location of the event, relatively to the upper left-hand corner of the view where the event occurred.

In the case of an expose event, this point is the upper-left corner of the exposed region (see getW and getH).

Parameters
pIs set to the location of the event.
IlUShort IlvEvent::getModifiers ( ) const

Retrieves the modifiers.

Returns
The current state of the modifier keys: IlvShiftModifier, IlvCtrlModifier, IlvAltModifier, IlvMetaModifier, IlvNumModifier, IlvLockModifier, IlvAltGModifier.

You can check for the presence of any of these modifiers by masking the modifiers value with IlvAnyModifier.

These values can be combined with a mouse-button code by means of an OR operation. Consequently, your programs can detect the combined effect of mouse-button and modifier-key states for any event.

Because typing a letter key combined with a Shift or Control key returns a different result depending on the system used, all letter-derived events lose their Shift/Control modifiers. It therefore becomes much easier to simply check the ASCII code of the key. For example, the ASCII code for Ctrl-A is converted to IlvCtrlChar('A'), which is 1.

Other examples
When you press Shift-A you receive an event with the following fields:

data.key = 'A'
modifiers = 0

When you press Ctrl-A you receive an event with the following fields:

data.key = 1
modifiers = 0

When you press Ctrl-Shift-A, you do not lose the Shift modifier and the event has the following fields:

data.key = 1
modifiers = IlvShiftModifier
int IlvEvent::getMultiClickCount ( ) const

Retrieves the mouse clicks count.

Returns
The number of mouse clicks for an IlvMultiClick event only.
IlUShort IlvEvent::getTouchPoint ( ) const

Retrieves the ID of a touch point for WM_TOUCH events.

The returned index can be used to retrieve the touch point into an array filled by IlvDisplay::getTouchPoints() function. This index is unique for the lifetime of a touch point, but once the touch point disappears, its index can be reused for a future touch point.

IlvEventType IlvEvent::getType ( ) const

Returns the event type.

Returns
The type of the event as one of the values whose names appear in the definition of the IlvEventType enumeration type.
IlvAbstractView* IlvEvent::getView ( ) const

Retrieves the view in which the event occurred.

Returns
The view in which the event occurred.
IlvDim IlvEvent::getW ( ) const

Retrieves the width of the exposed area.

This value is meaningful only in the case of an Expose event (of the IlvRepaint type).

Returns
The width of the exposed area (the rectangle for which the display system requests a region update). The other parameters of this rectangle are available using getX(), getY() and getH().
IlvPos IlvEvent::getX ( ) const

Retrieves the x location of the event.

Returns
The x location of the event.
See also
getLocation().
IlvPos IlvEvent::getY ( ) const

Retrieves the y location of the event.

Returns
The y location of the event.
See also
getLocation().

© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.