System
Window
Widget
Label
++
widget.make_widget<label_widget>("A1", l10n("My Text"));
Button
++
auto button = wiget.make_widget<button_widget<bool>>("A1", true);
button->label = label{elusive_icon::Wrench, l10n("Preferences")};
auto callback = button->subscribe([]{ foo(); });
Checkbox
The checkbox is configured with a true-value and a false-value, to match with the observed value.
When the observed value is equal to:
- true-value: a checkmark is shown inside the box and the true_label is shown to the right of the box,
- false-value: the box is empty and the false_label is shown to the right of the box,
- neither: a dash is shown inside the box and the other_label is shown to the right of the box.
Each of these labels may be empty.
++
enum class value_t { A, B, C };
observable<value_t> value;
auto button = widget.make_widget<checkbox_widget<value_t>>("A1", value_t::A, value_t::B, value);
button->true_label = l10n("true");
button->false_label = l10n("false");
button->other_label = l10n("other");
Radio button
In ttauri a set of radio buttons are a set of tt::radio_button_widgets. Each of the widgets in a set observe the same value and each widget is configured with a different true-value.
When a tt::radio_button_widget's true-value matches the observed value the radio button is checked, otherwise it is unchecked. When a radio button is clicked the observed value is set to that widget's true value.
The label on the right side of a radio button is always shown, but the label may be set to empty to not show a label.
++
enum class value_t { A, B, C };
observable<value_t> value;
auto button1 = widget.make_widget<radio_button_widget<value_t>>("A1", value_t::A, value, l10n("A"));
auto button2 = widget.make_widget<radio_button_widget<value_t>>("A2", value_t::B, value, l10n("B")));
Toggle
Text field
Selection
Row/Column layout
Grid layout
Tab View
Toolbar
Toolbar Tab Button
Menu Item