HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
hi::v1::selection_delegate Class Referenceabstract

#include <hikogui/widgets/selection_delegate.hpp>

Inheritance diagram for hi::v1::selection_delegate:
hi::v1::default_selection_delegate< T >

Public Member Functions

virtual void init (widget_intf const &sender)
virtual void deinit (widget_intf const &sender)
virtual std::optional< widget_id > keyboard_focus_id (widget_intf const &sender) const noexcept
 The id of the widget that will need to get keyboard focus when the pull-down menu is opened.
virtual size_t size (widget_intf const &sender) const noexcept
 The number of options in the pull-down menu.
bool empty (widget_intf const &sender) const noexcept
virtual std::unique_ptr< widgetmake_option_widget (widget_intf const &sender, size_t index) noexcept=0
 Create a new widget that represents the button in the selection menu.
virtual std::optional< label > selected_label (widget_intf const &sender) const noexcept
 Get the label of the selected option.
template<forward_of< void()> Func>
callback< void()> subscribe_on_value (Func &&func, callback_flags flags=callback_flags::synchronous) noexcept
 Subscribe a callback for notifying the widget of a change in the value.
template<forward_of< void()> Func>
callback< void()> subscribe_on_options (Func &&func, callback_flags flags=callback_flags::synchronous) noexcept
 Subscribe a callback for notifying the widget of a change in the options.

Detailed Description

A delegate that controls the state of a selection_widget.

Member Function Documentation

◆ keyboard_focus_id()

virtual std::optional< widget_id > hi::v1::selection_delegate::keyboard_focus_id ( widget_intf const & sender) const
inlinenodiscardvirtualnoexcept

The id of the widget that will need to get keyboard focus when the pull-down menu is opened.

Returns
The id of the widget that needs keyboard focus.
Return values
std::nulloptThere are no options.

Reimplemented in hi::v1::default_selection_delegate< T >.

◆ make_option_widget()

virtual std::unique_ptr< widget > hi::v1::selection_delegate::make_option_widget ( widget_intf const & sender,
size_t index )
nodiscardpure virtualnoexcept

Create a new widget that represents the button in the selection menu.

Parameters
senderThe selection widget that uses this delegate.
indexThe index of the option.
Returns
A new widget that represents the option at index.

Implemented in hi::v1::default_selection_delegate< T >.

◆ selected_label()

virtual std::optional< label > hi::v1::selection_delegate::selected_label ( widget_intf const & sender) const
inlinenodiscardvirtualnoexcept

Get the label of the selected option.

Returns
The label of the selected option.
Return values
std::nulloptNone of the options has been selected.

Reimplemented in hi::v1::default_selection_delegate< T >.

◆ size()

virtual size_t hi::v1::selection_delegate::size ( widget_intf const & sender) const
inlinenodiscardvirtualnoexcept

The number of options in the pull-down menu.

Reimplemented in hi::v1::default_selection_delegate< T >.

◆ subscribe_on_options()

template<forward_of< void()> Func>
callback< void()> hi::v1::selection_delegate::subscribe_on_options ( Func && func,
callback_flags flags = callback_flags::synchronous )
inlinenodiscardnoexcept

Subscribe a callback for notifying the widget of a change in the options.

◆ subscribe_on_value()

template<forward_of< void()> Func>
callback< void()> hi::v1::selection_delegate::subscribe_on_value ( Func && func,
callback_flags flags = callback_flags::synchronous )
inlinenodiscardnoexcept

Subscribe a callback for notifying the widget of a change in the value.


The documentation for this class was generated from the following file: