File include/brisk/gui/Event.hpp
¶
Widget
class¶
Widget
eventCookie
variable¶
extern std::atomic_uint32_t eventCookie
Global atomic event counter.
DragEventSubtype
enum¶
enum class DragEventSubtype
Enum representing drag event subtypes.
Over
enumerator (DragEventSubtype::Over
)¶
Dragging over a target.
Enter
enumerator (DragEventSubtype::Enter
)¶
Dragging has entered a target.
Exit
enumerator (DragEventSubtype::Exit
)¶
Dragging has exited a target.
DropEventSubtype
enum¶
enum class DropEventSubtype
Enum representing drop event subtypes.
Drop
enumerator (DropEventSubtype::Drop
)¶
A drop event.
Cancel
enumerator (DropEventSubtype::Cancel
)¶
A canceled drop event.
EventBase
class¶
EventBase
Base struct for events, holding a unique event cookie.
cookie
variable (EventBase::cookie
)¶
uint32_t cookie = ++eventCookie
Unique identifier for the event.
EventInput
class¶
EventInput
Base struct for input events, derived from EventBase.
mods
variable (EventInput::mods
)¶
KeyModifiers mods
Modifiers active during the input event.
EventMouse
class¶
EventMouse
Struct representing a mouse event, derived from EventInput.
point
variable (EventMouse::point
)¶
PointF point
The current mouse position.
downPoint
variable (EventMouse::downPoint
)¶
optional<PointF> downPoint
The mouse position at the time the button was pressed, if applicable.
EventMouseButton
class¶
EventMouseButton
Struct representing a mouse button event, derived from EventMouse.
button
variable (EventMouseButton::button
)¶
MouseButton button
The button involved in the event.
EventMouseMoved
class¶
EventMouseMoved
Struct representing a mouse moved event.
EventMouseYWheel
class¶
EventMouseYWheel
Struct representing a mouse wheel event.
delta
variable (EventMouseYWheel::delta
)¶
float delta
The amount the mouse wheel was scrolled vertically.
EventMouseXWheel
class¶
EventMouseXWheel
Struct representing a mouse wheel event.
delta
variable (EventMouseXWheel::delta
)¶
float delta
The amount the mouse wheel was scrolled horizontally.
EventMouseEntered
class¶
EventMouseEntered
Struct representing a mouse entered event.
EventMouseExited
class¶
EventMouseExited
Struct representing a mouse exited event.
EventMouseButtonPressed
class¶
EventMouseButtonPressed
Struct representing a mouse button pressed event.
EventMouseButtonReleased
class¶
EventMouseButtonReleased
Struct representing a mouse button released event.
EventMouseDoubleClicked
class¶
EventMouseDoubleClicked
Struct representing a mouse double-clicked event.
EventMouseTripleClicked
class¶
EventMouseTripleClicked
Struct representing a mouse triple-clicked event.
EventDragNDrop
class¶
EventDragNDrop
Struct representing a drag-and-drop event.
point
variable (EventDragNDrop::point
)¶
PointF point
The current mouse position during the drag.
downPoint
variable (EventDragNDrop::downPoint
)¶
optional<PointF> downPoint
The initial mouse position when the drag started.
object
variable (EventDragNDrop::object
)¶
std::shared_ptr<Object> object
The object being dragged.
source
variable (EventDragNDrop::source
)¶
std::shared_ptr<Widget> source
The widget initiating the drag.
target
variable (EventDragNDrop::target
)¶
std::shared_ptr<Widget> target
The target widget where the drop may occur.
EventDragging
class¶
EventDragging
Struct representing a dragging event, derived from EventDragNDrop.
subtype
variable (EventDragging::subtype
)¶
DragEventSubtype subtype
Subtype of the drag event.
EventDropped
class¶
EventDropped
Struct representing a dropped event, derived from EventDragNDrop.
subtype
variable (EventDropped::subtype
)¶
DropEventSubtype subtype
Subtype of the drop event.
EventSourceDragging
class¶
EventSourceDragging
Struct representing a source dragging event.
EventSourceDropped
class¶
EventSourceDropped
Struct representing a source dropped event.
EventTargetDragging
class¶
EventTargetDragging
Struct representing a target dragging event.
EventTargetDropped
class¶
EventTargetDropped
Struct representing a target dropped event.
EventKey
class¶
EventKey
Struct representing a key event, derived from EventInput.
key
variable (EventKey::key
)¶
KeyCode key
The key involved in the event.
EventKeyPressed
class¶
EventKeyPressed
Struct representing a key pressed event.
repeat
variable (EventKeyPressed::repeat
)¶
bool repeat
Indicates if the key press is a repeat.
EventKeyReleased
class¶
EventKeyReleased
Struct representing a key released event.
EventCharacterTyped
class¶
EventCharacterTyped
Struct representing a character typed event.
character
variable (EventCharacterTyped::character
)¶
char32_t character
The character that was typed.
EventTargeted
class¶
EventTargeted
Struct representing a targeted event, derived from EventBase.
target
variable (EventTargeted::target
)¶
std::weak_ptr<Widget> target
The target widget of the event.
EventFocused
class¶
EventFocused
Struct representing a focused event.
keyboard
variable (EventFocused::keyboard
)¶
bool keyboard
Indicates if the focus is keyboard-based.
EventBlurred
class¶
EventBlurred
Struct representing a blurred event.
EventType
enum¶
enum class EventType
Enum representing various event types.
Undefined
enumerator (EventType::Undefined
)¶
Undefined event type.
MouseMoved
enumerator (EventType::MouseMoved
)¶
Mouse moved event.
MouseYWheel
enumerator (EventType::MouseYWheel
)¶
Mouse wheel event (vertical).
MouseXWheel
enumerator (EventType::MouseXWheel
)¶
Mouse wheel event (horizontal).
MouseButtonPressed
enumerator (EventType::MouseButtonPressed
)¶
Mouse button pressed event.
MouseButtonReleased
enumerator (EventType::MouseButtonReleased
)¶
Mouse button released event.
MouseDoubleClicked
enumerator (EventType::MouseDoubleClicked
)¶
Mouse double-clicked event.
MouseTripleClicked
enumerator (EventType::MouseTripleClicked
)¶
Mouse triple-clicked event.
KeyPressed
enumerator (EventType::KeyPressed
)¶
Key pressed event.
KeyReleased
enumerator (EventType::KeyReleased
)¶
Key released event.
CharacterTyped
enumerator (EventType::CharacterTyped
)¶
Character typed event.
TargetDragging
enumerator (EventType::TargetDragging
)¶
Target dragging event.
TargetDropped
enumerator (EventType::TargetDropped
)¶
Target dropped event.
Focused
enumerator (EventType::Focused
)¶
Focused event.
Blurred
enumerator (EventType::Blurred
)¶
Blurred event.
MouseEntered
enumerator (EventType::MouseEntered
)¶
Mouse entered event.
MouseExited
enumerator (EventType::MouseExited
)¶
Mouse exited event.
SourceDragging
enumerator (EventType::SourceDragging
)¶
Source dragging event.
SourceDropped
enumerator (EventType::SourceDropped
)¶
Source dropped event.
Count
enumerator (EventType::Count
)¶
Total number of event types.
operator+
function¶
constexpr int operator+(EventType t)
Helper function to convert EventType to an integer.
Param t
The event type to convert.
Returns The integer representation of the event type.
eventTypeNames
variable¶
extern const char *const eventTypeNames[+EventType::Count]
Array of event type names.
EventVariant
typedef¶
EventVariant = std::variant<std::monostate, //
EventMouseMoved, //
EventMouseYWheel, //
EventMouseXWheel, //
EventMouseButtonPressed, //
EventMouseButtonReleased, //
EventMouseDoubleClicked, //
EventMouseTripleClicked, //
EventKeyPressed, //
EventKeyReleased, //
EventCharacterTyped, //
EventTargetDragging, //
EventTargetDropped, //
//
EventFocused, //
EventBlurred, //
EventMouseEntered, //
EventMouseExited, //
EventSourceDragging, //
EventSourceDropped>
Typedef representing a variant of all possible events.
Event
class¶
Event
Event class representing a generic event with type and utility methods.
type
function (Event::type
)¶
EventType type() const
Returns the event type.
name
function (Event::name
)¶
std::string name() const
Returns the name of the event.
operator bool
function (Event::operator bool
)¶
explicit operator bool() const
Checks if the event is valid.
shouldBubble
function (Event::shouldBubble
)¶
bool shouldBubble() const
Checks if the event should propagate.
cookie
function (Event::cookie
)¶
uint32_t cookie() const
Returns the event's unique cookie.
stopPropagation
function (Event::stopPropagation
)¶
void stopPropagation()
Stops the event from propagating.
reinject
function (Event::reinject
)¶
void reinject()
Re-injects the event into the queue.
passThrough
function (Event::passThrough
)¶
void passThrough()
Marks the event as pass-through.
HitTestMap
class¶
HitTestMap
Struct for managing hit test information for widgets.
HTEntry
class (HitTestMap::HTEntry
)¶
HTEntry
widget
variable (HitTestMap::HTEntry::widget
)¶
std::weak_ptr<Widget> widget
The widget involved in the hit test.
zindex
variable (HitTestMap::HTEntry::zindex
)¶
int zindex
Z-index for rendering order.
rect
variable (HitTestMap::HTEntry::rect
)¶
Rectangle rect
Rectangle area for the hit test.
anywhere
variable (HitTestMap::HTEntry::anywhere
)¶
bool anywhere
Indicates if the widget is valid anywhere.
list
variable (HitTestMap::list
)¶
std::vector<HTEntry> list
List of hit test entries.
get
function (HitTestMap::get
)¶
std::shared_ptr<Widget> get(float x, float y,
bool respect_anywhere) const
Retrieves the widget at the specified coordinates.
Param x
X-coordinate.
Param y
Y-coordinate.
Param respect_anywhere
Whether to respect the "anywhere" flag.
Returns The widget at the specified coordinates, if any.
clear
function (HitTestMap::clear
)¶
void clear()
Clears all hit test entries.
(unnamed)
class (HitTestMap::(unnamed struct at /src/include/brisk/gui/Event.hpp:423:5)
)¶
(unnamed struct at / src / include / brisk / gui /
Event.hpp : 423 : 5)
(unnamed struct at / src / include / brisk / gui /
Event.hpp : 423 : 5)
InputQueue
class¶
InputQueue
Manages the input queue, handling event dispatch and processing.
capturingMouse
variable (InputQueue::capturingMouse
)¶
std::vector<std::weak_ptr<Widget>> capturingMouse
List of widgets capturing the mouse input.
capturingKeys
variable (InputQueue::capturingKeys
)¶
std::vector<std::weak_ptr<Widget>> capturingKeys
List of widgets capturing keyboard input.
eventTarget
variable (InputQueue::eventTarget
)¶
std::shared_ptr<Widget> eventTarget
The target widget of the event currently processed, unaffected by bubbling.
mousePos
variable (InputQueue::mousePos
)¶
PointF mousePos
Mouse position relative to the window.
addTabStop
function (InputQueue::addTabStop
)¶
void addTabStop(std::weak_ptr<Widget> ptr)
Adds a widget to the tab stop list.
Param ptr
The widget to add.
setAutoFocus
function (InputQueue::setAutoFocus
)¶
void setAutoFocus(std::weak_ptr<Widget> ptr)
Sets the auto-focus widget.
Param ptr
The widget to auto-focus.
enterFocusCapture
function (InputQueue::enterFocusCapture
)¶
void enterFocusCapture()
Increases the focus capture level.
leaveFocusCapture
function (InputQueue::leaveFocusCapture
)¶
void leaveFocusCapture()
Decreases the focus capture level.
hasFocus
function (InputQueue::hasFocus
)¶
bool hasFocus()
Checks if any widget currently has focus.
Returns True if a widget has focus, false otherwise.
mouseLeave
function (InputQueue::mouseLeave
)¶
void mouseLeave()
Handles mouse leave events.
processMouseState
function (InputQueue::processMouseState
)¶
void processMouseState(
const std::shared_ptr<Widget> &target)
Processes the mouse state for the given target widget.
Param target
The target widget.
beginDrag
function (InputQueue::beginDrag
)¶
void beginDrag(std::shared_ptr<Widget> dragSource,
std::shared_ptr<Object> dragObject,
MouseButton btn)
Begins dragging an object from the given source widget.
Param dragSource
The source widget initiating the drag.
Param dragObject
The object being dragged.
Param btn
The mouse button involved in the drag.
isDragging
function (InputQueue::isDragging
)¶
bool isDragging() const
Checks if an object is currently being dragged.
Returns True if dragging, false otherwise.
allowDrop
function (InputQueue::allowDrop
)¶
void allowDrop()
Allows the current drag to be dropped.
cancelDragging
function (InputQueue::cancelDragging
)¶
void cancelDragging()
Cancels the current drag operation.
setLastMouseEvent
function (InputQueue::setLastMouseEvent
)¶
void setLastMouseEvent(EventMouse e)
Sets the last mouse event processed.
Param e
The last mouse event.
setLastInputEvent
function (InputQueue::setLastInputEvent
)¶
void setLastInputEvent(EventInput e)
Sets the last input event processed.
Param e
The last input event.
mousePosFor
function (InputQueue::mousePosFor
)¶
optional<PointF> mousePosFor(Widget *widget) const
Returns the mouse position relative to the window if it lies within the given widget.
Param widget
The widget to check.
Returns The mouse position relative to the widget, if applicable.
mousePosForClient
function (InputQueue::mousePosForClient
)¶
optional<PointF> mousePosForClient(Widget *widget) const
Returns the mouse position relative to the widget's client area, if within its bounds.
Param widget
The widget to check.
Returns The mouse position relative to the widget's client area, if applicable.
getAt
function (InputQueue::getAt
)¶
std::tuple<std::shared_ptr<Widget>, int>
getAt(Point pt, int offset = -1,
bool respect_anywhere = true) const
Gets the widget at the specified point, starting from a specified offset.
Param pt
The point to check.
Param offset
The offset to start from (-1 starts from capturingMouse.front()).
Param respect_anywhere
Whether to respect the "anywhere" flag.
Returns A tuple containing the widget at the point and the corresponding index.
mouseAtBubble
function (InputQueue::mouseAtBubble
)¶
bool mouseAtBubble(const function<bool(Widget *)> &fn,
bool bubble = true,
bool useMouseCapture = true) const
Calls the provided function for each widget at the current mouse position, optionally bubbling.
Param fn
The function to call for each widget.
Param bubble
Whether to allow event bubbling.
Param useMouseCapture
Whether to use mouse capture information.
Returns True if the function succeeds, false otherwise.
getDescriptionAtMouse
function (InputQueue::getDescriptionAtMouse
)¶
optional<std::string> getDescriptionAtMouse() const
Gets the description of the widget under the mouse, if any.
Returns The description of the widget, if applicable.
getCursorAtMouse
function (InputQueue::getCursorAtMouse
)¶
optional<Cursor> getCursorAtMouse() const
Gets the cursor type for the widget under the mouse, if any.
Returns The cursor type, if applicable.
setFocus
function (InputQueue::setFocus
)¶
void setFocus(std::shared_ptr<Widget> focus, bool keyboard)
Sets the focus to the specified widget.
Param focus
The widget to focus.
Param keyboard
Whether the focus is set by keyboard.
resetFocus
function (InputQueue::resetFocus
)¶
void resetFocus()
Resets the current focus.
reset
function (InputQueue::reset
)¶
void reset()
Resets the input queue state.
captureMouse
function (InputQueue::captureMouse
)¶
void captureMouse(const std::shared_ptr<Widget> &target)
Captures the mouse for the specified widget.
Param target
The widget to capture the mouse.
captureKeys
function (InputQueue::captureKeys
)¶
void captureKeys(const std::shared_ptr<Widget> &target)
Captures keyboard input for the specified widget.
Param target
The widget to capture keyboard input.
stopCaptureMouse
function (InputQueue::stopCaptureMouse
)¶
void stopCaptureMouse(const std::shared_ptr<Widget> &target)
Stops capturing the mouse for the specified widget.
Param target
The widget to stop capturing the mouse.
stopCaptureKeys
function (InputQueue::stopCaptureKeys
)¶
void stopCaptureKeys(const std::shared_ptr<Widget> &target)
Stops capturing keyboard input for the specified widget.
Param target
The widget to stop capturing keyboard input.
handleFocusEvents
function (InputQueue::handleFocusEvents
)¶
void handleFocusEvents(Event &e)
Handles focus-related events.
Param e
The event to handle.
injectEvent
function (InputQueue::injectEvent
)¶
void injectEvent(Event event)
Injects an event into the queue to be processed at the next frame.
Param event
The event to inject.
addEvent
function (InputQueue::addEvent
)¶
void addEvent(Event event)
Adds an event to the queue to be processed in the next call to processEvent.
Param event
The event to add.
processEvents
function (InputQueue::processEvents
)¶
void processEvents()
Processes all events in the queue.
processKeyEvent
function (InputQueue::processKeyEvent
)¶
void processKeyEvent(Event e)
Processes a key event.
Param e
The key event to process.
processMouseEvent
function (InputQueue::processMouseEvent
)¶
void processMouseEvent(Event e)
Processes a mouse event.
Param e
The mouse event to process.
processDragEvent
function (InputQueue::processDragEvent
)¶
void processDragEvent(Event e)
Processes a drag event.
Param e
The drag event to process.
processTargetedEvent
function (InputQueue::processTargetedEvent
)¶
void processTargetedEvent(Event e)
Processes a targeted event.
Param e
The targeted event to process.
InputQueue
function (InputQueue::InputQueue
)¶
InputQueue()
Constructor for the InputQueue class.
Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/