Event handling class. More...
#include <ilviews/base/event.h>
Public Member Functions | |
IlUShort | getButton () const |
Retrieves the mouse button. More... | |
const IlvPoint & | getGLocation () const |
Retrieves the global location of the event. More... | |
void | getGLocation (IlvPoint &p) 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 identifier of a touch point for WM_TOUCH events. More... | |
IlvEventType | getType () const |
Returns the event type. More... | |
IlvAbstractView * | getView () 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... | |
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.
IlUShort IlvEvent::getButton | ( | ) | const |
Retrieves the mouse button.
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.
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.
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.
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.
p | Is set to the global location of the event. |
IlvPos IlvEvent::getGx | ( | ) | const |
Retrieves the global x location of the event.
getGLocation()
. IlvPos IlvEvent::getGy | ( | ) | const |
Retrieves the global y location of the event.
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).
IlAny IlvEvent::getInternal | ( | ) | const |
IlUShort IlvEvent::getKey | ( | ) | const |
Retrieves the key code.
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.
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). 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()
).
p | Is set to the location of the event. |
IlUShort IlvEvent::getModifiers | ( | ) | const |
Retrieves the modifiers.
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:
When you press Ctrl-A
you receive an event with the following fields:
When you press Ctrl-Shift-A
, you do not lose the Shift
modifier and the event has the following fields:
IlvShiftModifier
, IlvCtrlModifier
, IlvAltModifier
, IlvMetaModifier
, IlvNumModifier
, IlvLockModifier
or IlvAltGModifier
. int IlvEvent::getMultiClickCount | ( | ) | const |
Retrieves the mouse clicks count.
IlvMultiClick
event only. IlUShort IlvEvent::getTouchPoint | ( | ) | const |
Retrieves the identifier 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.
IlvEventType
enumeration type. IlvAbstractView* IlvEvent::getView | ( | ) | const |
Retrieves 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).
IlvPos IlvEvent::getX | ( | ) | const |
IlvPos IlvEvent::getY | ( | ) | const |