Skip to content

DIWNE::DrawInfo

A structure used to relay information between DIWNE objects during their sequential construction/drawing in a single frame. More...

#include "DIWNE/Core/Elements/DiwneObject.h"

Public Functions

Name
DrawInfo(InteractionState & state)
voidconsumeHover()
voidconsumeInput()
DrawInfofindChange(const DrawInfo & other) const<br>Find the difference between two contexts.
boolinputAvailable()<br>Shorthand for checking that input wasn't consumed.
boolinputFullyAvailable()<br>Input is available, nothing is being dragged and no action is active.
voidlogicalUpdate(bool isVisualUpdateAsWell =true)
voidpopup()
voidtooltip()
voidupdate(bool visual, bool logical =false, bool blockInput =false)<br>Composite update method.
voidvisualUpdate()

Public Attributes

Name
unsigned shorthoverConsumed <br>Whether objects should not be hovered anymore // TODO: This is currently unused, but potentially useful.
unsigned shortinputConsumed <br>Whether input has been captured by an object previously and should not be reacted to anymore.
unsigned shortlogicalUpdates <br>Indicates a logical interaction, eg.
unsigned shortpopupOpened
InteractionState &state
unsigned shorttooltipOpened
unsigned shortvisualUpdates <br>Number of purely visual interactions that are occurring. This can be a simple mouse hover.

Detailed Description

cpp
class DIWNE::DrawInfo;
class DIWNE::DrawInfo;

A structure used to relay information between DIWNE objects during their sequential construction/drawing in a single frame.

This is mainly used to retain information about whether an object should react to user input or if a diwne object drawn earlier already "captured" the input and other objects should ignore it. An instance of this object is passed along the drawing code for any nested diwne objects and along the way it collects information about what has already happened that frame. A reference to the persistent interaction state is also passed along to simplify access to it.

Public Functions Documentation

function DrawInfo

cpp
DrawInfo(
    InteractionState & state
)
DrawInfo(
    InteractionState & state
)

function consumeHover

cpp
inline void consumeHover()
inline void consumeHover()

function consumeInput

cpp
inline void consumeInput()
inline void consumeInput()

function findChange

cpp
DrawInfo findChange(
    const DrawInfo & other
) const
DrawInfo findChange(
    const DrawInfo & other
) const

Find the difference between two contexts.

Parameters:

  • other The other, older, context to compare with.

Return: New context representing the only change between this context and the other one.

This relates primarily to the few trivial unsigned short variables. This is used to find the immediate change of the context between two points in time. Which is useful to figure out how a certain draw call changed the context.

function inputAvailable

cpp
bool inputAvailable()
bool inputAvailable()

Shorthand for checking that input wasn't consumed.

function inputFullyAvailable

cpp
bool inputFullyAvailable()
bool inputFullyAvailable()

Input is available, nothing is being dragged and no action is active.

function logicalUpdate

cpp
void logicalUpdate(
    bool isVisualUpdateAsWell =true
)
void logicalUpdate(
    bool isVisualUpdateAsWell =true
)

function popup

cpp
inline void popup()
inline void popup()

function tooltip

cpp
inline void tooltip()
inline void tooltip()

function update

cpp
void update(
    bool visual,
    bool logical =false,
    bool blockInput =false
)
void update(
    bool visual,
    bool logical =false,
    bool blockInput =false
)

Composite update method.

function visualUpdate

cpp
void visualUpdate()
void visualUpdate()

Public Attributes Documentation

variable hoverConsumed

cpp
unsigned short hoverConsumed {0};
unsigned short hoverConsumed {0};

Whether objects should not be hovered anymore // TODO: This is currently unused, but potentially useful.

variable inputConsumed

cpp
unsigned short inputConsumed {0};
unsigned short inputConsumed {0};

Whether input has been captured by an object previously and should not be reacted to anymore.

variable logicalUpdates

cpp
unsigned short logicalUpdates {0};
unsigned short logicalUpdates {0};

Indicates a logical interaction, eg.

change of some attribute or a non blocking button press. Requests focus. This can be used to detect whether an object is being clicked on directly, in which case the number of logical updates should be 0. An object above another should submit a logical update in its onPressed() method.

variable popupOpened

cpp
unsigned short popupOpened {0};
unsigned short popupOpened {0};

variable state

cpp
InteractionState & state;
InteractionState & state;

variable tooltipOpened

cpp
unsigned short tooltipOpened {0};
unsigned short tooltipOpened {0};

variable visualUpdates

cpp
unsigned short visualUpdates {0};
unsigned short visualUpdates {0};

Number of purely visual interactions that are occurring. This can be a simple mouse hover.


Updated on 2025-05-31 at 12:55:31 +0000