DockBuilder

Struct DockBuilder 

Source
pub struct DockBuilder;
Expand description

DockBuilder API for programmatic dock layout creation

Implementations§

Source§

impl DockBuilder

Source

pub fn get_node(node_id: ImGuiID) -> *mut ImGuiDockNode

Gets a dock node by its ID

§Parameters
  • node_id - The ID of the dock node to retrieve
§Returns

A pointer to the dock node, or null if not found

§Safety

The returned pointer is only valid until the next ImGui frame. Do not store this pointer across frames.

Source

pub fn add_node(node_id: ImGuiID, flags: DockNodeFlags) -> ImGuiID

Adds a new dock node

§Parameters
  • node_id - The ID for the new dock node (use 0 to auto-generate)
  • flags - Dock node flags
§Returns

The ID of the created dock node

§Example
let node_id = DockBuilder::add_node(0, DockNodeFlags::NO_RESIZE);
Source

pub fn remove_node(node_id: ImGuiID)

Removes a dock node

§Parameters
  • node_id - The ID of the dock node to remove
§Example
DockBuilder::remove_node(123);
Source

pub fn remove_node_docked_windows(node_id: ImGuiID, clear_settings_refs: bool)

Removes all docked windows from a node

§Parameters
  • node_id - The ID of the dock node
  • clear_settings_refs - Whether to clear settings references
§Example
DockBuilder::remove_node_docked_windows(123, true);
Source

pub fn remove_node_child_nodes(node_id: ImGuiID)

Removes all child nodes from a dock node

§Parameters
  • node_id - The ID of the dock node
§Example
DockBuilder::remove_node_child_nodes(123);
Source

pub fn set_node_pos(node_id: ImGuiID, pos: [f32; 2])

Sets the position of a dock node

§Parameters
  • node_id - The ID of the dock node
  • pos - The position in pixels
§Example
DockBuilder::set_node_pos(123, [100.0, 50.0]);
Source

pub fn set_node_size(node_id: ImGuiID, size: [f32; 2])

Sets the size of a dock node

§Parameters
  • node_id - The ID of the dock node
  • size - The size in pixels
§Example
DockBuilder::set_node_size(123, [800.0, 600.0]);
Source

pub fn split_node( node_id: ImGuiID, split_dir: SplitDirection, size_ratio_for_node_at_dir: f32, out_id_at_dir: Option<&mut ImGuiID>, ) -> ImGuiID

Splits a dock node into two nodes

§Parameters
  • node_id - The ID of the dock node to split
  • split_dir - The direction to split
  • size_ratio_for_node_at_dir - The size ratio for the new node (0.0 to 1.0)
  • out_id_at_dir - Optional output for the ID of the new node in the split direction
§Returns

The ID of the remaining node (opposite to the split direction)

§Example
let dockspace_id = 1;
let left_id = DockBuilder::split_node(dockspace_id, SplitDirection::Left, 0.3, None);
Source

pub fn dock_window(window_name: &str, node_id: ImGuiID)

Docks a window to a specific dock node

§Parameters
  • window_name - The name of the window to dock
  • node_id - The ID of the dock node to dock the window to
§Example
DockBuilder::dock_window("My Tool", 123);
Source

pub fn finish(node_id: ImGuiID)

Finishes the dock builder operations

This function should be called after all dock builder operations are complete to finalize the layout.

§Parameters
  • node_id - The root node ID of the dock layout
§Example
// ... create layout ...
let dockspace_id = 1; // placeholder dockspace id for example
DockBuilder::finish(dockspace_id);

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more