Struct ChildWindow

Source
pub struct ChildWindow<'ui> { /* private fields */ }
Expand description

Builder for a child window

Implementations§

Source§

impl<'ui> ChildWindow<'ui>

Source

pub fn new(ui: &'ui Ui, name: impl AsRef<str>) -> ChildWindow<'ui>

👎Deprecated since 0.9.0: use ui.child_window(…) instead

Creates a new child window builder with the str.

Source

pub fn new_id(ui: &'ui Ui, id: Id) -> ChildWindow<'ui>

Creates a new child window builder with the given imgui id.

Source

pub fn flags(self, flags: WindowFlags) -> ChildWindow<'ui>

Replace current window flags with the given value

Source

pub fn size(self, size: impl Into<Vector2<f32>>) -> ChildWindow<'ui>

Sets the child window size.

For each independent axis of size:

  • > 0.0: fixed size
  • = 0.0: use remaining host window size
  • < 0.0: use remaining host window size minus abs(size)
Source

pub fn content_size(self, size: impl Into<Vector2<f32>>) -> ChildWindow<'ui>

Sets the window content size, which can be used to enforce scrollbars.

Does not include window decorations (title bar, menu bar, etc.). Set one of the values to 0.0 to leave the size automatic.

Source

pub fn focused(self, focused: bool) -> ChildWindow<'ui>

Sets the window focused state, which can be used to bring the window to front

Source

pub fn bg_alpha(self, bg_alpha: f32) -> ChildWindow<'ui>

Sets the background color alpha value.

See also draw_background

Source

pub fn border(self, border: bool) -> ChildWindow<'ui>

Enables/disables the child window border.

Disabled by default.

Source

pub fn movable(self, value: bool) -> ChildWindow<'ui>

Enables/disables moving the window when child window is dragged.

Enabled by default.

Source

pub fn scroll_bar(self, value: bool) -> ChildWindow<'ui>

Enables/disables scrollbars (scrolling is still possible with the mouse or programmatically).

Enabled by default.

Source

pub fn scrollable(self, value: bool) -> ChildWindow<'ui>

Enables/disables vertical scrolling with the mouse wheel.

Enabled by default. When enabled, child windows forward the mouse wheel to the parent unless NO_SCROLLBAR is also set.

Source

pub fn always_auto_resize(self, value: bool) -> ChildWindow<'ui>

Enables/disables resizing the window to its content on every frame.

Disabled by default.

Source

pub fn draw_background(self, value: bool) -> ChildWindow<'ui>

Enables/disables drawing of background color and outside border.

Enabled by default.

Source

pub fn mouse_inputs(self, value: bool) -> ChildWindow<'ui>

Enables/disables catching mouse input.

Enabled by default. Note: Hovering test will pass through when disabled

Source

pub fn menu_bar(self, value: bool) -> ChildWindow<'ui>

Enables/disables the menu bar.

Disabled by default.

Source

pub fn horizontal_scrollbar(self, value: bool) -> ChildWindow<'ui>

Enables/disables the horizontal scrollbar.

Disabled by default.

Source

pub fn focus_on_appearing(self, value: bool) -> ChildWindow<'ui>

Enables/disables taking focus when transitioning from hidden to visible state.

Enabled by default.

Source

pub fn bring_to_front_on_focus(self, value: bool) -> ChildWindow<'ui>

Enables/disables bringing the window to front when taking focus (e.g. clicking it or programmatically giving it focus).

Enabled by default.

Source

pub fn always_vertical_scrollbar(self, value: bool) -> ChildWindow<'ui>

When enabled, forces the vertical scrollbar to render regardless of the content size.

Disabled by default.

Source

pub fn always_horizontal_scrollbar(self, value: bool) -> ChildWindow<'ui>

When enabled, forces the horizontal scrollbar to render regardless of the content size.

Disabled by default.

Source

pub fn always_use_window_padding(self, value: bool) -> ChildWindow<'ui>

When enabled, ensures child windows without border use style.window_padding.

Disabled by default.

Source

pub fn nav_inputs(self, value: bool) -> ChildWindow<'ui>

Enables/disables gamepad/keyboard navigation within the window.

Enabled by default.

Source

pub fn nav_focus(self, value: bool) -> ChildWindow<'ui>

Enables/disables focusing toward this window with gamepad/keyboard navigation (e.g. CTRL+TAB).

Enabled by default.

Source

pub fn no_nav(self) -> ChildWindow<'ui>

Disable gamepad/keyboard navigation and focusing.

Shorthand for

.nav_inputs(false)
.nav_focus(false)
Source

pub fn no_inputs(self) -> ChildWindow<'ui>

Don’t handle input.

Shorthand for

.mouse_inputs(false)
.nav_inputs(false)
.nav_focus(false)
Source

pub fn begin(self) -> Option<ChildWindowToken<'ui>>

Creates a child window and starts append to it.

Returns Some(ChildWindowToken) if the window is visible. After content has been rendered, the token must be ended by calling .end().

Returns None if the window is not visible and no content should be rendered.

Source

pub fn build<T, F>(self, f: F) -> Option<T>
where F: FnOnce() -> T,

Creates a child window and runs a closure to construct the contents. Returns the result of the closure, if it is called.

Note: the closure is not called if no window content is visible (e.g. window is collapsed or fully clipped).

Trait Implementations§

Source§

impl<'ui> Clone for ChildWindow<'ui>

Source§

fn clone(&self) -> ChildWindow<'ui>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'ui> Debug for ChildWindow<'ui>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'ui> Copy for ChildWindow<'ui>

Auto Trait Implementations§

§

impl<'ui> Freeze for ChildWindow<'ui>

§

impl<'ui> !RefUnwindSafe for ChildWindow<'ui>

§

impl<'ui> !Send for ChildWindow<'ui>

§

impl<'ui> !Sync for ChildWindow<'ui>

§

impl<'ui> Unpin for ChildWindow<'ui>

§

impl<'ui> !UnwindSafe for ChildWindow<'ui>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V