pub struct Window<'ui, 'a, Label> { /* private fields */ }
Expand description
Builder for a window
Implementations§
source§impl<'ui, 'a, Label: AsRef<str>> Window<'ui, 'a, Label>
impl<'ui, 'a, Label: AsRef<str>> Window<'ui, 'a, Label>
sourcepub fn new(ui: &'ui Ui, name: Label) -> Self
👎Deprecated since 0.9.0: use ui.window(…) instead
pub fn new(ui: &'ui Ui, name: Label) -> Self
Typically created via Ui::window
sourcepub fn opened(self, opened: &'a mut bool) -> Self
pub fn opened(self, opened: &'a mut bool) -> Self
Enables the window close button, which sets the passed boolean to false when clicked
sourcepub fn flags(self, flags: WindowFlags) -> Self
pub fn flags(self, flags: WindowFlags) -> Self
Replace current window flags with the given value
sourcepub fn position(
self,
position: impl Into<Vector2<f32>>,
condition: Condition
) -> Self
pub fn position(
self,
position: impl Into<Vector2<f32>>,
condition: Condition
) -> Self
Sets the window position, which is applied based on the given condition value
sourcepub fn position_pivot(self, pivot: impl Into<Vector2<f32>>) -> Self
pub fn position_pivot(self, pivot: impl Into<Vector2<f32>>) -> 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()
.
sourcepub fn size(self, size: impl Into<Vector2<f32>>, condition: Condition) -> Self
pub fn size(self, size: impl Into<Vector2<f32>>, condition: Condition) -> Self
Sets the window size, which is applied based on the given condition value
sourcepub fn size_constraints(
self,
size_min: impl Into<Vector2<f32>>,
size_max: impl Into<Vector2<f32>>
) -> Self
pub fn size_constraints(
self,
size_min: impl Into<Vector2<f32>>,
size_max: impl Into<Vector2<f32>>
) -> Self
Sets window size constraints.
Use -1.0, -1.0 on either X or Y axis to preserve current size.
sourcepub fn content_size(self, size: impl Into<Vector2<f32>>) -> Self
pub fn content_size(self, size: impl Into<Vector2<f32>>) -> 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.
sourcepub fn collapsed(self, collapsed: bool, condition: Condition) -> Self
pub fn collapsed(self, collapsed: bool, condition: Condition) -> Self
Sets the window collapse state, which is applied based on the given condition value
sourcepub fn focused(self, focused: bool) -> Self
pub fn focused(self, focused: bool) -> Self
Sets the window focused state, which can be used to bring the window to front
sourcepub fn bg_alpha(self, bg_alpha: f32) -> Self
pub fn bg_alpha(self, bg_alpha: f32) -> Self
Sets the background color alpha value.
See also draw_background
sourcepub fn title_bar(self, value: bool) -> Self
pub fn title_bar(self, value: bool) -> Self
Enables/disables the title bar.
Enabled by default.
sourcepub fn resizable(self, value: bool) -> Self
pub fn resizable(self, value: bool) -> Self
Enables/disables resizing with the lower-right grip.
Enabled by default.
sourcepub fn movable(self, value: bool) -> Self
pub fn movable(self, value: bool) -> Self
Enables/disables moving the window.
Enabled by default.
sourcepub fn scroll_bar(self, value: bool) -> Self
pub fn scroll_bar(self, value: bool) -> Self
Enables/disables scrollbars (scrolling is still possible with the mouse or programmatically).
Enabled by default.
sourcepub fn scrollable(self, value: bool) -> Self
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.
sourcepub fn collapsible(self, value: bool) -> Self
pub fn collapsible(self, value: bool) -> Self
Enables/disables collapsing the window by double-clicking it.
Enabled by default.
sourcepub fn always_auto_resize(self, value: bool) -> Self
pub fn always_auto_resize(self, value: bool) -> Self
Enables/disables resizing the window to its content on every frame.
Disabled by default.
sourcepub fn draw_background(self, value: bool) -> Self
pub fn draw_background(self, value: bool) -> Self
Enables/disables drawing of background color and outside border.
Enabled by default.
sourcepub fn save_settings(self, value: bool) -> Self
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.
sourcepub fn mouse_inputs(self, value: bool) -> Self
pub fn mouse_inputs(self, value: bool) -> Self
Enables/disables catching mouse input.
Enabled by default. Note: Hovering test will pass through when disabled
Enables/disables the menu bar.
Disabled by default.
sourcepub fn horizontal_scrollbar(self, value: bool) -> Self
pub fn horizontal_scrollbar(self, value: bool) -> Self
Enables/disables the horizontal scrollbar.
Disabled by default.
sourcepub fn focus_on_appearing(self, value: bool) -> Self
pub fn focus_on_appearing(self, value: bool) -> Self
Enables/disables taking focus when transitioning from hidden to visible state.
Enabled by default.
sourcepub fn bring_to_front_on_focus(self, value: bool) -> Self
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.
sourcepub fn always_vertical_scrollbar(self, value: bool) -> Self
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.
sourcepub fn always_horizontal_scrollbar(self, value: bool) -> Self
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.
sourcepub fn always_use_window_padding(self, value: bool) -> Self
pub fn always_use_window_padding(self, value: bool) -> Self
When enabled, ensures child windows without border use style.window_padding
.
Disabled by default.
Enables/disables gamepad/keyboard navigation within the window.
Enabled by default.
Enables/disables focusing toward this window with gamepad/keyboard navigation (e.g. CTRL+TAB).
Enabled by default.
sourcepub fn unsaved_document(self, value: bool) -> Self
pub fn unsaved_document(self, value: bool) -> Self
When enabled, appends ‘*’ to title without affecting the ID, as a convenience.
Disabled by default.
Disable gamepad/keyboard navigation and focusing.
Shorthand for
.nav_inputs(false)
.nav_focus(false)
sourcepub fn no_decoration(self) -> Self
pub fn no_decoration(self) -> Self
Disable all window decorations.
Shorthand for
.title_bar(false)
.resizable(false)
.scroll_bar(false)
.collapsible(false)
sourcepub fn no_inputs(self) -> Self
pub fn no_inputs(self) -> Self
Don’t handle input.
Shorthand for
.mouse_inputs(false)
.nav_inputs(false)
.nav_focus(false)
sourcepub fn begin(self) -> Option<WindowToken<'ui>>
pub fn begin(self) -> 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.