Rogue Wave Views Foundation Package API Reference Guide |
Rogue Wave Views Documentation Home |
Base class for accelerators. More...
#include <ilviews/util/accel.h>
Public Member Functions | |
IlUShort | data () const |
Gets the event data. More... | |
IlBoolean | match (IlvEventType type, IlUShort data, IlUShort modifiers) const |
Tests if two accelerator descriptions are equivalent. More... | |
IlUShort | modifiers () const |
Gets the modifiers. More... | |
IlUShort | modMask () const |
Gets the modifiers to ignore. More... | |
void | setModMask (IlUShort modifiersToIgnore) |
Sets the modifiers to ignore. More... | |
IlBoolean | trigger (IlvEventType type, IlUShort data, IlUShort modifiers) const |
Tests if an event triggers an accelerator. More... | |
IlvEventType | type () const |
Gets the event type. More... | |
IlAny | userArg () const |
Gets the user argument. More... | |
Base class for accelerators.
Library: views
This abstract class provides a way to handle an application accelerator, that is, an action and an event description that specify how the action must be triggered.
The event description is represented by the following data members:
type()
: the event type, that is, IlvKeyDown
, IlvButtonUp
, and so on. data()
: the event data. This value depends on the event type. For instance, it could be b
or IlvTab
for an IlvKeyDown
event, or it could be IlvLeftButton
for an IlvButtonDown
event. modifiers()
: a set of mandatory modifiers. This is an OR combination of modifier values, for instance, IlvCtrlModifier IlvLeftButton
. modMask()
: a modifier mask, that is, a set of modifiers to ignore. This, too, is an OR combination. If a modifier value is found in both modifiers()
and modMask()
, its value is removed from modMask()
, which means that this modifier remains mandatory to trigger the accelerator.
An accelerator on the IlvButtonDragged
event can be triggered only if its members data
and modifiers
have the same value. For instance:
type()
: IlvButtonDragged data()
: IlvButtonLeft modifiers()
: IlvButtonLeft Generally speaking, an IlvButtonDragged
event is always associated with a modifier. The Rogue Wave Views behavior in this specific case mimics the X11 behavior, meaning the modifiers field contains flags for the mouse buttons.
This class does not provide prototype or storage for the accelerator action itself; this must be done in the subclasses because they need specific signatures. However, it provides storage for a user argument that can be used by subclasses as a parameter for the action.
IlvAccelerator
provides methods to determine if a given event description matches the accelerator internal description.
This class has no constructor – the constructor is protected. Subclasses must provide a public constructor.
IlvContainerAccelerator
, IlvManagerAccelerator
. IlUShort IlvAccelerator::data | ( | ) | const |
Gets the event data.
IlBoolean IlvAccelerator::match | ( | IlvEventType | type, |
IlUShort | data, | ||
IlUShort | modifiers | ||
) | const |
Tests if two accelerator descriptions are equivalent.
This member function is only used by subclasses to determine if two accelerator descriptions are equivalent. Ideally, there should not be two equivalent accelerators in the same accelerator set. This function ignores the modifier mask member.
type | The event type. |
data | The event data. |
modifiers | The set of mandatory modifiers. |
IlTrue
if the accelerator is equivalent to the event description. Otherwise, returns IlFalse
. IlUShort IlvAccelerator::modifiers | ( | ) | const |
Gets the modifiers.
IlUShort IlvAccelerator::modMask | ( | ) | const |
Gets the modifiers to ignore.
void IlvAccelerator::setModMask | ( | IlUShort | modifiersToIgnore | ) |
Sets the modifiers to ignore.
Sets the modifiers to ignore. This function can be called only after the modifiers are set.
modifiersToIgnore | The modifier mask. |
IlBoolean IlvAccelerator::trigger | ( | IlvEventType | type, |
IlUShort | data, | ||
IlUShort | modifiers | ||
) | const |
Tests if an event triggers an accelerator.
type | The event type. |
data | The event data. |
modifiers | The set of mandatory modifiers. |
IlTrue
if the event description given in parameter triggers the accelerator action. This happens if, and only if: type()
data()
modifiers()
and a subset of modifiers()
+ modMask()
(that is, modifiers contains all the required modifiers and possibly some others from modMask()
). IlvEventType IlvAccelerator::type | ( | ) | const |
Gets the event type.
IlAny IlvAccelerator::userArg | ( | ) | const |
Gets the user argument.
© 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.