FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Window

    struct · ferroui-controls · v0.5.0

    struct Window
    

    A top-level window.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<Window>
    

    Returns a strong reference to this object.

    Source

    handle_closing

    fn handle_closing(self: &Self, reason: WindowCloseReason) -> bool
    

    Handles a closing notification from the platform implementation. Returns true if closing is cancelled, otherwise false. reason is the reason the window is closing.

    Source

    on_closing

    fn on_closing(self: &Self, e: &WindowClosingEventArgs)
    

    Raises the Closing event.

    A type that derives from Window may override this member. The override must call the base implementation if the Closing event needs to be raised.

    Source

    size_to_content_property

    fn size_to_content_property() -> &'static StyledProperty<SizeToContent>
    

    Defines the SizeToContent property.

    Source

    extend_client_area_to_decorations_hint_property

    fn extend_client_area_to_decorations_hint_property() -> &'static StyledProperty<bool>
    

    Defines the ExtendClientAreaToDecorationsHint property.

    Source

    extend_client_area_title_bar_height_hint_property

    fn extend_client_area_title_bar_height_hint_property() -> &'static StyledProperty<f64>
    

    Defines the ExtendClientAreaTitleBarHeightHint property.

    Source

    is_extended_into_window_decorations_property

    fn is_extended_into_window_decorations_property() -> &'static DirectProperty<Window, bool>
    

    Defines the IsExtendedIntoWindowDecorations property.

    Source

    window_decoration_margin_property

    fn window_decoration_margin_property() -> &'static DirectProperty<Window, Thickness>
    

    Defines the WindowDecorationMargin property.

    Source

    off_screen_margin_property

    fn off_screen_margin_property() -> &'static DirectProperty<Window, Thickness>
    

    Defines the OffScreenMargin property.

    Source

    window_decorations_property

    fn window_decorations_property() -> &'static StyledProperty<WindowDecorations>
    

    Defines the WindowDecorations property.

    Source

    window_decorations_theme_property

    fn window_decorations_theme_property() -> &'static StyledProperty<Option<Ref<ControlTheme>>>
    

    Defines the WindowDecorationsTheme property.

    Source

    show_activated_property

    fn show_activated_property() -> &'static StyledProperty<bool>
    

    Defines the ShowActivated property.

    Source

    show_in_taskbar_property

    fn show_in_taskbar_property() -> &'static StyledProperty<bool>
    

    Enables or disables the taskbar icon.

    Source

    closing_behavior_property

    fn closing_behavior_property() -> &'static StyledProperty<WindowClosingBehavior>
    

    Defines the ClosingBehavior property.

    Source

    window_state_property

    fn window_state_property() -> &'static DirectProperty<Window, WindowState>
    

    Represents the currently effective window state (normal, minimized, maximized).

    Source

    title_property

    fn title_property() -> &'static StyledProperty<Option<String>>
    

    Defines the Title property.

    Source

    icon_property

    fn icon_property() -> &'static StyledProperty<Option<Rc<WindowIcon>>>
    

    Defines the Icon property.

    Source

    window_startup_location_property

    fn window_startup_location_property() -> &'static StyledProperty<WindowStartupLocation>
    

    Defines the WindowStartupLocation property.

    Source

    can_resize_property

    fn can_resize_property() -> &'static StyledProperty<bool>
    

    Defines the CanResize property.

    Source

    can_minimize_property

    fn can_minimize_property() -> &'static StyledProperty<bool>
    

    Defines the CanMinimize property.

    Source

    can_maximize_property

    fn can_maximize_property() -> &'static StyledProperty<bool>
    

    Defines the CanMaximize property.

    Source

    window_closed_event

    fn window_closed_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Routed event that can be used for global tracking of window destruction.

    Source

    window_opened_event

    fn window_opened_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Routed event that can be used for global tracking of opening windows.

    Source

    new

    fn new() -> Ref<Self>
    

    Creates a window over a window of the windowing platform.

    Panics

    Panics when no windowing platform is registered.

    Source

    owned_windows

    fn owned_windows(self: &Self) -> Vec<Ref<Window>>
    

    The child windows owned by this window.

    Source

    size_to_content

    fn size_to_content(self: &Self) -> SizeToContent
    

    A value indicating how the window will size itself to fit its content.

    If the value is other than SizeToContent::MANUAL, it is automatically set to SizeToContent::MANUAL if a user resizes the window by using the resize grip or dragging the border.

    NOTE: Because of a limitation of X11, the value will be reset on X11 to SizeToContent::MANUAL on any resize - including the resize that happens when the window is first shown. This is because X11 resize notifications are asynchronous and there is no way to know whether a resize came from the user or the layout system. To avoid this, consider setting CanResize to false, which will disable user resizing of the window.

    Source

    set_size_to_content

    fn set_size_to_content(self: &Self, value: SizeToContent)
    

    Source

    title

    fn title(self: &Self) -> Option<String>
    

    The title of the window.

    Source

    set_title

    fn set_title(self: &Self, value: Option<String>)
    

    Source

    extend_client_area_to_decorations_hint

    fn extend_client_area_to_decorations_hint(self: &Self) -> bool
    

    Whether the client area is extended into the window decorations (chrome or border).

    Source

    set_extend_client_area_to_decorations_hint

    fn set_extend_client_area_to_decorations_hint(self: &Self, value: bool)
    

    Source

    extend_client_area_title_bar_height_hint

    fn extend_client_area_title_bar_height_hint(self: &Self) -> f64
    

    The title bar height hint for when the client area is extended. A value of -1 will cause the title bar to be auto sized to the OS default. Any other positive value will cause the title bar to assume that height.

    Source

    set_extend_client_area_title_bar_height_hint

    fn set_extend_client_area_title_bar_height_hint(self: &Self, value: f64)
    

    Source

    is_extended_into_window_decorations

    fn is_extended_into_window_decorations(self: &Self) -> bool
    

    Whether the client area is extended into the window decorations.

    Source

    window_decoration_margin

    fn window_decoration_margin(self: &Self) -> Thickness
    

    The thickness around the window that is used by borders and the title bar.

    Source

    caption_button_insets

    fn caption_button_insets(self: &Self) -> Thickness
    

    The room the caption buttons take at the left and the right of the title bar while the client area is extended into the decorations: the traffic lights of macOS at the left, the caption buttons the toolkit draws (Windows, Linux) at the right; zero otherwise. Not in upstream: the insets of WinUI's AppWindowTitleBar (LeftInset, RightInset), which a TitleBar leaves free.

    Source

    off_screen_margin

    fn off_screen_margin(self: &Self) -> Thickness
    

    The window margin that is hidden off the screen area. This is generally only the case on Windows when maximized, where the window border is hidden off the screen. This margin may be used to ensure user content doesn't overlap this space.

    Source

    window_decorations

    fn window_decorations(self: &Self) -> WindowDecorations
    

    The window decorations (title bar, border, etc).

    Source

    set_window_decorations

    fn set_window_decorations(self: &Self, value: WindowDecorations)
    

    Source

    window_decorations_theme

    fn window_decorations_theme(self: &Self) -> Option<Ref<ControlTheme>>
    

    The theme used to render the window decorations when they are not drawn by the system.

    Source

    set_window_decorations_theme

    fn set_window_decorations_theme(self: &Self, value: impl Into<Nullable<ControlTheme>>)
    

    Source

    system_decorations

    fn system_decorations(self: &Self) -> WindowDecorations
    

    Deprecated. Use window_decorations instead.

    Source

    set_system_decorations

    fn set_system_decorations(self: &Self, value: WindowDecorations)
    

    Deprecated. Use set_window_decorations instead.

    Source

    show_activated

    fn show_activated(self: &Self) -> bool
    

    Whether a window is activated when first shown.

    Source

    set_show_activated

    fn set_show_activated(self: &Self, value: bool)
    

    Source

    show_in_taskbar

    fn show_in_taskbar(self: &Self) -> bool
    

    Enables or disables the taskbar icon.

    Source

    set_show_in_taskbar

    fn set_show_in_taskbar(self: &Self, value: bool)
    

    Source

    closing_behavior

    fn closing_behavior(self: &Self) -> WindowClosingBehavior
    

    A value indicating how the closing event behaves in the presence of child windows.

    Source

    set_closing_behavior

    fn set_closing_behavior(self: &Self, value: WindowClosingBehavior)
    

    Source

    window_state

    fn window_state(self: &Self) -> WindowState
    

    Represents the currently effective window state (normal, minimized, maximized).

    Source

    set_window_state

    fn set_window_state(self: &Self, value: WindowState)
    

    Source

    can_resize

    fn can_resize(self: &Self) -> bool
    

    Enables or disables resizing of the window.

    Source

    set_can_resize

    fn set_can_resize(self: &Self, value: bool)
    

    Source

    can_minimize

    fn can_minimize(self: &Self) -> bool
    

    Enables or disables minimizing the window.

    This property might be ignored by some window managers on Linux.

    Source

    set_can_minimize

    fn set_can_minimize(self: &Self, value: bool)
    

    Source

    can_maximize

    fn can_maximize(self: &Self) -> bool
    

    Enables or disables maximizing the window.

    When CanResize is false, this property is always false. On macOS, setting this property to false also disables the full screen mode. This property might be ignored by some window managers on Linux.

    Source

    set_can_maximize

    fn set_can_maximize(self: &Self, value: bool)
    

    Source

    icon

    fn icon(self: &Self) -> Option<Rc<WindowIcon>>
    

    The icon of the window.

    Source

    set_icon

    fn set_icon(self: &Self, value: Option<Rc<WindowIcon>>)
    

    Source

    window_startup_location

    fn window_startup_location(self: &Self) -> WindowStartupLocation
    

    The startup location of the window.

    Source

    set_window_startup_location

    fn set_window_startup_location(self: &Self, value: WindowStartupLocation)
    

    Source

    position

    fn position(self: &Self) -> PixelPoint
    

    The window position in screen coordinates.

    Source

    set_position

    fn set_position(self: &Self, value: PixelPoint)
    

    Source

    is_dialog

    fn is_dialog(self: &Self) -> bool
    

    Whether this window was opened as a dialog.

    Source

    begin_move_drag

    fn begin_move_drag(self: &Self, e: &PointerPressedEventArgs)
    

    Starts moving a window with left button being held. Should be called from a left mouse button press event handler.

    Source

    begin_resize_drag

    fn begin_resize_drag(self: &Self, edge: WindowEdge, e: &PointerPressedEventArgs)
    

    Starts resizing a window. This function is used if an application has window resizing controls. Should be called from a left mouse button press event handler.

    Source

    closing

    fn closing(self: &Self, handler: impl Fn(&WindowClosingEventArgs) -> () + 'static) -> Subscription
    

    Fired before a window is closed.

    Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the window.

    Source

    close

    fn close(self: &Self)
    

    Closes the window.

    Source

    close_with_result

    fn close_with_result(self: &Self, dialog_result: Option<BoxedValue>)
    

    Closes a dialog window with the specified result.

    When the window is shown with show_dialog or show_dialog_typed, the handle of its task gives the dialog_result value when the window is closed.

    Source

    close_core

    fn close_core(self: &Self, reason: WindowCloseReason, is_programmatic: bool, ignore_cancel: bool)
    

    Closes the window for reason; with ignore_cancel the window closes even when a closing handler cancels (internal upstream: for the application lifetime).

    Source

    show_with_owner

    fn show_with_owner(self: &Self, owner: &Window)
    

    Shows the window as a child of owner.

    Panics

    Panics when the window has already been closed, and when the owner is closed, not visible or the window itself.

    Source

    show_dialog

    fn show_dialog(self: &Self, owner: &Window) -> JoinHandle<Option<BoxedValue>>
    

    Shows the window as a dialog owned by owner.

    Returns the handle of a task of the dispatcher that tracks the lifetime of the dialog: it ends, in a dispatcher job, with the dialog result (see close_with_result) once the dialog has closed, or with JoinError::Canceled when the dispatcher shuts down first. Nothing blocks: the caller keeps running, and dropping the handle leaves the dialog open.

    Panics

    Panics when the window has already been closed or is already shown, and when the owner is closed, not visible or the window itself.

    Source

    show_dialog_typed

    fn show_dialog_typed<TResult: Clone + Default + 'static>(self: &Self, owner: &Window) -> JoinHandle<TResult>
    

    Shows the window as a dialog owned by owner; TResult is the type of the result produced by the dialog.

    Returns the handle of a task that gives the result of the dialog when it closes: the value passed to close_with_result, or the default of TResult when the dialog closed without a result. When the dialog result is not a TResult, the task panics, and its handle ends with JoinError::Panicked.

    Panics

    See show_dialog.

    Source

    show_dialog_task

    fn show_dialog_task(self: &Self, owner: &Window) -> DispatcherTask<Option<BoxedValue>>
    

    The deprecated form of show_dialog: a DispatcherTask, which raises a failure again when it is observed.

    Panics

    See show_dialog.

    Deprecated since 0.5.0. use show_dialog, which gives a JoinHandle

    Source

    show_dialog_typed_task

    fn show_dialog_typed_task<TResult: Clone + Default + 'static>(self: &Self, owner: &Window) -> DispatcherTask<TResult>
    

    The deprecated form of show_dialog_typed: a DispatcherTask, which raises the failure to cast the dialog result again when it is observed.

    Panics

    See show_dialog.

    Deprecated since 0.5.0. use show_dialog_typed, which gives a JoinHandle

    Source

    sort_windows_by_z_order

    fn sort_windows_by_z_order(windows: &mut [Ref<Window>])
    

    Sorts the windows ascending by their Z order - the topmost window will be the last in the list.

    Panics

    Panics when one of the windows is closed, and when no windowing platform is registered.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.