![]() |
ImFusion SDK 4.3
|
Platform-agnostic abstraction layer for input event handling. More...
Platform-agnostic abstraction layer for input event handling.
One essential building block of the ImFusionGUI component is the generic abstraction layer to handle input events from the user such as mouse, touch, or keyboard events.
The main classes and interfaces of this component are as follows:
EventResult handleInputEvent(const InputEvent& event)
. Most classes of this component such as Display, View, ViewObject, or ViewOverlay have such a member function.A separate platform-specific wrapper will convert the native input events from the GUI toolkit (e.g. Qt) to the generic InputEvents. The InputEvent is then passed to one or multiple event handlers (usually the Display). They return a EventResult instance which can eventually converted back to platform-specific actions. The ImFusion SDK provides the necessary classes for integration into a Qt-based application. Integrations for other GUI toolkits are usually straight-forward to implement.
A basic input event handler function for a button overlay could look like this:
Due to the hierarchical nature of the view framework a single InputEvent is often passed to multiple handlers in a cascading fashion until it is consumed in a terminal fashion and propagation stops. A typical usage looks like this
Classes | |
struct | EventResult |
Simple record intended to be used as return value of the a handleInputEvent() function to indicate how to proceed. More... | |
class | InputEvent |
Base class for user input events in a graphical user interface (GUI). More... | |
class | KeyEvent |
Key events are triggered when a keyboard key was pressed or released on the GUI. More... | |
class | MouseEvent |
Mouse events are triggered whenever the status of the mouse has changed wrt. More... | |
class | TouchEvent |
Touch events occur when pressing, releasing, or moving one ore multiple touch points on a touch device. More... | |
class | ContextMenuEvent |
A ContextMenuEvent signals that a context-sensitive popup menu was requested by the user, for instance by a click with the right mouse button. More... | |
class | InputEventMapperBase |
Helper class to maintain a map of mouse/keyboard combinations to an enumeration of actions. More... | |
class | InputEventMapper< T > |
Specialization of InputEventMapperBase with a templated action enumeration type to increase type safety. More... | |
class | Menu |
Represents a hierarchical menu of actions used to describe menu bars, context menus, or popup menus. More... | |
Enumerations | |
enum class | MouseCursorShape { Default , PointingHand , Crosshair , Help , Busy , Wait , OpenHand , ClosedHand , SizeVertical , SizeHorizontal , SizeDiagonalBLTR , SizeDiagonalTLBR , SizeAll , SplitVertical , SplitHorizontal , TextInput , Forbidden , Blank , Custom = 100 } |
Enumeration of cursor shapes that are usually available on all platforms. More... | |
|
strong |
#include <ImFusion/GUI/MouseCursorShape.h>
Enumeration of cursor shapes that are usually available on all platforms.