Skip to content

Examples and recipes

Use the Gallery as a live specimen, then follow the public header and implementation linked below. Its examples run inside the Gallery host; they are not standalone widgets or a replacement for a host application’s data and runtime. The shared rules are simple: link the module target, call draw APIs between ImGui::NewFrame() and ImGui::Render(), and keep the ImGui context, renderer, fonts, application state, persistence, undo and workers in the host.

Module and purpose Include and CMake target Frame call and owned state Gallery page, source, and next reading Scope and constraints
Components: controls and settings rows <imkit/components.h> · imkit::imkit imkit::ActionButton("Apply", imkit::ActionVariant::Primary); State and IDs are host-owned. Basic controls · gallery.cpp · Components recipes Uses native ImGui item/input contracts. Views and labels are borrowed for the draw call.
Icons and theme: consistent appearance and symbols <imkit/theme.h>, <imkit/icons.h> · imkit::imkit Build a host-owned theme with imkit::MakeTheme(...); apply it in the host’s frame scope. The host owns theme lifetime and font atlas. Icons, Appearance in the header · gallery.cpp · Themes, Icons Theme selection and persistence remain host-owned; icon atlas upload is the host’s responsibility.
Workflow and shell, shell components: guide multi-step tools and application chrome <imkit/workflow.h>, <imkit/components.h> · imkit::imkit Draw the selected component in the frame and handle returned requests in the host. Providers, model data, UI state and command dispatch belong to the host. Workspace shell, Progress and states, Preview tiles · workflow_pages.cpp, gallery.cpp · Workflow guide These are UI building blocks. They do not implement persistence, background work, navigation policy or application services.
Node Editor: render graph snapshots and collect edits <imkit/node_editor.h> · imkit::node_editor Use BeginEditor, DrawNodes, and EndEditor during the frame with a current snapshot and caller-owned request buffer. The host validates revisions and applies requests. Separate Node Editor Gallery · examples/node_editor/main.cpp · Node Editor integration Graph storage, socket policy, evaluation, undo and persistence stay in the host. The companion material graph is a specimen.
Editor Suite: reusable editing surfaces <imkit/editor_suite.h> or a narrower module header · imkit::editor_suite Draw with host-owned providers and event buffers inside the frame. The host applies edits and owns selection, media, undo, clocks and workers. Editor Core, Video, CG · editor_workspaces.cpp · Editor Suite, Editor API Video does not decode or play media; CG does not provide a general renderer. See module contracts for capacity and provider rules.
Timeline editing: fades, transitions and grouped moves <imkit/video.h> · imkit::video (or imkit::editor_suite) Call Video drawing in the frame with a host-owned TimelineEditingProvider; validate and commit its events in the host. Video · editor_workspaces.cpp · Timeline editing Provider and event storage must remain valid for the call. Collision policy, persistence and undo are host-owned.
Window frame: draw a themed title area and return window operations <imkit/window_frame.h> · imkit::imkit; optional <imkit/window_frame_win32.h> or <imkit/window_frame_macos.h> · matching OS target Draw with explicit style/content/state in the frame; execute the returned operation in the host. The host owns the native window and event loop. Window frame · gallery.cpp · WindowFrame guide Core drawing does not own a native window. Win32/Cocoa integration is an optional platform target; platform input behavior needs native acceptance.

The following is a placement sketch, not a complete application or build file. It uses the public ActionButton call; see the Gallery source for a complete compile-checked implementation.

// The host has already created the matching Dear ImGui context and backends.
ImGui::NewFrame();
if (imkit::ActionButton("Apply", imkit::ActionVariant::Primary)) {
// Handle the request using host-owned application state.
}
ImGui::Render();

For exact overloads, defaults and ABI requirements use Public API coverage and Dependencies. For buildable consumer integration use Getting started and examples/consumer. The consumer target is a compile/link smoke example; the Gallery is the interactive learning example.

Open Workspace in the Gallery to use WorkspaceTabs, HierarchyGroupHeader/HierarchyRow, BeginInspectorCard/EndInspectorCard, SettingToggleRow, DragVector3WithUnit, ChoiceGroup and CompactActionRow together. Requests update Gallery-owned values; the same pattern works in an existing ImGui frame. See the 3.2 declarations and lifetime rules. All 321 runtime icons and 13 themes are available without introducing a new context or application framework.