pub struct WindowOptions {Show 19 fields
pub title: String,
pub size: Size,
pub min_size: Option<Size>,
pub start_hidden: bool,
pub size_to_fit: bool,
pub app_name: Option<String>,
pub locales: Option<AppLocales>,
pub title_fn: Option<fn() -> String>,
pub version: Option<String>,
pub tabbing: WindowTabbing,
pub chrome: WindowChrome,
pub background: WindowBackground,
pub shadow: bool,
pub resizable: bool,
pub placement: WindowPlacement,
pub max_size: Option<Size>,
pub remember_frame: Option<String>,
pub key: Option<String>,
pub kind: WindowKind,
}Fields§
§title: String§size: Size§min_size: Option<Size>Create and mount the window without showing it or activating the app. Supported on AppKit; other backends currently ignore this option. Defaults to false.
Menu-bar apps can keep their initial host hidden and open Preferences on demand.
The window still exists and can be shown with WindowHandle::set_visible(true);
this does not change the app’s keep-running policy.
size_to_fit: boolAsk the backend to size this window to its content once it has been built and laid out,
rather than keeping Self::size (docs/windows.md). size still decides the width and
acts as the height ceiling, so a panel with more content than fits the screen scrolls
instead of growing past it.
What a preferences panel wants on every desktop. Ignored by backends that cannot resize a live window, and by the ones with no windows at all.
app_name: Option<String>The app’s display name for the standard application menu / About (macOS). None falls back
to title; set it when title carries extra decoration you don’t want in About <name>
(e.g. the showcase’s window title is “Day Showcase (AppKit)” but its app name is “Showcase”).
locales: Option<AppLocales>The app’s locale catalog, installed by day::launch (docs/localization.md).
The order is why this is the framework’s job: the OS’s languages reach day-l10n from the
live backend, and the catalog has to be registered after that hint and before the first
localized string is read. An app that installs it itself (before launch, where there
is no backend yet) registers against an empty hint list and resolves to DEFAULT, so a
French device opens an English window.
title_fn: Option<fn() -> String>The title, computed once the catalog above is installed: how a window title comes from
the catalog rather than a literal. Takes precedence over Self::title, which stays the
fallback for the moment before (and for apps with nothing to translate).
A plain fn rather than a closure: this struct is Clone, and the callers are a
non-capturing || res::str::app_title().format(), which coerces.
version: Option<String>The app’s version, for Day’s exit line (Clean exit for <app> v<version> …,
docs/lifecycle.md): env!("CARGO_PKG_VERSION") in the app crate, which the scaffold’s
window() sets. None falls back to the DAY_APP_VERSION the day CLI sets on a launch.
tabbing: WindowTabbingmacOS window tabbing for this window (Cap::WindowTabbing); ignored elsewhere.
chrome: WindowChromeThe window’s frame: standard, a title bar the content runs under, or none (docs/window-chrome.md). Desktop only; phones and the web ignore it.
background: WindowBackgroundWhat shows behind the content: the window background, nothing, or a system material.
shadow: boolWhether the window casts the platform’s drop shadow. A transparent, shaped window often wants none.
resizable: boolWhether the user can resize the window by its edges.
placement: WindowPlacementWhere the window opens.
max_size: Option<Size>The largest content size the user can resize the window to (Cap::WindowGeometry).
remember_frame: Option<String>Remember this window’s size, position and maximized state under this key, and reopen it that way next launch (docs/windows.md “Remembered frames”). A position that no attached display shows any more is dropped, so a window never reopens off-screen.
key: Option<String>The logical window this opens (docs/windows.md): open_window focuses an already-open
window with the same key instead of opening a second (the preferences pattern). None
always opens a new one.
kind: WindowKindThe kind of window: a regular one, a preferences panel, an About panel.
Implementations§
Source§impl WindowOptions
impl WindowOptions
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
The window title. Replaces a title_fn set earlier (the generated
res::window_options() sets one), so the last title named wins.
Sourcepub fn size(self, width: f64, height: f64) -> Self
pub fn size(self, width: f64, height: f64) -> Self
The content size the window opens at (desktop; phones fill the screen).
Sourcepub fn min_size(self, width: f64, height: f64) -> Self
pub fn min_size(self, width: f64, height: f64) -> Self
The smallest content size the user can resize to.
Sourcepub fn max_size(self, width: f64, height: f64) -> Self
pub fn max_size(self, width: f64, height: f64) -> Self
The largest content size the user can resize to (Cap::WindowGeometry).
Create and mount the window without showing it; see Self::start_hidden.
Sourcepub fn size_to_fit(self) -> Self
pub fn size_to_fit(self) -> Self
Size the window to its content once built; see Self::size_to_fit.
Sourcepub fn app_name(self, name: impl Into<String>) -> Self
pub fn app_name(self, name: impl Into<String>) -> Self
The app’s display name for the application menu and About; see Self::app_name.
Sourcepub fn locales(
self,
default: &'static str,
catalog: &'static [(&'static str, &'static str)],
) -> Self
pub fn locales( self, default: &'static str, catalog: &'static [(&'static str, &'static str)], ) -> Self
The app’s locale catalog, as res::locales::{DEFAULT, CATALOG}; see Self::locales.
Sourcepub fn title_fn(self, f: fn() -> String) -> Self
pub fn title_fn(self, f: fn() -> String) -> Self
The title, computed once the catalog is installed; see Self::title_fn.
Sourcepub fn version(self, version: impl Into<String>) -> Self
pub fn version(self, version: impl Into<String>) -> Self
The app’s version, for Day’s exit line; see Self::version.
Sourcepub fn tabbing(self, tabbing: WindowTabbing) -> Self
pub fn tabbing(self, tabbing: WindowTabbing) -> Self
macOS window tabbing for this window; see Self::tabbing.
Sourcepub fn chrome(self, chrome: WindowChrome) -> Self
pub fn chrome(self, chrome: WindowChrome) -> Self
The window’s frame; see Self::chrome.
Sourcepub fn background(self, background: WindowBackground) -> Self
pub fn background(self, background: WindowBackground) -> Self
What shows behind the content; see Self::background.
Sourcepub fn no_shadow(self) -> Self
pub fn no_shadow(self) -> Self
No drop shadow, for a transparent or shaped window; see Self::shadow.
Sourcepub fn fixed_size(self) -> Self
pub fn fixed_size(self) -> Self
A window the user cannot resize; see Self::resizable.
Sourcepub fn placement(self, placement: WindowPlacement) -> Self
pub fn placement(self, placement: WindowPlacement) -> Self
Where the window opens; see Self::placement.
Sourcepub fn remember_frame(self, key: impl Into<String>) -> Self
pub fn remember_frame(self, key: impl Into<String>) -> Self
Remember and restore this window’s frame under key; see Self::remember_frame.
Sourcepub fn kind(self, kind: WindowKind) -> Self
pub fn kind(self, kind: WindowKind) -> Self
The kind of window; see Self::kind.
Trait Implementations§
Source§impl Clone for WindowOptions
impl Clone for WindowOptions
Source§fn clone(&self) -> WindowOptions
fn clone(&self) -> WindowOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more