template<typename T>
GGUI::WidgetHost class

What a widget's hooks are given: its node, its typed state, and the document services it may use.

Base classes

class WidgetHostBase
The document API available to every widget. WidgetHost<T> adds the typed state.

Constructors, destructors, conversion operators

WidgetHostBase(UIContext& context, NodeHandle node)
The host of widget node node of context.
WidgetHostBase(const UIContext& context, NodeHandle node)
The same, for const hooks; only const calls may be made.

Public functions

auto TryState() const -> T*
The widget's state; null if the node is no longer this kind of widget.
auto State() const -> T&
The widget's state. The node must still be this kind of widget.
template<typename TOther>
auto Find(NodeHandle node) const -> TOther*
Another node's state if it is a TOther, else null.
template<typename TOther>
auto HostOf(NodeHandle node) const -> WidgetHost<TOther>
Host for another node, for composite widgets (a table and its rows).
template<typename TArgument>
void Report(GGReaction reaction, const TArgument& argument)
Invoke the author's handler for reaction.
void SetTextFocus(bool bOn, const GGRect& caret = {}, bool bEntry = true)
While focused: every key goes to the document, the caret is at caret (document space), and with bEntry the platform delivers text input. bOn false turns it off.
auto TextCaret() const -> GGRect
Where the document's text caret was last placed.
auto AskForPaste() -> bool
Request the clipboard. The text arrives later as a Paste text event.
auto Value() const -> float
The value shown, as a float: good enough to place a thumb, never to read a number.
auto Min() const -> float
The lowest value, as a float.
auto Max() const -> float
The highest value, as a float.
void BeginEdit()
The user started an edit.
void ChangeEdit(float value)
The edit's value is now value.
void CommitEdit()
The user finished the edit.
void CancelEdit()
The user abandoned the edit: back to the starting value.
void EditTo(float value)
A complete edit in one call, to value.
void StepEdit(int steps)
A complete edit in one call, by steps of the widget's step.
auto Bits() const -> ValueBits
The value, in its own type.
auto MinBits() const -> ValueBits
The lowest value, in its own type.
auto MaxBits() const -> ValueBits
The highest value, in its own type.
auto Service() const -> const ValueOps&
The value type's operations.
void ChangeEditBits(ValueBits value)
ChangeEdit, in the value's own type.
void EditToBits(ValueBits value)
EditTo, in the value's own type.