|
HikoGUI
A low latency retained GUI
|
#include <hikogui/widgets/selection_delegate.hpp>
Public Types | |
| using | value_type = T |
| using | option_type = std::pair<value_type, label> |
| using | options_type = std::vector<option_type> |
Public Member Functions | |
| template<forward_of< observer< value_type > > Value, forward_of< observer< options_type > > Options> | |
| default_selection_delegate (Value &&value, Options &&options) noexcept | |
| Construct a default selection delegate. | |
| size_t | size (widget_intf const &sender) const noexcept override |
| The number of options in the pull-down menu. | |
| std::optional< label > | selected_label (widget_intf const &sender) const noexcept override |
| Get the label of the selected option. | |
| std::optional< widget_id > | keyboard_focus_id (widget_intf const &sender) const noexcept override |
| The id of the widget that will need to get keyboard focus when the pull-down menu is opened. | |
| std::unique_ptr< widget > | make_option_widget (widget_intf const &sender, widget_intf const &parent, size_t index) noexcept override |
| Create a new widget that represents the button in the selection menu. | |
Public Member Functions inherited from hi::v1::selection_delegate | |
| virtual void | init (widget_intf const &sender) |
| virtual void | deinit (widget_intf const &sender) |
| bool | empty (widget_intf const &sender) const noexcept |
| 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. | |
Data Fields | |
| observer< value_type > | value |
| observer< options_type > | options |
A delegate that control the state of a selection_widget.
| T | the type used as the key for which option is selected. |
|
inlinenoexcept |
Construct a default selection delegate.
| value | The observer value which represents the selected option. |
| options | An observer std::vector<std::pair<value_type,label>> of all possible options. |
|
inlineoverridevirtualnoexcept |
The id of the widget that will need to get keyboard focus when the pull-down menu is opened.
| std::nullopt | There are no options. |
Reimplemented from hi::v1::selection_delegate.
|
inlineoverridevirtualnoexcept |
Create a new widget that represents the button in the selection menu.
| sender | The selection widget that uses this delegate. |
| parent | The parent widget of the new widget being created. |
| index | The index of the option. |
Implements hi::v1::selection_delegate.
|
inlineoverridevirtualnoexcept |
Get the label of the selected option.
| std::nullopt | None of the options has been selected. |
Reimplemented from hi::v1::selection_delegate.
|
inlineoverridevirtualnoexcept |
The number of options in the pull-down menu.
Reimplemented from hi::v1::selection_delegate.