containers.h
| File Path | engine/include/conjure/editor/kit/containers.h |
| API ↗ | The editor, The widget kit |
The kit's containers: the viewport bars and the screen, the toolbar strip with its groups, the status strip, the panel shell with the dock chrome, the property containers (grid, section, row, group), the overlay cards and banners, and the picture. Containers are scopes that cannot be copied or moved.
Structs
| File | Description |
|---|---|
kit::banner_props |
A banner's tone and place: PREFAB (prefabSoft with a prefabLine edge, padding 5 8: the inspector's prefab banner) or PLAY (playSoft, no edge, padding 4 10: the Scene view's play banner), RADIUS_CONTROL, spans GAP_ROW apart. Without an anchor it goes in the flow across the width left on the line (or where the layout host puts it), its trailing spans right-aligned; spans wider than that are cut to lie inside it, the trailing ones kept whole first and the last leading ones cut first, with an ellipsis. With an anchor it is as wide as its spans, at the anchor. Other tones count as PREFAB. |
kit::dock_chrome::pending_undock |
A window undock() took out of its node, and where its corner goes once ImGui has undocked it. |
kit::header_action_state |
One header action as the frame that submitted it registered it: its key, icon, place at the bar's trailing edge and the state it is drawn in. |
kit::overlay_anchor |
Where an overlay goes: offset (pixels at 100 %, scaled and rounded as the metrics are) in from corner of area on both axes (the mockup's stats chip 12, 12 from the top left; its cursor chip 12 across, 10 up from the bottom left). |
kit::overlay_arrangement |
Where an overlay's spans landed, relative to its top-left corner: one rectangle per span in order, and the overlay's size with its padding. |
kit::overlay_card_props |
An overlay card's anchor and look. |
kit::overlay_span |
One span of an overlay card or a banner: an optional leading icon (ICON_STATUS in the span's colour, GAP_ICON_TEXT before the text) and the text in a role and colour. In a card, lineBreak starts a new line with the span; trailing spans go right-aligned after a flexible space, in their order. |
kit::picture_props |
A picture: a texture of the ImGui renderer over its backdrop, with the play border. |
kit::picture_reply |
What a picture reported in its frame, and where it went. |
kit::property_grid_props |
A property grid's options. |
kit::property_group_props |
A group's label, marks and summary. |
kit::property_row_props |
A property row's label, marks and shape. |
kit::property_row_slots |
The space where the slots of a property row land: the change dot, the label, the values and the pin (an empty rectangle at the values' end without the pin column). |
kit::property_section_props |
A property section's header: the title and icon, and what its trailing edge shows from the outside in, each only when given: the pin (marks.pinnable, in a grid with the pin column), the change dot (marks.changedByPlay), a checkbox (the component's enabled state) and a MONO tag in accent ("Game"). The header repeats what its rows show only while they are hidden: the change dot shows on a collapsed section, and on an open one only when none of its rows or groups drew a change dot of their own (a section of no rows, a change of a value no row shows), drawn as the section ends; its place is kept either way. A PARTIAL pin is drawn plain, as OFF, on an open section (its press still pins the whole), where the rows' own pins show. The trailing parts are keyed under a scope of their own, so no row of the section shares their ids whatever its key. |
kit::row_marks |
The marks a property row (or a section's header, or a group's row) shows during play, which replace the field hooks the stock inspector drew them with: the 6 px change dot in play when play changed the value, the persisted mark on its values (field_mark_flags::PERSISTED through property_row::field_marks()), and its pin, shown only where the target can be pinned. |
kit::screen_props |
How a screen lays out its content, in pixels at 100 % (scaled and snapped as the metrics are): one column at most columnWidth wide (0: the whole width), centred in the work area, margin below the work area's top and, when the work area is narrower than the column and two margins, from its sides. A size that is not finite or not positive is none. |
kit::status_arrangement |
Where a status strip's segments landed: one box per segment, in order, and how much too narrow the strip was. |
kit::status_segment |
One segment of the status bar: an optional leading dot (STATUS_DOT in online, GAP_CHECK before the text) or icon (ICON_STATUS in the text's colour, GAP_ICON_TEXT before the text), then the text in a role and colour. Trailing segments come after the flexible space, right-aligned, in their order. |
kit::tab_decoration |
What a panel's dock tab shows besides its title: a 12 px icon of the kit's registry before the title, then a badge pill in a tone (a count: the Persist panel's pins), the 7 px connected dot in online (an agent is connected) and the 6 px unsaved dot in play (unsaved changes). A panel publishes it every frame through its panel_shell; what a frame does not set is not shown. |
Classes
| File | Description |
|---|---|
kit::banner |
A banner (widget_kind::OVERLAY, passive, keyed key) of one line of spans. The key is copied (at most MAX_OVERLAY_KEY bytes); the span texts must outlive the banner. Main thread, inside an ImGui frame and window, with a current kit context. Cannot be copied or moved. |
kit::dock_chrome |
The dock chrome of the ImGui context the workspace draws in: while NewFrame updates the floating dock nodes (two context hooks), the chrome font is ImGui's default font, the chrome metrics are its style's and the tab items count as the kit's (the stock-item counter); Ctrl+Tab window switching, whose list shows window names, is off; paint() draws the decoration; and undock() takes a panel out of its node. Main thread. Cannot be copied or moved (the hooks hold its address). |
kit::dockspace_scope |
Pushes the dock chrome's font and metrics, and counts the items submitted as the kit's, around the dockspace's submission (where ImGui lays out and submits the docked nodes' tab bars). Nothing without a current kit context or the chrome font. Cannot be copied or moved. |
kit::overlay_card |
A card over a picture (widget_kind::OVERLAY, passive, keyed key): the overlay fill inside a 1 px LINE edge at its anchor with its spans (the edge keeps it apart from an empty picture: High contrast's overlay is black on a black backdrop). The key is copied (at most MAX_OVERLAY_KEY bytes); the span texts must outlive the card. Main thread, inside an ImGui frame and window, with a current kit context. Cannot be copied or moved. |
kit::panel_chrome |
What the dock chrome keeps of one panel between frames: its title and registry name, the name its window is begun with, the decoration and header actions it published, the footer's texts and the window it was drawn in. editor_panel owns one; panel_shell writes it and dock_chrome::paint reads it. Cannot be copied or moved (a shell keeps its address while it lives). |
kit::panel_shell |
The body of a panel for one frame: it publishes the tab decoration, begins and ends the panel's window with the dock chrome, adds header actions, wraps the content below the panel's strips in a scrolling child and shows a footer. A shell without a current kit context, without the chrome font in the atlas or for a panel without a registry name begins a plain window ("<title>###<registry name>", NoCollapse, no close button), adds header actions as icon buttons at the layout cursor and draws no chrome. Main thread, inside an ImGui frame. Cannot be copied or moved. |
kit::property_grid |
The inspector's body for one frame: the sections and blocks submitted inside stack below the layout cursor across the width left on the line, or props.width (no spacing of ImGui's own between them: ItemSpacing is 0 inside). It scopes the ids of what is inside under its key and resolves its reveal request: a request whose target was not met counts a miss when the grid closes. Cannot be copied or moved. |
kit::property_group |
A nested struct, list or JSON object of a section: a row whose label slot holds a chevron (ICON_TINY, a quarter turn while collapsed) and the label after GAP_ICON_TEXT, and while open, the rows submitted after it (until it closes) one depth further in, their labels indented by the chevron and its gap so they line up with the group's label. A click, Enter or Space toggles it, Left closes and Right opens it; its open state is kept per id. A pending reveal of a row inside opens it. Its key scopes the ids of what is inside. Recorded as a PROPERTY_GROUP (interactive) keyed by key, its label as text. Cannot be copied or moved. |
kit::property_reveal |
A request to show a section or a row of a property grid, and the highlight that follows (the pinned list's "go to the pin"). The owner of the grid keeps one and hands it to the grid every frame (property_grid_props::reveal). A request names a section's key and, optionally, a row's key: the grid that meets the section opens it, opens each group on the way (a group whose key the row's key extends, as a path does: the group "/material" for the row "/material/colour", or "material" for "material.colour" or "material[0]"; a row whose key the request's extends is met for a part of its value: "/position" for "/position/0"), scrolls the row (or, without one, the section's header) into view and highlights it in the persist tone for REVEAL_HOLD_SECONDS, fading over REVEAL_FADE_SECONDS. A custom block of the grid is revealed by its own key through property_grid::reveal(). A request whose target the grid does not meet in REVEAL_PATIENCE of its frames is dropped. Main thread. |
kit::property_row |
One property of a section: its slots (arrange_property_row) on the body's next line, ROW tall per value line: the change dot (DOT in play) when changed by play, the label in BODY muted (indented under the groups around it, ellipsised, or wrapped onto lines of its own with wrapLabel, the row as tall as they need), the values (the caller's widgets: given values() or line(), or placed by the row, which is the layout host while it lives, left to right in what is left of the values, a widget of width 0 taking the rest), and the pin in the pin slot when the target is pinnable. The ids of what is submitted inside are scoped under the row's key, so a row's own value may be keyed "value". A pending reveal of this row, or of a part of its value (a key that extends the row's as a path does: "/position/0" of the row "/position"; a row draws its value whole), scrolls it into view and starts its highlight: a persistSoft band behind the row, fading, on which the label takes text and the pin's faint outline muted, so both read there. Recorded as a PROPERTY_ROW (passive, hoverable for its tooltip) keyed by key, its label as text. Cannot be copied or moved. |
kit::property_section |
One section of a grid (a component): a 1 px line2 line above, the header (HEADER 28, head, PAD_CONTROL in, gap GAP_HEADER: the chevron (ICON_TINY, chevron.down, a quarter turn while collapsed) at 10, the icon at 28, the title in HEADING strong at 50, the trailing marks at the trailing edge), then, while open, the body: padding 8 at the top, PAD_CONTROL at the sides, 10 at the bottom, and its lines (rows, groups, notes, placed widgets) GAP_SECTION_ROW apart. A click, Enter or Space on the header toggles it, Left closes it and Right opens it while the keyboard is on it; its open state is kept per id in the window's state storage. The right button released over the header asks for its context menu (menu_requested()). Recorded as a SECTION (the header, interactive) keyed by key, its title as text. While it is open it is the kit's layout host. Cannot be copied or moved. |
kit::screen |
A window over the main viewport's work area, behind every other window (the start screen): no title bar, no border, no move, resize or docking, no saved settings, never brought to the front by a click. Its content is one column, centred by the window's padding so every widget in it fills the column's width, its widgets GAP_ROW apart. A column taller than the work area scrolls, and the screen's scrollbar (the 6 px PRIMITIVE one) shows that it does. Cannot be copied or moved. |
kit::status_strip |
The status bar's strip: collects segments and, when it closes, arranges and paints them at the layout cursor across the width left on the line. The segments' texts must outlive the strip. Cannot be copied or moved. |
kit::toolbar_group |
A cluster of widgets inside a strip, itself one item of the strip. Cannot be copied or moved. |
kit::toolbar_strip |
A bar of widgets placed left to right. Cannot be copied or moved. |
kit::viewport_bar |
A fixed bar across the main viewport (ImGui's viewport side bar): a window that cannot be moved, resized, docked or scrolled, keeps no settings, has no padding and no border, and takes height pixels at edge. navigable false keeps keyboard navigation out of it (the status bar). Cannot be copied or moved. |
Enumerations
kit::bar_edge
enum class bar_edge : u8 {
TOP = 0, // under the bars submitted before it this frame (the menu bar)
BOTTOM
};
The edge of the main viewport a viewport_bar runs along.
kit::group_look
How a toolbar group looks: PLAIN only clusters its widgets (the strip's gap between them), SEGMENTED puts them on a sunken track 30 tall.
kit::overlay_corner
The corner of a rectangle an overlay is anchored to.
kit::overlay_look
How an overlay card is drawn on the picture's overlay fill: CHIP padding 4 8 and RADIUS_CONTROL (the cursor chip), CARD padding 8 10, RADIUS_GROUP and OVERLAY_LINE_GAP between lines (the stats chip).
kit::picture_backdrop
What a picture shows where its texture draws nothing (a render target is transparent where the scene drew nothing): NONE nothing (the window shows through), VIEWPORT the theme's viewport backdrop (fill_token::VIEWPORT: the Scene view), BLACK opaque black (the Game view: what a shipped game shows behind its picture; data, not a theme colour).
kit::picture_input
How a picture takes input: NONE passive and never hovered (the gizmo has the pointer), SURFACE an input surface that every mouse button holds and presses, out of keyboard navigation, which a later item may overlap (the camera drags, a pick, the game's mouse).
kit::pin_state
What a pin shows about what the play session keeps of its target (the inspector's pins): OFF nothing (the outline pin in faint; pressing pins it), PINNED a pin names exactly this target (the filled pin in persist on persistSoft; pressing unpins it), COVERED a wider pin keeps it (its component's, its entity's: the outline pin in persist on persistSoft, never pressed), PARTIAL pins inside keep part of it (the outline pin in persist; pressing pins the whole).
kit::strip_size
A strip's size: MAIN 40 (the toolbar: chrome fill, padding PAD_CONTROL, gap GAP_TOOLBAR), SUB 32 (the view-options strip: padding PAD_SEARCH, gap GAP_HEADER), TOOL 30 (a panel's tool row: padding PAD_CONTROL, gap GAP_HEADER). SUB and TOOL are not filled: they show the panel behind them.
Forward Declarations
ImDrawListSplitter
ImFont
ImGuiContext
ImGuiWindow
kit::dock_chrome::hook_bridge
Constants
| Name | Type | Value | Description |
|---|---|---|---|
kit::FLOATING_PANEL_HEIGHT |
inline constexpr f32 |
560.0f |
|
kit::FLOATING_PANEL_SHADOW |
inline constexpr f32 |
8.0f |
The soft shadow around a floating panel, in pixels at 100 % (as a popup's, POPUP_SHADOW). |
kit::FLOATING_PANEL_WIDTH |
inline constexpr f32 |
480.0f |
The size a panel first opened floating takes, in pixels at 100 % (the kit's scale applies), unless the panel names its own (panel_shell::set_floating_size): a usable window, never the size of its first frame's contents. |
kit::MAX_BAR_NAME |
inline constexpr usize |
63 |
The longest window name a viewport_bar or a screen takes, in bytes (ImGui needs it NUL-terminated, so it is copied). |
kit::MAX_CHANGE_LABEL |
inline constexpr usize |
127 |
The longest change-dot tooltip an open section keeps for its late dot, in bytes (a longer one is cut at a character boundary). |
kit::MAX_OVERLAY_KEY |
inline constexpr usize |
63 |
The longest key an overlay card or a banner takes, in bytes: the key is copied, so it need not outlive the scope (a key made with std::format for the view it is drawn in). |
kit::MAX_OVERLAY_SPANS |
inline constexpr usize |
16 |
The most spans one card or banner holds. |
kit::MAX_STATUS_SEGMENTS |
inline constexpr usize |
16 |
The most segments a status_strip holds. |
kit::OVERLAY_LINE_GAP |
inline constexpr f32 |
3.0f |
The gap between a card's lines, in pixels at 100 % (the stats chip's gap 3). |
kit::PREFAB_BANNER_HEIGHT |
inline constexpr f32 |
28.0f |
The least height of a PREFAB banner in the flow, in pixels at 100 % (the mockup's prefab banner,its CSS line box with the padding and the edge): its spans are centred in it. |
kit::PROPERTY_VALUES_WIDTH |
inline constexpr f32 |
198.0f |
A property row's values slot at 100 % in an inspector 340 px wide: room for a vector's three 48 px fields, each after its 15 px tag. |
kit::REVEAL_FADE_SECONDS |
inline constexpr f32 |
0.6f |
How long the highlight then takes to fade out, in seconds. |
kit::REVEAL_HOLD_SECONDS |
inline constexpr f32 |
1.0f |
How long a revealed row stays highlighted at full strength, in seconds of ImGui's clock. |
kit::REVEAL_PATIENCE |
inline constexpr u32 |
3 |
How many frames of a grid a reveal request waits for its target before it is dropped (the target's entity may be selected in the frame the request is made and shown from the next). |
Functions
Public
kit::arrange_overlay
kit::arrange_overlay[[nodiscard]] CONJURE_API overlay_arrangement arrange_overlay( std::span<const overlay_span> spans, const math::vec2 &padding, f32 lineGap, f32 width, const text_metrics &metrics, const token_set &tokens );Arranges spans (at most MAX_OVERLAY_SPANS) from the origin: padding (x, y, at the tokens' scale already) inside, a line's spans GAP_ROW apart (an icon and its text counted as one span), lines lineGap apart, each line as tall as its tallest role and its spans centred on it. width 0 sizes the overlay to its widest line; a larger one keeps that width, each line's trailing spans then right-aligned before the padding (a banner across a panel). The size is rounded up to whole pixels. Pure.
kit::arrange_property_row
kit::arrange_property_row[[nodiscard]] CONJURE_API property_row_slots arrange_property_row( const rect &row, bool pinColumn, const token_set &tokens, f32 labelWidth = 0.0f ) noexcept;The slots of a property row at row (the body's width): [change DOT][label][values, the rest][pin PIN], GAP_ROW apart, the label property_label_width(labelWidth) wide (LABEL_WIDTH by default); without the pin column the values take its width and gap. Every slot is the row's height (a dot or pin is centred in it by the row). At 320 px (a 340 px inspector less its padding) the slots are 6 | 78 | 198 | 20. Pure.
kit::arrange_status
kit::arrange_status[[nodiscard]] CONJURE_API status_arrangement arrange_status( std::span<const status_segment> segments, f32 origin, f32 width, const text_metrics &metrics, const token_set &tokens );Where a status strip's segments land (pure): one box per segment in order along the strip from origin over width (padding PAD_CONTROL at both ends, GAP_STATUS between segments and around the flexible space that separates the leading segments from the trailing ones). Too narrow, the leading segments keep their sizes and overflow says by how much.
kit::banner_height
kit::banner_height[[nodiscard]] CONJURE_API f32 banner_height( tone emphasis, std::span<const overlay_span> spans, const text_metrics &metrics, const token_set &tokens );The height a banner of a tone takes for its spans: their arranged height with the tone's padding, and for a PREFAB banner at least PREFAB_BANNER_HEIGHT at the tokens' scale (rounded). Reserve this for a banner in the flow. Pure.
kit::banner_padding
kit::banner_padding[[nodiscard]] CONJURE_API math::vec2 banner_padding(tone emphasis, const token_set &tokens) noexcept;The padding inside a banner of a tone, at the tokens' scale (x across, y down). Pure.
kit::first_floating_place
kit::first_floating_place[[nodiscard]] CONJURE_API rect first_floating_place( const math::vec2 &size, const math::vec2 &workMin, const math::vec2 &workSize, const token_set &tokens ) noexcept;The size and place a panel first opened floating takes (no layout file places its window): size (at 100 %) at the tokens' scale, held to the work area less a tab bar's height (TAB_BAR) on each side and at least one tab bar square, centred in the work area. workMin and workSize are the work area's corner and size. Pure.
kit::height_of
kit::height_of[[nodiscard]] CONJURE_API f32 height_of(strip_size size, const token_set &tokens) noexcept;A strip's height in pixels at the tokens' scale, without its bottom line.
kit::measure
kit::measure[[nodiscard]] CONJURE_API math::vec2 measure( const status_segment &segment, const text_metrics &metrics, const token_set &tokens );A segment's size: its parts and their gap, by the status bar's height. Pure.
kit::picture
kit::pictureCONJURE_API picture_reply picture( std::string_view key, const picture_props &props, const std::optional<rect> &bounds = std::nullopt );A picture (widget_kind::PICTURE, keyed key; a SURFACE needs a key) in bounds, or at the layout cursor across the width and height left in the window's content region: its backdrop, the texture stretched over it (only a texture the caller knows the ImGui renderer holds: an unknown one draws the font atlas), then the play border. Replaces ImGui::Image for the Scene and Game views; overlays go over it after it. Main thread, inside an ImGui frame and window, with a current kit context.
kit::place_overlay
kit::place_overlay[[nodiscard]] CONJURE_API rect place_overlay( const overlay_anchor &anchor, const math::vec2 &size, const token_set &tokens ) noexcept;The rectangle of size at an anchor, its corner on whole pixels. Pure.
kit::property_label_room
kit::property_label_room[[nodiscard]] CONJURE_API f32 property_label_room(f32 gridWidth, bool pinColumn, const token_set &tokens) noexcept;The widest label slot, in pixels at 100 % as property_grid_props::labelWidth takes it, that a grid gridWidth pixels wide gives its rows while their values keep PROPERTY_VALUES_WIDTH at the tokens' scale: the rows' width (the grid's less PAD_CONTROL at each side) less the change dot, the values, the pin with pinColumn and the gaps between them, whole pixels; never under LABEL_WIDTH, and LABEL_WIDTH for a width that is not finite. A grid of long labels takes the smaller of its widest label and this, so its values never shrink for them. Pure.
kit::property_label_width
kit::property_label_width[[nodiscard]] CONJURE_API f32 property_label_width(f32 labelWidth, const token_set &tokens) noexcept;The label slot of a property row in pixels at the tokens' scale: labelWidth (pixels at 100 %) times the scale, rounded to whole pixels, where that is wider than LABEL_WIDTH; LABEL_WIDTH otherwise, and for a width that is not finite. Pure.
kit::reveal_strength
kit::reveal_strengthThe strength of a reveal's highlight elapsed seconds after it started: 1 for REVEAL_HOLD_SECONDS, then down to 0 over REVEAL_FADE_SECONDS; 1 before it started (a negative time), 0 for a time that is not a number. Pure.
kit::spell_window_name
kit::spell_window_nameCONJURE_API void spell_window_name(std::string &name, f32 width, std::string_view registryName);The window name that gives a dock tab width pixels: chrome spacer glyphs whose advances add up to the label width ImGui lays such a tab out for (the width less 1: the chrome's FramePadding.x is 0 and ImGui adds 1), followed by "###<registryName>", which is the window's identity. width is taken in whole pixels; below 1 it gives no spacers. Written into name, whose memory is reused.
kit::tab_width
kit::tab_width[[nodiscard]] CONJURE_API f32 tab_width( std::string_view title, const tab_decoration &decoration, const text_metrics &metrics, const token_set &tokens );The width of a dock tab showing title and decoration (12 + [12 icon + 6] + title + [6 + badge] + [6 + dot] + [6 + unsaved dot] + 12 + the 1 px divider), its title in BODY, at the tokens' scale, rounded up to whole pixels. Pure.
kit::to_string
kit::to_string[[nodiscard]] CONJURE_API std::string_view to_string(bar_edge edge) noexcept;"top", "bottom"; "" outside the enumeration.
[[nodiscard]] CONJURE_API std::string_view to_string(strip_size size) noexcept;"main", "sub", "tool"; "" outside the enumeration.
[[nodiscard]] CONJURE_API std::string_view to_string(pin_state state) noexcept;"off", "pinned", "covered", "partial"; "" outside the enumeration.
[[nodiscard]] CONJURE_API std::string_view to_string(overlay_corner corner) noexcept;"top_left", "top_right", "bottom_left", "bottom_right"; "" outside the enumeration.