13#include "../audio/audio.hpp"
14#include "../l10n/l10n.hpp"
15#include "../macros.hpp"
23hi_export_module(hikogui.widgets.audio_device_widget);
25hi_export
namespace hi {
inline namespace v1 {
42 virtual ~audio_device_widget() {}
46 _grid_widget = std::make_unique<grid_widget>();
47 _grid_widget->set_parent(
this);
51 _sync_device_list_task = sync_device_list();
55 [[nodiscard]] generator<widget_intf&> children(
bool include_invisible)
noexcept override
57 co_yield *_grid_widget;
63 _grid_constraints = _grid_widget->update_constraints();
64 return _grid_constraints;
67 void set_layout(widget_layout
const& context)
noexcept override
70 auto const grid_rectangle = context.rectangle();
71 _grid_shape = {_grid_constraints, grid_rectangle, theme().baseline_adjustment()};
77 void draw(draw_context
const& context)
noexcept override
80 _grid_widget->draw(context);
84 hitbox hitbox_test(point2 position)
const noexcept override
88 r = _grid_widget->hitbox_test_from_parent(position, r);
95 [[nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group)
const noexcept override
98 return _grid_widget->accepts_keyboard_focus(group);
107 std::unique_ptr<grid_widget> _grid_widget;
108 box_constraints _grid_constraints;
109 box_shape _grid_shape;
113 selection_widget *_device_selection_widget =
nullptr;
115 observer<std::vector<std::pair<std::string, label>>> _device_list;
117 hi::scoped_task<> _sync_device_list_task;
119 [[nodiscard]] hi::scoped_task<> sync_device_list() noexcept
123 auto proxy = _device_list.get();
126 proxy->emplace_back(device.id(), device.label());
Defines selection_widget.
@ partial
A widget is partially enabled.
Definition widget_state.hpp:73
@ invisible
The widget is invisible.
Definition widget_state.hpp:41
The HikoGUI namespace.
Definition array_generic.hpp:21
The HikoGUI API version 1.
Definition array_generic.hpp:22
bool compare_store(T &lhs, U &&rhs) noexcept
Compare then store if there was a change.
Definition misc.hpp:53
generator< audio_device & > audio_devices(Filters &&...filters) noexcept
Get audio devices matching the filter arguments.
Definition audio_system.hpp:101
@ level
The child widget stays at the same elevation and layer.
Definition widget_layout.hpp:26
auto when_any(Args const &...args)
await on a set of objects which can be converted to an awaitable.
Definition when_any.hpp:173
static audio_system & global() noexcept
Create an audio system object specific for the current operating system.
Definition audio_system_win32.hpp:230
A observer pointing to the whole or part of a observed_base.
Definition observer_intf.hpp:32
Audio device configuration widget.
Definition audio_device_widget.hpp:30
observer< audio_direction > direction
The audio direction (input or output) of devices is should show.
Definition audio_device_widget.hpp:40
observer< std::string > device_id
The audio device this widget has selected and is configuring.
Definition audio_device_widget.hpp:36
A graphical control element that allows the user to choose only one of a predefined set of mutually e...
Definition selection_widget.hpp:48
widget() noexcept
Constructor for creating sub views.
Definition widget.hpp:50
box_constraints update_constraints() noexcept override
Update the constraints of the widget.
Definition widget.hpp:110