Skip to main content

Crate dear_imgui_cte

Crate dear_imgui_cte 

Source
Expand description

Preview, context-bound ImGuiColorTextEdit bindings through cimCTE.

Persistent TextEditor and TextDiff values are created from a dear_imgui_rs::Context and rendered through CteUiExt on that same Context. This fragment assumes an attached managed renderer and platform frame setup; see examples/03-features/cte_minimal.rs for a runnable application:

use dear_imgui_cte::{CteUiExt, Language, TextEditor};
use dear_imgui_rs::Context;

let mut imgui = Context::create();
let mut editor = TextEditor::try_create(&imgui)?;
editor.set_text("int main() { return 0; }\n")?;
editor.set_language(Some(Language::Cpp));

let ui = imgui.frame();
ui.text_editor(&mut editor, "Source")
    .size([640.0, 480.0])
    .build()?;

Native owners are neither Send nor Sync. Rendering with a Ui from another Context is rejected before FFI, and applications should drop every CTE owner before its Context. If the Context has already died, Drop deliberately leaks the native handle rather than dereferencing invalid native state.

Stateful callbacks are owned by their editor. Reentering the same mutable callback skips the nested invocation; text filters validate a complete batch before mutation. A callback panic is diagnosed and aborts rather than unwinding through native C++ frames. Trie autocomplete uses upstream-exclusive callback slots, so conflicts are reported instead of silently replacing user callbacks.

Add dejavu_font_source to the managed font atlas before renderer initialization. Do not use the raw cimCTE SetDejavu helper from safe integrations: it clears the complete atlas and changes its loader outside renderer texture management.

Structs§

AutocompleteConfig
Configuration copied into an editor when autocomplete is installed.
AutocompleteContext
Copied syntax context for one autocomplete request.
AutocompleteRequest
Callback-scoped access to the current autocomplete request.
CaretEvent
Copied caret geometry and style for one render callback.
DecoratorEvent
Copied line-decorator geometry for one render callback.
LineNumberEvent
Copied geometry and palette color for one line-number render callback.
Palette
An owned copy of all editor palette colors.
PopupEvent
Copied document position for a context-menu or hover callback.
Position
A document position expressed as a zero-based line and glyph column.
SearchOptions
Matching options used by occurrence search operations.
Selection
A half-open document selection.
SquiggleKind
Application-defined diagnostic category for a squiggle.
TextChange
A text transaction view valid only for one callback invocation.
TextDiff
An owned, context-bound syntax-highlighted text diff.
TextDiffRenderer
Builder for one TextDiff render submission.
TextEditor
An owned, context-bound ImGuiColorTextEdit editor.
TextEditorRenderer
Builder for one TextEditor render submission.
TrieAutocomplete
A transient view proving that Trie autocomplete is owned by its editor.
VisualPosition
A visual row and column after wrapping and folding are applied.

Enums§

CteError
Errors reported by the safe cimCTE layer.
Language
A built-in ImGuiColorTextEdit language definition.
MiddleMouseMode
Middle-mouse interaction behavior.
PaletteColor
Semantic color slots used by ImGuiColorTextEdit.
ScrollAlignment
Vertical alignment used when scrolling a line into view.
SquiggleStyle
Rendering style for a diagnostic or search-result annotation.
TextChangeKind
Whether a transaction inserted or deleted text.

Traits§

CteUiExt
Extension methods for rendering cimCTE widgets from a Dear ImGui frame.

Functions§

dejavu_font_source
Returns cimCTE’s bundled DejaVu font as a safe Dear ImGui font source.
noto_sans_sc_font_source
Returns cimCTE’s bundled Noto Sans SC font through the managed font atlas.

Type Aliases§

CteResult
Result alias used by the safe cimCTE layer.