property-grid only.Expand description
Named properties in a compact two-column inspector, such as the properties panel of a design tool: names on the left, editors on the right, grouped into categories that collapse.
State holds the properties by id with their values, which categories
are collapsed, the highlight, the filter and the Sort. Its
update returns Output::Changed whenever a value
changes and Output::Reset when one goes back to its default.
Text, numbers and colours are edited as text. A valid edit changes the value as it is typed; an invalid one keeps its draft and shows the error until it is fixed or cancelled, without changing the value. Cancelling puts back the value from before the edit.
The grid resolves its keys through a Keymap of Actions while it
has focus, which it takes when pressed; see default_keymap.
Structs§
- Draft
- Text being typed into a property, and why it is not valid yet.
- Number
- The limits and look of a number property.
- Property
- One named property.
- Property
Grid - A property grid builder. Convert it into an
Elementto render. - RowStyle
- The colours of a row.
- State
- The properties, their values, and what is open, highlighted, filtered and being edited.
- Status
- How a row is shown.
Enums§
- Action
- What a property grid keyboard shortcut does.
- Entry
- One row of the grid.
- Event
- Everything that changes a property grid.
- Kind
- What a property holds and how it is edited.
- Menu
Item - An entry of the context menu from
menu. - Output
- What the app may need to act on after an
Event. - Sort
- How the properties are listed.
- Toggle
- How a true or false property is shown.
- Value
- A property’s value.
Constants§
- DESCRIPTION_
HEIGHT - The least height of the description area under the rows, which grows to fit a longer description.
- EDITOR_
ID - The widget id of the field being edited, to find it in tests.
- HANDLE_
WIDTH - Width of the draggable line between the columns.
- MIN_
NAME_ WIDTH - The narrowest the name column gets.
- MIN_
VALUE_ WIDTH - The room the value column keeps when the name column is dragged wide.
- NAME_
WIDTH - The widest the name column starts out, before the user drags it.
- NOTHING_
SELECTED - Shown in the description area while nothing is highlighted.
- RESET_
WIDTH - Width of the slot at the end of a row for the reset button.
- ROW_
HEIGHT - Height of every row, which fits a select.
- SEARCH
- The widget id of the filter box, which
focus_searchfocuses. - VALUE_
WIDTH - The room the value column keeps before the name column, at its default width, starts to shrink: enough for a colour swatch and its hex.
Functions§
- choice
- A property chosen from
optionswith a select. - colour
- A colour property, shown as a swatch and edited as hex.
- custom
- A property the app draws itself with
PropertyGrid::custom. Without a renderer its value is shown as text. - default_
keymap - The default property grid shortcuts:
- divider_
colour - The line between the name and value columns, brighter while dragged or hovered.
- focus_
search - Focuses the filter box of a grid, for an app that moves the keyboard
there itself.
Action::FocusSearchdoes the same from inside the grid. - frame_
style - The border around the grid.
- hex
- A colour as
#RRGGBB, or#RRGGBBAAwhen it is not opaque. - mark_
colour - The dot before the name of a property that differs from its default.
- match_
label - The text beside the search box, as in the log and JSON viewers: “2 of 5” for the highlighted property of those shown, “5 found” while none of them is highlighted, “None” when nothing passes, and empty without a search.
- menu
- A context menu to pass to
PropertyGrid::context_menu: copy the value, or reset it to its default. Turn the chosen entry into an event withMenuItem::event, and callsync_menuafter each menu event so entries that would do nothing are disabled. - name_
width - The name column’s width in a row
widthpixels wide. A dragged or set width is kept betweenMIN_NAME_WIDTHand what leaves the value columnMIN_VALUE_WIDTH. Otherwise names takeNAME_WIDTH, and in a narrow grid the value column gives up its room first, down toVALUE_WIDTH, so names stay readable. - number
- A number property. Set its limits with
min,max,stepand its look withdecimalsandunit. - parse_
hex - Reads a hex colour:
#RGB,#RGBA,#RRGGBBor#RRGGBBAA, with or without the#. - property_
grid - Renders
state. Withouton_eventevery editor renders disabled. - read_
only - Text that cannot be edited, such as an id or a computed size.
- row_
style - Resolves a row’s colours. Headings sit on a muted band. The grid selects nothing, so the highlighted row only carries a ring, and only while the grid has focus.
- swatch_
ring - The ring around a colour swatch. Dark themes lift it towards the text colour, so a near-black swatch still shows its edge.
- swatch_
style - A colour swatch: the colour inside a thin ring.
- sync_
menu - Disables the entries of a
menuthat would do nothing for the property it is open on, such as “Reset to default” on a property that already holds its default. - text
- A text property.
- toggle
- A true or false property, shown as a checkbox, or as a switch with
switch. - value_
colour - The colour of a value: muted when it cannot be edited.
Type Aliases§
- Validate
- Checks text typed into a text property, returning the error to show.