The EventQueue class implements a queue of Kanzi input events gathered by EventSource instances. More...
#include <kanzi/core.ui/platform/input/common/event_queue.hpp>
Public Types | |
typedef vector< UniqueEventPtr > | Container |
Event container type. | |
using | FilterFunction |
Filter function type to pass to the applyFilter() method. | |
typedef function< ProcessingResult(InputEvent *) | ProcessingFunction) |
The event processing function type passed to processEvents() method. | |
enum | ProcessingResult { Continue , Stop } |
Specifies the results values of the event processing. More... | |
Public Member Functions | |
void | append (EventQueue &other) |
Moves the content of other event queue into this queue, and clears the other queue. | |
void | applyFilter (const FilterFunction &filter) |
Applies the given filter over the event queue. | |
Container::iterator | begin () |
Returns an iterator to the first event in the event queue. | |
Container::const_iterator | cbegin () const |
Returns an iterator to the first event in the event queue. | |
Container::const_iterator | cend () const |
Returns an iterator to the element following the last event in the event queue. | |
void | clear () |
Clears the event queue. | |
Container::iterator | end () |
Returns an iterator to the element following the last event in the event queue. | |
EventQueue () | |
Creates an event queue instance. | |
size_t | getEventCount () const |
Returns the number or events in the queue. | |
Container::iterator | insert (Container::iterator position, UniqueEventPtr &&event) |
Inserts the event into this queue before the given position. | |
bool | isEmpty () const |
Checks for empty queue. | |
Container::iterator | move (Container::iterator position, Container &container) |
Moves the container content into this queue before the given position. | |
void | processEvents (ProcessingFunction function) |
The method loops through the queue events and passes each event to the given function for processing. | |
void | push (UniqueEventPtr event) |
Pushes an event into the queue. | |
Container::iterator | remove (Container::iterator position) |
Removes the event at position from the event queue. | |
void | swap (EventQueue &other) |
Swaps this event queue with the given one. | |
The EventQueue class implements a queue of Kanzi input events gathered by EventSource instances.
Events are low-level Kanzi messages translated from the host operating system, and incorporate input, application, and window management events. Different parts of Kanzi handle these events immediately, whereas other elements, such as InputManager, forward them to input manipulators, which in turn transform them into Kanzi messages.
You can add events to the queue only by using the push() method. The EventQueue takes ownership of the event.
Once the queue events are handled, you can remove them from the queue with the clear() method. It is recommended to clear the queue before or after swapping the queue.
Event container type.
typedef function<ProcessingResult(InputEvent*) kanzi::EventQueue::ProcessingFunction) |
The event processing function type passed to processEvents() method.
The function expects an InputEvent as argument and returns the result of the event processing.
Filter function type to pass to the applyFilter() method.
it | The event queue container iterator to filter. |
|
explicit |
Creates an event queue instance.
void kanzi::EventQueue::processEvents | ( | ProcessingFunction | function | ) |
The method loops through the queue events and passes each event to the given function for processing.
The return value of the function drives the event processing in this way:
function | The function to process the queue events. |
void kanzi::EventQueue::push | ( | UniqueEventPtr | event | ) |
Pushes an event into the queue.
event | The event to push into the queue. |
void kanzi::EventQueue::clear | ( | ) |
Clears the event queue.
size_t kanzi::EventQueue::getEventCount | ( | ) | const |
Returns the number or events in the queue.
bool kanzi::EventQueue::isEmpty | ( | ) | const |
Checks for empty queue.
void kanzi::EventQueue::swap | ( | EventQueue & | other | ) |
Swaps this event queue with the given one.
other | The event queue with which to swap the events. |
void kanzi::EventQueue::append | ( | EventQueue & | other | ) |
Moves the content of other event queue into this queue, and clears the other queue.
other | The event queue to move into this event queue. |
Container::iterator kanzi::EventQueue::insert | ( | Container::iterator | position, |
UniqueEventPtr && | event ) |
Inserts the event into this queue before the given position.
position | The iterator before which to move the content. |
event | The event to insert into the event queue. |
Container::iterator kanzi::EventQueue::move | ( | Container::iterator | position, |
Container & | container ) |
Moves the container content into this queue before the given position.
position | The iterator before which to move the content. |
container | The container to move into the event queue. |
Container::iterator kanzi::EventQueue::remove | ( | Container::iterator | position | ) |
Removes the event at position from the event queue.
position | The iterator to the event to remove. |
|
inline |
Returns an iterator to the first event in the event queue.
|
inline |
Returns an iterator to the element following the last event in the event queue.
|
inline |
Returns an iterator to the first event in the event queue.
|
inline |
Returns an iterator to the element following the last event in the event queue.
void kanzi::EventQueue::applyFilter | ( | const FilterFunction & | filter | ) |
Applies the given filter over the event queue.
filter | The filter object applied over the events from the queue. |