Struct arcdps_imgui::Window

source ·
pub struct Window<'a, T> { /* private fields */ }
Expand description

Builder for a window

Implementations§

source§

impl<'a, T: AsRef<str>> Window<'a, T>

source

pub fn new(name: T) -> Self

Creates a new window builder with the given name

source

pub fn opened(self, opened: &'a mut bool) -> Self

Enables the window close button, which sets the passed boolean to false when clicked

source

pub fn flags(self, flags: WindowFlags) -> Self

Replace current window flags with the given value

source

pub fn position(self, position: [f32; 2], condition: Condition) -> Self

Sets the window position, which is applied based on the given condition value

source

pub fn position_pivot(self, pivot: [f32; 2]) -> Self

Sets the window position pivot, which can be used to adjust the alignment of the window relative to the position.

For example, pass [0.5, 0.5] to center the window on the position. Does nothing if window position is not also set with position().

source

pub fn size(self, size: [f32; 2], condition: Condition) -> Self

Sets the window size, which is applied based on the given condition value

source

pub fn size_constraints(self, size_min: [f32; 2], size_max: [f32; 2]) -> Self

Sets window size constraints.

Use -1.0, -1.0 on either X or Y axis to preserve current size.

source

pub fn content_size(self, size: [f32; 2]) -> Self

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 collapsed(self, collapsed: bool, condition: Condition) -> Self

Sets the window collapse state, which is applied based on the given condition value

source

pub fn focused(self, focused: bool) -> Self

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

source

pub fn bg_alpha(self, bg_alpha: f32) -> Self

Sets the background color alpha value.

See also draw_background

source

pub fn title_bar(self, value: bool) -> Self

Enables/disables the title bar.

Enabled by default.

source

pub fn resizable(self, value: bool) -> Self

Enables/disables resizing with the lower-right grip.

Enabled by default.

source

pub fn movable(self, value: bool) -> Self

Enables/disables moving the window.

Enabled by default.

source

pub fn scroll_bar(self, value: bool) -> Self

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

Enabled by default.

source

pub fn scrollable(self, value: bool) -> Self

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 collapsible(self, value: bool) -> Self

Enables/disables collapsing the window by double-clicking it.

Enabled by default.

source

pub fn always_auto_resize(self, value: bool) -> Self

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

Disabled by default.

source

pub fn draw_background(self, value: bool) -> Self

Enables/disables drawing of background color and outside border.

Enabled by default.

source

pub fn save_settings(self, value: bool) -> Self

Enables/disables loading and saving of settings (e.g. from/to an .ini file).

Enabled by default.

source

pub fn mouse_inputs(self, value: bool) -> Self

Enables/disables catching mouse input.

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

source

pub fn menu_bar(self, value: bool) -> Self

Enables/disables the menu bar.

Disabled by default.

source

pub fn horizontal_scrollbar(self, value: bool) -> Self

Enables/disables the horizontal scrollbar.

Disabled by default.

source

pub fn focus_on_appearing(self, value: bool) -> Self

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) -> Self

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) -> Self

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) -> Self

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) -> Self

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

Disabled by default.

source

pub fn nav_inputs(self, value: bool) -> Self

Enables/disables gamepad/keyboard navigation within the window.

Enabled by default.

source

pub fn nav_focus(self, value: bool) -> Self

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

Enabled by default.

source

pub fn unsaved_document(self, value: bool) -> Self

When enabled, appends ‘*’ to title without affecting the ID, as a convenience.

Disabled by default.

source

pub fn no_nav(self) -> Self

Disable gamepad/keyboard navigation and focusing.

Shorthand for

.nav_inputs(false)
.nav_focus(false)
source

pub fn no_decoration(self) -> Self

Disable all window decorations.

Shorthand for

.title_bar(false)
.resizable(false)
.scroll_bar(false)
.collapsible(false)
source

pub fn no_inputs(self) -> Self

Don’t handle input.

Shorthand for

.mouse_inputs(false)
.nav_inputs(false)
.nav_focus(false)
source

pub fn begin<'ui>(self, ui: &Ui<'ui>) -> Option<WindowToken<'ui>>

Creates a window and starts appending to it.

Returns Some(WindowToken) 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<R, F: FnOnce() -> R>(self, ui: &Ui<'_>, f: F) -> Option<R>

Creates a 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<'a, T: Debug> Debug for Window<'a, T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for Window<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for Window<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Window<'a, T>
where T: Send,

§

impl<'a, T> Sync for Window<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Window<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for Window<'a, T>

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, 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.