rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvEvent Class Reference

Event handling class. More...

#include <ilviews/base/event.h>

List of all members.

Public Member Functions

IlUShort getButton () const
 Retrieves the mouse button.
const IlvPointgetGLocation () const
 Retrieves the global location of the event.
void getGLocation (IlvPoint &p) const
 Retrieves the global location of the event.
IlvPos getGx () const
 Retrieves the global x location of the event.
IlvPos getGy () const
 Retrieves the global y location of the event.
IlvDim getH () const
 Retrieves the height of the exposed area.
IlAny getInternal () const
 Verbose:.
IlUShort getKey () const
 Retrieves the key code.
void getLocation (IlvPoint &p) const
 Retrieves the location of the event.
IlUShort getModifiers () const
 Retrieves the modifiers.
int getMultiClickCount () const
 Retrieves the mouse clicks count.
IlvEventType getType () const
 Verbose:.
IlvAbstractViewgetView () const
 Retrieves the view in which the event occurred.
IlvDim getW () const
 Retrieves the width of the exposed area.
IlvPos getX () const
 Retrieves the x location of the event.
IlvPos getY () const
 Retrieves the y location of the event.

Detailed Description

Event handling class.

Library: display

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 the member function type 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.

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.
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:
p Is set to 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

Verbose:.

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:
p Is 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 Ctrl-Shift-A, you do not lose the Shift modifier and the event has the following fields:

     data.key  = 1
     modifiers = IlvShiftModifier

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

     data.key  = 1
     modifiers = 0

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

     data.key = 'A'
     modifiers = 0
int IlvEvent::getMultiClickCount (  )  const

Retrieves the mouse clicks count.

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

Verbose:.

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.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.