Window

Struct Window 

Source
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

Source

pub fn position(&self, position: impl IntoVar<Point>)

P Binds the position window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

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

Source

pub fn size(&self, size: impl IntoVar<Size>)

P Binds the size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn min_size(&self, min_size: impl IntoVar<Size>)

P Binds the min_size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn max_size(&self, max_size: impl IntoVar<Size>)

P Binds the max_size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn font_size(&self, font_size: impl IntoVar<Length>)

P Binds the font_size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn chrome(&self, chrome: impl IntoVar<bool>)

P Binds the chrome window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

pub fn title(&self, title: impl IntoVar<Txt>)

P Binds the title window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn auto_size(&self, auto_size: impl IntoVar<AutoSize>)

P Binds the auto_size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

pub fn resizable(&self, resizable: impl IntoVar<bool>)

P Binds the resizable window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn movable(&self, movable: impl IntoVar<bool>)

P Binds the movable window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

pub fn visible(&self, visible: impl IntoVar<bool>)

P Binds the visible window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

pub fn parent(&self, parent: impl IntoVar<Option<WindowId>>)

P Binds the parent window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn modal(&self, modal: impl IntoVar<bool>)

P Binds the modal window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

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

Source

pub fn enabled_buttons(&self, enabled_buttons: impl IntoVar<WindowButton>)

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

Source

pub fn parallel(&self, parallel: impl IntoVar<Parallel>)

P Binds the parallel window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

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

Source

pub fn x(&self, x: impl IntoVar<Length>)

P Binds the x of the position window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn y(&self, y: impl IntoVar<Length>)

P Binds the y of the position window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn width(&self, width: impl IntoVar<Length>)

P Binds the width of the size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn height(&self, height: impl IntoVar<Length>)

P Binds the height of the size window var with the property value.

The binding is bidirectional and the window variable is assigned on init.

Source§

impl Window

Source

pub fn min_width(&self, min_width: impl IntoVar<Length>)

P Binds the width 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

Source

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

Source

pub fn max_width(&self, max_width: impl IntoVar<Length>)

P Binds the width 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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn widget_new() -> Window

Start building a new instance.

Source

pub fn widget_type() -> WidgetType

Gets the widget type info.

Source§

impl Window

Source

pub fn style_fn(&self, style_fn: impl IntoVar<StyleFn>)

P Extends or replaces the widget style.

Properties and when conditions in the style are applied to the widget. Style instances extend the contextual style by default, you can set replace on a style to true to fully replace.

Source§

impl Window

Source

pub fn widget_build(&mut self) -> WindowRoot

Build a WindowRoot.

Source§

impl Window

Source

pub fn safe_padding(&self, padding: impl IntoVar<SideOffsets>)

P Padding required to avoid physical screen obstructions.

By default this is WINDOW.vars().safe_padding() that is defined by the operating system. You can unset this property to implement your own unsafe area handling.

Source§

impl Window

Source

pub fn start_position(&self, position: impl IntoValue<StartPosition>)

B Defines how the window is positioned when it first opens.

Source§

impl Window

Source

pub fn start_focused(&self, enabled: impl IntoValue<bool>)

B If the window 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

Source

pub fn kiosk(&self, kiosk: impl IntoValue<bool>)

B 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

Source

pub fn allow_transparency(&self, allow: impl IntoValue<bool>)

B 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

Source

pub fn render_mode(&self, mode: impl IntoValue<Option<RenderMode>>)

B 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

Source

pub fn on_open( &self, handler: Box<dyn FnMut(&WindowOpenArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_load( &self, handler: Box<dyn FnMut(&WindowOpenArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_close_requested( &self, handler: Box<dyn FnMut(&WindowCloseRequestedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_close( &self, handler: Box<dyn FnMut(&WindowCloseArgs) -> HandlerResult + Send>, )

P On window close.

The window will deinit after this event.

This property is the same as on_pre_window_close.

Source§

impl Window

Source

pub fn on_moved( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_resized( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_state_changed( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_maximized( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_unmaximized( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_minimized( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_unminimized( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_restored( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_fullscreen( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_exited_fullscreen( &self, handler: Box<dyn FnMut(&WindowChangedArgs) -> HandlerResult + Send>, )

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

Source

pub fn on_frame_image_ready( &self, handler: Box<dyn FnMut(&FrameImageReadyArgs) -> HandlerResult + Send>, )

P On window frame rendered.

If frame_capture_mode is set the image will be available in the event args.

Source§

impl Window

Source

pub fn headless_monitor(&self, monitor: impl IntoValue<HeadlessMonitor>)

B Imaginary monitor used by the window when it runs in headless mode.

Methods from Deref<Target = StyleMix<Container>>§

Source

pub fn style_intrinsic( &mut self, style_var: ContextVar<StyleFn>, style_fn: PropertyId, )

Setup the style build.

Trait Implementations§

Source§

impl Deref for Window

Source§

type Target = StyleMix<Container>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Window as Deref>::Target

Dereferences the value.
Source§

impl DerefMut for Window

Source§

fn deref_mut(&mut self) -> &mut <Window as Deref>::Target

Mutably dereferences the value.

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> 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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
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