Skip to main content
Version: 0.9.0

Custom GUI Panels

Language:

GUI panels let you place your application's 2D interfaces into the shared 3D room: dashboards, settings pages, control surfaces. Panels are shared session state — every peer sees the same panel at the same place, live. Panel content is currently web content: the panel renders a URI, which makes any existing web UI immediately usable in the room.

The concepts (identity by common name, top-edge-midpoint pose, size + content scale, per-peer visibility) are explained in The QAROS World and Coordinate Systems.

Creating a panel (idempotent)​

Panels are identified by a stable common name; get_or_create returns the existing panel or creates it — safe to call on every app start:

:::warning Required display name Set both the stable ASCII common name (common_name / CommonName) and a non-empty user-facing label (display_name / DisplayName) when creating or reopening a panel. The common name supplies identity; it is not a fallback label. C# option constructors leave DisplayName null, so set it explicitly in the initializer even though the property is nullable. An already open object may ignore creation options, which can hide an omitted label until a clean install or reopen. :::

QarGuiPanelInit init = qar_gui_panel_init_default();
init.common_name = "machine-status.myapp.example.com"; /* stable identity */
init.display_name = "Machine Status";

init.pose = qar_pose_default();
init.pose.position.y = 1.5f; /* top-edge midpoint, room space, meters */
init.pose.position.z = -1.0f;

QarGuiPanelSize size = qar_gui_panel_size_default();
size.width_meters = 0.8f;
size.height_meters = 0.5f;
init.size = size;

QarGuiPanelId panel_id;
QarResult r = qar_gui_panels_get_or_create(session, &init, &panel_id);
qar_result_log_if_error(r);

qar_gui_panels_navigate_to_uri(
session, &panel_id, "https://myapp.local/status-dashboard");
info

The C# snippets on this page are illustrative — they track the Quaternar.Qaros binding surface but are not yet compiled from a published sample project.

:::tip Choosing common names Use a DNS-style, application-scoped name (<panel>.<app>.<org>) and keep it constant across versions. The panel's ID is derived deterministically from it — restarting your app reattaches to the same panel instead of spawning duplicates. :::

Manipulating panels​

All mutations go through the session and the panel ID:

qar_gui_panels_update_pose(session, &panel_id, &new_pose); /* move it */
qar_gui_panels_change_size(session, &panel_id, &new_size); /* resize */
qar_gui_panels_set_state(session, &panel_id, QAR_GUI_PANEL_STATE_MINIMIZED);
qar_gui_panels_navigate_to_uri(session, &panel_id, "https://...");
qar_gui_panels_close_panel(session, &panel_id); /* remove */

Panel states: VISIBLE, MINIMIZED, HIDDEN, CLOSED.

Per-peer visibility​

By default a panel is visible to everyone: an empty visibility set means every peer, never none. Removing the last peer therefore shows the panel to everyone again; to hide it, set its state. A panel meant only for some peers is best created with them in QarGuiPanelInit::visible_to_peers. An existing one is narrowed by editing the set — for example an operator-only control panel:

const QarPeerId* add[] = { &operator_peer_id };
qar_gui_panels_update_visible_to(
session, &panel_id,
add, 1, /* additions */
NULL, 0); /* removals */

Observing panels​

Your app can react to panels changing — whether changed by another peer, another app, or a user grabbing the panel in the room:

  • qar_gui_panels_subscribe_updates(session, callback, state) — all panels,
  • qar_gui_panels_subscribe_panel_updates(session, &panel_id, callback, state) — one panel,
  • qar_query_gui_panels_count / qar_query_gui_panels — enumerate current panels (count-then-fetch),
  • per-panel getters: qar_gui_panel_get_display_name, _get_pose, _get_size, _get_state, _get_content_uri, _get_visible_to_peers.

Update callbacks arrive on library threads — see the callback rules.

Integration patterns​

Expose your app's existing web UI. If your application already serves a web frontend (local status page, embedded HTTP server), a panel is a one-call integration: get_or_create + navigate_to_uri pointing at your server. Interaction happens directly in the room.

Drive app state from a panel. Host a small web page that calls back into your application (REST/WebSocket). The panel is shared, so any user in the room can press the buttons; your app sees the effect and updates its rendered content accordingly.

Attach a panel to your app volume. Panels don't parent to volumes automatically, but you can keep one docked: subscribe to your volume's pose updates and reposition the panel relative to it. Remember the differing conventions — panel pose is the midpoint of its top edge, volume pose is the center.

Compiled tutorial​

This page is backed by the compiled example gui_panel_operations.c, covering panel create, move, navigate, and subscribe:

  • Source: qaros/qar-streaming-c/examples/gui_panel_operations.c
  • Example walkthrough: GUI Panel Operations