Classes | |
| struct | donner::editor::InspectorTextParser |
| Converts the typed text of a numeric field to its value, or returns std::nullopt to reject it. More... | |
| struct | donner::editor::InspectorNumericEdit |
| Outcome of one frame of an Inspector numeric field. More... | |
| struct | donner::editor::InspectorLengthEdit |
| Outcome of one frame of an Inspector length field. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Functions | |
| std::optional< Lengthd > | donner::editor::ParseInspectorLength (std::string_view text, LengthUnit defaultUnit) |
| Parse a length typed into an Inspector field. | |
| std::optional< double > | donner::editor::ParseInspectorNumber (std::string_view text) |
| Parse a plain number typed into an Inspector field; a unit suffix is rejected, not dropped. | |
| std::optional< double > | donner::editor::ParseInspectorDegrees (std::string_view text) |
| Parse a rotation typed into an Inspector field: a number of degrees, optionally followed by the deg unit the field displays. | |
| InspectorNumericEdit | donner::editor::DragInspectorNumber (const char *label, double *value, float speed, const char *format, const InspectorTextParser &parse, const char *hint, const EditorTheme &theme) |
Draggable numeric field whose typed text is interpreted by parse. | |
| InspectorLengthEdit | donner::editor::InputInspectorLength (const char *label, const Lengthd ¤t, LengthUnit bareNumberUnit, bool allowNegative, const EditorTheme &theme) |
| Text field for a CSS length, displayed with one decimal place and its unit, e.g. | |
Variables | |
| constexpr const char * | donner::editor::kInspectorLengthHint |
| Tooltip shown while a length field's text is rejected. | |
| constexpr const char * | donner::editor::kInspectorNumberHint = "Enter a number without a unit" |
| Tooltip shown while a plain-number field's text is rejected. | |
| constexpr const char * | donner::editor::kInspectorDegreesHint = "Enter an angle in degrees" |
| Tooltip shown while a rotation field's text is rejected. | |
| InspectorNumericEdit donner::editor::DragInspectorNumber | ( | const char * | label, |
| double * | value, | ||
| float | speed, | ||
| const char * | format, | ||
| const InspectorTextParser & | parse, | ||
| const char * | hint, | ||
| const EditorTheme & | theme ) |
Draggable numeric field whose typed text is interpreted by parse.
Behaves like ImGui::DragScalar over a double, except that text typed into the field (after a click, double-click or Ctrl+click) is interpreted by parse. ImGui's own parsing keeps only the leading number and silently drops anything after it, such as a unit. Text that parse rejects leaves the value unchanged and outlines the field in the theme's destructive color, with hint as its tooltip. Text the user has not changed is not re-parsed, so entering and leaving the field does not round the value to its displayed precision.
| label | ImGui label and ID of the field. |
| value | Value to display and edit. |
| speed | Drag speed, in value units per pixel. |
| format | printf-style display format. |
| parse | Interprets typed text. |
| hint | Tooltip explaining what the field accepts, shown while its text is rejected. |
| theme | Active editor theme. |
| InspectorLengthEdit donner::editor::InputInspectorLength | ( | const char * | label, |
| const Lengthd & | current, | ||
| LengthUnit | bareNumberUnit, | ||
| bool | allowNegative, | ||
| const EditorTheme & | theme ) |
Text field for a CSS length, displayed with one decimal place and its unit, e.g.
2.0mm.
Typed text is interpreted by donner::editor::ParseInspectorLength with bareNumberUnit as the default, so a bare number keeps the authored unit and a typed unit replaces it. Rejected text outlines the field like donner::editor::DragInspectorNumber.
| label | ImGui label and ID of the field. |
| current | Value displayed while the field is not being edited. |
| bareNumberUnit | Unit for a typed bare number, normally the unit before editing began. |
| allowNegative | Whether negative lengths are accepted; otherwise they are rejected. |
| theme | Active editor theme. |
|
nodiscard |
Parse a rotation typed into an Inspector field: a number of degrees, optionally followed by the deg unit the field displays.
Other units are rejected, not dropped.
| text | Text typed by the user. |
text is not a finite angle in degrees.
|
nodiscard |
Parse a length typed into an Inspector field.
Accepts a CSS <length-percentage> such as 1in, 2.5mm or 50%, using donner::parser::LengthParser, or a bare number. A bare number takes defaultUnit, so editing a value keeps the unit it was authored in; a typed unit replaces it. Surrounding whitespace is ignored. Anything else, including an unknown unit or a space before the unit, is rejected rather than truncated to its leading number.
| text | Text typed by the user. |
| defaultUnit | Unit for a bare number. |
text is not a finite length.
|
nodiscard |
Parse a plain number typed into an Inspector field; a unit suffix is rejected, not dropped.
| text | Text typed by the user. |
text is not a single finite number.
|
inlineconstexpr |
Tooltip shown while a length field's text is rejected.