|
Avara3D 0.2.0
C++ API reference
|
Transient immediate-mode overlay panel for application controls and status. More...
#include <a3d/ui/Panel.h>
Classes | |
| struct | Options |
| Controls panel width and its inset from the upper-right viewport corner. More... | |
| struct | Padding |
| Per-item padding in logical UI units. More... | |
| struct | SectionConfig |
| Controls the optional separator line and capitalization of section headings. More... | |
Public Member Functions | |
| Panel (std::string_view id, const Options &options=Options::Default()) | |
| Begins an immediate-mode panel for the current frame. More... | |
| void | section (std::string_view text, SectionConfig config=SectionConfig::Default(), Padding padding={12.0f, 4.0f, 0.0f, 0.0f}) |
| Draws a section heading with optional separator line, capitalization, and padding. More... | |
| void | text (std::string_view text, Padding padding=Padding::Default()) |
| Draws body text, wrapping it to the available item width. More... | |
| void | value (std::string_view label, std::string_view value, Padding padding=Padding::Default()) |
| Draws a left-aligned label and right-aligned textual value. More... | |
| void | spacer (float height) |
Inserts vertical space of height logical UI units. More... | |
| void | row (unsigned itemCount) |
Arranges the next itemCount items horizontally with equal widths. More... | |
| bool | button (std::string_view label, Padding padding={2.0f, 0.0f, 0.0f, 0.0f}) |
| Draws a button and reports activation once. More... | |
| bool | option (std::string_view label, bool selected, Padding padding={2.0f, 0.0f, 0.0f, 0.0f}) |
| Draws a selectable option button and reports activation once. More... | |
| bool | subOption (std::string_view label, bool selected, Padding padding={2.0f, 0.0f, 0.0f, 0.0f}) |
| Draws a visually subordinate selectable option button and reports activation once. More... | |
| bool | slider (std::string_view label, float &value, float minimum, float maximum, std::string_view format="%.2f", Padding padding={2.0f, 0.0f, 0.0f, 0.0f}) |
Draws a floating-point slider and reports whether value changed. More... | |
| bool | slider (std::string_view label, int &value, int minimum, int maximum, std::string_view format="%d", Padding padding={2.0f, 0.0f, 0.0f, 0.0f}) |
Draws an integer slider and reports whether value changed. More... | |
| bool | toggle (std::string_view label, bool &value, Padding padding=Padding::Default()) |
Draws a boolean toggle and reports whether value changed. More... | |
| bool | hovered () const |
| Returns whether the pointer is hovering the panel during the current frame. More... | |
Transient immediate-mode overlay panel for application controls and status.
Construct a Panel during Application::frameDidBegin(), emit its contents, and allow it to be destroyed before returning from the callback. The id must remain stable between frames so interactive items retain stable identities.
Items are arranged in a vertical stack by default. row() arranges the specified number of subsequent items horizontally with equal widths.
|
explicit |
Begins an immediate-mode panel for the current frame.
id is used to preserve UI identity between frames and should remain stable. Panel must be created while an A3D UI frame is active, normally from Application::frameDidBegin().
| std::invalid_argument | if id is empty or the supplied width or margin is invalid. |
| std::logic_error | if no active UI context or default A3D UI font is available. |
| bool a3d::ui::Panel::button | ( | std::string_view | label, |
| Padding | padding = {2.0f, 0.0f, 0.0f, 0.0f} |
||
| ) |
Draws a button and reports activation once.
| std::invalid_argument | if label is empty. |
| bool a3d::ui::Panel::hovered | ( | ) | const |
Returns whether the pointer is hovering the panel during the current frame.
| bool a3d::ui::Panel::option | ( | std::string_view | label, |
| bool | selected, | ||
| Padding | padding = {2.0f, 0.0f, 0.0f, 0.0f} |
||
| ) |
Draws a selectable option button and reports activation once.
selected controls the persistent selected appearance for this frame and is not retained by Panel.
| std::invalid_argument | if label is empty. |
| void a3d::ui::Panel::row | ( | unsigned | itemCount | ) |
Arranges the next itemCount items horizontally with equal widths.
| std::invalid_argument | if itemCount is zero. |
| std::logic_error | if the previous row is incomplete. |
| void a3d::ui::Panel::section | ( | std::string_view | text, |
| SectionConfig | config = SectionConfig::Default(), |
||
| Padding | padding = {12.0f, 4.0f, 0.0f, 0.0f} |
||
| ) |
Draws a section heading with optional separator line, capitalization, and padding.
| bool a3d::ui::Panel::slider | ( | std::string_view | label, |
| float & | value, | ||
| float | minimum, | ||
| float | maximum, | ||
| std::string_view | format = "%.2f", |
||
| Padding | padding = {2.0f, 0.0f, 0.0f, 0.0f} |
||
| ) |
Draws a floating-point slider and reports whether value changed.
| std::invalid_argument | if label is empty or the range is not increasing. |
| bool a3d::ui::Panel::slider | ( | std::string_view | label, |
| int & | value, | ||
| int | minimum, | ||
| int | maximum, | ||
| std::string_view | format = "%d", |
||
| Padding | padding = {2.0f, 0.0f, 0.0f, 0.0f} |
||
| ) |
Draws an integer slider and reports whether value changed.
| std::invalid_argument | if label is empty or minimum is not less than maximum. |
| void a3d::ui::Panel::spacer | ( | float | height | ) |
Inserts vertical space of height logical UI units.
| std::invalid_argument | if height is negative. |
| bool a3d::ui::Panel::subOption | ( | std::string_view | label, |
| bool | selected, | ||
| Padding | padding = {2.0f, 0.0f, 0.0f, 0.0f} |
||
| ) |
Draws a visually subordinate selectable option button and reports activation once.
selected controls the persistent selected appearance for this frame and is not retained by Panel.
| std::invalid_argument | if label is empty. |
| void a3d::ui::Panel::text | ( | std::string_view | text, |
| Padding | padding = Padding::Default() |
||
| ) |
Draws body text, wrapping it to the available item width.
| bool a3d::ui::Panel::toggle | ( | std::string_view | label, |
| bool & | value, | ||
| Padding | padding = Padding::Default() |
||
| ) |
Draws a boolean toggle and reports whether value changed.
| std::invalid_argument | if label is empty. |
| void a3d::ui::Panel::value | ( | std::string_view | label, |
| std::string_view | value, | ||
| Padding | padding = Padding::Default() |
||
| ) |
Draws a left-aligned label and right-aligned textual value.