pub struct Window(/* private fields */);
Expand description
W
A window container.
The instance type is WindowRoot
, it can be given to the WINDOWS
service
to open a system window that is kept in sync with the window properties set in the widget.
See run_window
for more details.
Implementations§
Source§impl Window
impl Window
Sourcepub fn monitor(&self, monitor: impl IntoVar<MonitorQuery>)
pub fn monitor(&self, monitor: impl IntoVar<MonitorQuery>)
P
Binds the monitor
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn state(&self, state: impl IntoVar<WindowState>)
pub fn state(&self, state: impl IntoVar<WindowState>)
P
Binds the state
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn icon(&self, icon: impl IntoVar<WindowIcon>)
pub fn icon(&self, icon: impl IntoVar<WindowIcon>)
P
Binds the icon
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn auto_size_origin(&self, auto_size_origin: impl IntoVar<Point>)
pub fn auto_size_origin(&self, auto_size_origin: impl IntoVar<Point>)
P
Binds the auto_size_origin
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn always_on_top(&self, always_on_top: impl IntoVar<bool>)
pub fn always_on_top(&self, always_on_top: impl IntoVar<bool>)
P
Binds the always_on_top
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn taskbar_visible(&self, taskbar_visible: impl IntoVar<bool>)
pub fn taskbar_visible(&self, taskbar_visible: impl IntoVar<bool>)
P
Binds the taskbar_visible
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn color_scheme(&self, color_scheme: impl IntoVar<Option<ColorScheme>>)
pub fn color_scheme(&self, color_scheme: impl IntoVar<Option<ColorScheme>>)
P
Binds the color_scheme
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn accent_color(&self, accent_color: impl IntoVar<Option<LightDark>>)
pub fn accent_color(&self, accent_color: impl IntoVar<Option<LightDark>>)
P
Binds the accent_color
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn frame_capture_mode(
&self,
frame_capture_mode: impl IntoVar<FrameCaptureMode>,
)
pub fn frame_capture_mode( &self, frame_capture_mode: impl IntoVar<FrameCaptureMode>, )
P
Binds the frame_capture_mode
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
P
Binds the enabled_buttons
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn min_height(&self, min_height: impl IntoVar<Length>)
pub fn min_height(&self, min_height: impl IntoVar<Length>)
P
Binds the height
of the min_size
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn max_height(&self, max_height: impl IntoVar<Length>)
pub fn max_height(&self, max_height: impl IntoVar<Length>)
P
Binds the height
of the max_size
window var with the property value.
The binding is bidirectional and the window variable is assigned on init.
Source§impl Window
impl Window
Sourcepub fn clear_color(&self, color: impl IntoVar<Rgba>)
pub fn clear_color(&self, color: impl IntoVar<Rgba>)
P
Window clear color.
Color used to clear the previous frame pixels before rendering a new frame. It is visible if window content does not completely fill the content area, this can happen if you do not set a background or the background is semi-transparent, also can happen during very fast resizes.
Source§impl Window
impl Window
Sourcepub fn save_state(&self, enabled: impl IntoValue<SaveState>)
pub fn save_state(&self, enabled: impl IntoValue<SaveState>)
P
Save and restore the window state.
If enabled a config entry is created for the window state in CONFIG
, and if a config backend is set
the window state is persisted on change and restored when the app reopens.
This property is enabled by default in the Window!
widget, without a key. Note that without a config key
the state only actually enables if the window root widget ID or the window ID have a name.
Source§impl Window
impl Window
Sourcepub fn config_block_window_load(&self, enabled: impl IntoValue<BlockWindowLoad>)
pub fn config_block_window_load(&self, enabled: impl IntoValue<BlockWindowLoad>)
P
Block window load until CONFIG.status
is idle.
This property is enabled by default in the Window!
widget.
Source§impl Window
impl Window
Sourcepub fn needs_fallback_chrome(&self, needs: impl IntoVar<bool>)
pub fn needs_fallback_chrome(&self, needs: impl IntoVar<bool>)
P
Gets if is not headless, chrome
is true
, state
is not fullscreen but WINDOWS.system_chrome
reports the system does not provide window decorations.
Source§impl Window
impl Window
Sourcepub fn prefer_custom_chrome(&self, prefer: impl IntoVar<bool>)
pub fn prefer_custom_chrome(&self, prefer: impl IntoVar<bool>)
P
Gets if WINDOWS.system_chrome
prefers custom chrome.
Note that you must set chrome
to false
when using this to provide a custom chrome.
Source§impl Window
impl Window
Sourcepub fn custom_chrome_adorner_fn(
&self,
custom_chrome: impl IntoVar<WidgetFn<()>>,
)
pub fn custom_chrome_adorner_fn( &self, custom_chrome: impl IntoVar<WidgetFn<()>>, )
P
Adorner property specific for custom chrome overlays.
This property behaves exactly like adorner_fn
. Using it instead of adorner frees the adorner property
for other usage in the window instance or in derived window types.
Note that you can also set the custom_chrome_padding_fn
to ensure that the content is not hidden behind the adorner.
Source§impl Window
impl Window
Sourcepub fn custom_chrome_padding_fn(&self, padding: impl IntoVar<SideOffsets>)
pub fn custom_chrome_padding_fn(&self, padding: impl IntoVar<SideOffsets>)
P
Extra padding for window content in windows that display a custom_chrome_adorner_fn
.
Source§impl Window
impl Window
Sourcepub fn widget_new() -> Self
pub fn widget_new() -> Self
Start building a new instance.
Sourcepub fn widget_type() -> WidgetType
pub fn widget_type() -> WidgetType
Gets the widget type info.
Source§impl Window
impl Window
Sourcepub fn widget_build(&mut self) -> WindowRoot
pub fn widget_build(&mut self) -> WindowRoot
Build a WindowRoot
.
Source§impl Window
impl Window
Sourcepub fn start_position(&self, position: impl IntoValue<StartPosition>)
pub fn start_position(&self, position: impl IntoValue<StartPosition>)
c
Defines how the window is positioned when it first opens.
Source§impl Window
impl Window
Sourcepub fn start_focused(&self, enabled: impl IntoValue<bool>)
pub fn start_focused(&self, enabled: impl IntoValue<bool>)
c
If the window is steals keyboard focus on open.
By default the operating system decides if the window will receive focus after opening, usually it is focused only if the process that started the window already has focus. Enabling this ensures that focus is moved to the new window, potentially stealing the focus from other apps and disrupting the user.
Source§impl Window
impl Window
Sourcepub fn kiosk(&self, kiosk: impl IntoValue<bool>)
pub fn kiosk(&self, kiosk: impl IntoValue<bool>)
c
Lock-in kiosk mode.
In kiosk mode the only window states allowed are fullscreen or fullscreen exclusive, and all subsequent windows opened are child of the kiosk window.
Note that this does not configure the operating system, you still need to setup a kiosk environment. This just stops the app itself from accidentally exiting fullscreen.
Source§impl Window
impl Window
Sourcepub fn allow_transparency(&self, allow: impl IntoValue<bool>)
pub fn allow_transparency(&self, allow: impl IntoValue<bool>)
c
If semi-transparent content is see-through, mixing with the operating system pixels behind the window.
Note that to actually see behind the window you must set the clear_color
and background_color
to a transparent color.
The composition is a simple alpha blend, effects like blur do not apply to the pixels behind the window.
Source§impl Window
impl Window
Sourcepub fn render_mode(&self, mode: impl IntoValue<Option<RenderMode>>)
pub fn render_mode(&self, mode: impl IntoValue<Option<RenderMode>>)
c
Render performance mode overwrite for this window, if set to None
the WINDOWS.default_render_mode
is used.
The view-process
will try to match the mode, if it is not available a fallback mode is selected,
see RenderMode
for more details about each mode and fallbacks.
Source§impl Window
impl Window
Sourcepub fn on_open(&self, handler: impl WidgetHandler<WindowOpenArgs>)
pub fn on_open(&self, handler: impl WidgetHandler<WindowOpenArgs>)
P
Event just after the window opens.
This event notifies once per window, after the window content is inited.
This property is the same as on_pre_window_open
.
Source§impl Window
impl Window
Sourcepub fn on_load(&self, handler: impl WidgetHandler<WindowOpenArgs>)
pub fn on_load(&self, handler: impl WidgetHandler<WindowOpenArgs>)
P
Event just after the window loads.
This event notifies once per window, after the first layout and all WindowLoadingHandle
have expired or dropped.
This property is the same as on_pre_window_load
.
Source§impl Window
impl Window
Sourcepub fn on_close_requested(
&self,
handler: impl WidgetHandler<WindowCloseRequestedArgs>,
)
pub fn on_close_requested( &self, handler: impl WidgetHandler<WindowCloseRequestedArgs>, )
P
On window close requested.
This event notifies every time an attempt to close the window is made. Close can be cancelled by stopping propagation on the event args, the window only closes after all handlers receive this event and propagation is not stopped.
This property is the same as on_window_close_requested
.
Source§impl Window
impl Window
Sourcepub fn on_close(&self, handler: impl WidgetHandler<WindowCloseArgs>)
pub fn on_close(&self, handler: impl WidgetHandler<WindowCloseArgs>)
P
On window close.
The window will deinit after this event.
This property is the same as on_pre_window_close
.
Source§impl Window
impl Window
Sourcepub fn on_moved(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_moved(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window position changed.
This event notifies every time the window position changes. You can also track the window
position using the actual_position
variable.
This property is the same as on_pre_window_moved
.
Source§impl Window
impl Window
Sourcepub fn on_resized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_resized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window size changed.
This event notifies every time the window content area size changes. You can also track
the window size using the actual_size
variable.
This property is the same as on_pre_window_resized
.
Source§impl Window
impl Window
Sourcepub fn on_state_changed(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_state_changed(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window state changed.
This event notifies every time the window state changes.
Note that you can also track the window
state by setting state
to a read-write variable.
This property is the same as on_pre_window_state_changed
.
Source§impl Window
impl Window
Sourcepub fn on_maximized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_maximized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window maximized.
This event notifies every time the window state changes to maximized.
This property is the same as on_pre_window_maximized
.
Source§impl Window
impl Window
Sourcepub fn on_unmaximized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_unmaximized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window exited the maximized state.
This event notifies every time the window state changes to a different state from maximized.
This property is the same as on_pre_window_unmaximized
.
Source§impl Window
impl Window
Sourcepub fn on_minimized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_minimized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window minimized.
This event notifies every time the window state changes to minimized.
This property is the same as on_pre_window_maximized
.
Source§impl Window
impl Window
Sourcepub fn on_unminimized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_unminimized(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window exited the minimized state.
This event notifies every time the window state changes to a different state from minimized.
This property is the same as on_pre_window_unminimized
.
Source§impl Window
impl Window
Sourcepub fn on_restored(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_restored(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window state changed to Normal
.
This event notifies every time the window state changes to Normal
.
This property is the same as on_pre_window_restored
.
Source§impl Window
impl Window
Sourcepub fn on_fullscreen(&self, handler: impl WidgetHandler<WindowChangedArgs>)
pub fn on_fullscreen(&self, handler: impl WidgetHandler<WindowChangedArgs>)
P
On window enter one of the fullscreen states.
This event notifies every time the window state changes to Fullscreen
or Exclusive
.
This property is the same as on_pre_window_fullscreen
.
Source§impl Window
impl Window
Sourcepub fn on_exited_fullscreen(
&self,
handler: impl WidgetHandler<WindowChangedArgs>,
)
pub fn on_exited_fullscreen( &self, handler: impl WidgetHandler<WindowChangedArgs>, )
P
On window is no longer fullscreen.
This event notifies every time the window state changes to one that is not fullscreen.
This property is the same as on_pre_window_exited_fullscreen
.
Source§impl Window
impl Window
Sourcepub fn on_frame_image_ready(
&self,
handler: impl WidgetHandler<FrameImageReadyArgs>,
)
pub fn on_frame_image_ready( &self, handler: impl WidgetHandler<FrameImageReadyArgs>, )
P
On window frame rendered.
If frame_capture_mode
is set the image will be available in the event args.
Source§impl Window
impl Window
Sourcepub fn headless_monitor(&self, monitor: impl IntoValue<HeadlessMonitor>)
pub fn headless_monitor(&self, monitor: impl IntoValue<HeadlessMonitor>)
c
Imaginary monitor used by the window when it runs in headless mode.
Methods from Deref<Target = Container>§
Sourcepub fn clip_to_bounds(&self, clip: impl IntoVar<bool>)
pub fn clip_to_bounds(&self, clip: impl IntoVar<bool>)
P
Content overflow clipping.
Sourcepub fn child(&self, child: impl UiNode)
pub fn child(&self, child: impl UiNode)
P
The widget’s child.
Can be any type that implements UiNode
, any widget.
In Container!
derived widgets or similar this property is captured and used as the actual child, in other widgets
this property is an alias for child_under
.
Sourcepub fn padding(&self, padding: impl IntoVar<SideOffsets>)
pub fn padding(&self, padding: impl IntoVar<SideOffsets>)
P
Margin space around the content of a widget.
This property is margin
with nest group CHILD_LAYOUT
.
Sourcepub fn child_align(&self, alignment: impl IntoVar<Align>)
pub fn child_align(&self, alignment: impl IntoVar<Align>)
P
Aligns the widget content within the available space.
This property is align
with nest group CHILD_LAYOUT
.
Sourcepub fn child_insert(
&self,
placement: impl IntoVar<ChildInsert>,
node: impl UiNode,
spacing: impl IntoVar<Length>,
)
pub fn child_insert( &self, placement: impl IntoVar<ChildInsert>, node: impl UiNode, spacing: impl IntoVar<Length>, )
P
Insert node
in the placement
relative to the widget’s child.
This property disables inline layout for the widget.
Sourcepub fn child_out_insert(
&self,
placement: impl IntoVar<ChildInsert>,
node: impl UiNode,
spacing: impl IntoVar<Length>,
)
pub fn child_out_insert( &self, placement: impl IntoVar<ChildInsert>, node: impl UiNode, spacing: impl IntoVar<Length>, )
P
Insert node
in the placement
relative to the widget’s child, outside of the child layout.
This is still inside the parent widget, but outside of properties like padding.
This property disables inline layout for the widget.
Sourcepub fn child_left(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_left(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the left of the widget’s child.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_right(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_right(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the right of the widget’s child.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_top(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_top(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
above the widget’s child.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_bottom(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_bottom(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
below the widget’s child.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_start(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_start(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the left of the widget’s child in LTR contexts or to the right in RTL contexts.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_end(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_end(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the right of the widget’s child in LTR contexts or to the right of the widget’s child in RTL contexts.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_over(&self, node: impl UiNode)
pub fn child_over(&self, node: impl UiNode)
P
Insert node
over the widget’s child.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_under(&self, node: impl UiNode)
pub fn child_under(&self, node: impl UiNode)
P
Insert node
under the widget’s child.
This property disables inline layout for the widget. See child_insert
for more details.
Sourcepub fn child_out_left(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_out_left(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the left of the widget’s child, outside of the child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_right(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_out_right(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the right of the widget’s child, outside of the child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_top(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_out_top(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
above the widget’s child, outside of the child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_bottom(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_out_bottom(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
below the widget’s child, outside of the child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_start(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_out_start(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the left of the widget’s child in LTR contexts or to the right in RTL contexts, outside of the child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_end(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
pub fn child_out_end(&self, node: impl UiNode, spacing: impl IntoVar<Length>)
P
Insert node
to the right of the widget’s child in LTR contexts or to the right of the widget’s child in RTL contexts, outside of the child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_over(&self, node: impl UiNode)
pub fn child_out_over(&self, node: impl UiNode)
P
Insert node
over the widget’s child, not affected by child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Sourcepub fn child_out_under(&self, node: impl UiNode)
pub fn child_out_under(&self, node: impl UiNode)
P
Insert node
under the widget’s child, not affected by child layout.
This property disables inline layout for the widget. See child_out_insert
for more details.
Methods from Deref<Target = WidgetBase>§
Sourcepub fn widget_builder(&mut self) -> &mut WidgetBuilder
pub fn widget_builder(&mut self) -> &mut WidgetBuilder
Returns a mutable reference to the widget builder.
Sourcepub fn widget_when(&mut self) -> Option<&mut WhenInfo>
pub fn widget_when(&mut self) -> Option<&mut WhenInfo>
Returns a mutable reference to the when
block if called inside a when block.
Sourcepub fn widget_take(&mut self) -> WidgetBuilder
pub fn widget_take(&mut self) -> WidgetBuilder
Takes the widget builder, finishing the widget macro build.
After this call trying to set a property using self
will panic,
the returned builder can still be manipulated directly.
Sourcepub fn widget_build(&mut self) -> impl UiNode
pub fn widget_build(&mut self) -> impl UiNode
Build the widget.
After this call trying to set a property will panic.
Sourcepub fn widget_importance(&mut self) -> &mut Importance
pub fn widget_importance(&mut self) -> &mut Importance
Returns a mutable reference to the importance of the next property assigns, unsets or when blocks.
Note that during the widget_intrinsic
call this is Importance::WIDGET
and after it is Importance::INSTANCE
.
Sourcepub fn start_when_block(
&mut self,
inputs: Box<[WhenInput]>,
state: Box<dyn VarBoxed<bool>>,
expr: &'static str,
location: SourceLocation,
)
pub fn start_when_block( &mut self, inputs: Box<[WhenInput]>, state: Box<dyn VarBoxed<bool>>, expr: &'static str, location: SourceLocation, )
Start building a when
block, all properties set after this call are pushed in the when block.
Sourcepub fn end_when_block(&mut self)
pub fn end_when_block(&mut self)
End the current when
block, all properties set after this call are pushed in the widget.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Window
impl !RefUnwindSafe for Window
impl Send for Window
impl !Sync for Window
impl Unpin for Window
impl !UnwindSafe for Window
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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