Struct titanium::desktop::gui::libdruid::WindowDesc
pub struct WindowDesc<T> {
pub id: WindowId,
/* private fields */
}
Expand description
A description of a window to be instantiated.
This struct has builder methods to specify some window properties. Each of
these methods usually corresponds to a platform API call when constructing the
function. Except for title()
, they have no default values and the APIS
won’t be called if the method is not used.
Fields§
§id: WindowId
The WindowId
that will be assigned to this window.
This can be used to track a window from when it is launched and when it actually connects.
Implementations§
§impl<T> WindowDesc<T>where
T: Data,
impl<T> WindowDesc<T>where T: Data,
pub fn new<W>(root: W) -> WindowDesc<T>where
W: Widget<T> + 'static,
pub fn new<W>(root: W) -> WindowDesc<T>where W: Widget<T> + 'static,
Create a new WindowDesc
, taking the root Widget
for this window.
pub fn title(self, title: impl Into<LabelText<T>>) -> WindowDesc<T>
pub fn title(self, title: impl Into<LabelText<T>>) -> WindowDesc<T>
Set the title for this window. This is a LabelText
; it can be either
a String
, a LocalizedString
, or a closure that computes a string;
it will be kept up to date as the application’s state changes.
If this method isn’t called, the default title will be LocalizedString::new("app-name")
.
Set the menu for this window.
menu
is a callback for creating the menu. Its first argument is the id of the window that
will have the menu, or None
if it’s creating the root application menu for an app with no
menus (which can happen, for example, on macOS).
pub fn window_size_policy(self, size_policy: WindowSizePolicy) -> WindowDesc<T>
pub fn window_size_policy(self, size_policy: WindowSizePolicy) -> WindowDesc<T>
Set the window size policy
pub fn window_size(self, size: impl Into<Size>) -> WindowDesc<T>
pub fn window_size(self, size: impl Into<Size>) -> WindowDesc<T>
Set the window’s initial drawing area size in display points.
You can pass in a tuple (width, height)
or a Size
,
e.g. to create a window with a drawing area 1000dp wide and 500dp high:
window.window_size((1000.0, 500.0));
The actual window size in pixels will depend on the platform DPI settings.
This should be considered a request to the platform to set the size of the window. The platform might increase the size a tiny bit due to DPI.
pub fn with_min_size(self, size: impl Into<Size>) -> WindowDesc<T>
pub fn with_min_size(self, size: impl Into<Size>) -> WindowDesc<T>
Set the window’s minimum drawing area size in display points.
The actual minimum window size in pixels will depend on the platform DPI settings.
This should be considered a request to the platform to set the minimum size of the window. The platform might increase the size a tiny bit due to DPI.
To set the window’s initial drawing area size use window_size
.
pub fn resizable(self, resizable: bool) -> WindowDesc<T>
pub fn resizable(self, resizable: bool) -> WindowDesc<T>
Builder-style method to set whether this window can be resized.
pub fn show_titlebar(self, show_titlebar: bool) -> WindowDesc<T>
pub fn show_titlebar(self, show_titlebar: bool) -> WindowDesc<T>
Builder-style method to set whether this window’s titlebar is visible.
pub fn transparent(self, transparent: bool) -> WindowDesc<T>
pub fn transparent(self, transparent: bool) -> WindowDesc<T>
Builder-style method to set whether this window’s background should be transparent.
pub fn set_position(self, position: impl Into<Point>) -> WindowDesc<T>
pub fn set_position(self, position: impl Into<Point>) -> WindowDesc<T>
Sets the initial window position in display points, relative to the origin of the virtual screen.
pub fn set_level(self, level: WindowLevel) -> WindowDesc<T>
pub fn set_level(self, level: WindowLevel) -> WindowDesc<T>
Sets the WindowLevel
of the window
pub fn set_always_on_top(self, always_on_top: bool) -> WindowDesc<T>
pub fn set_always_on_top(self, always_on_top: bool) -> WindowDesc<T>
Sets whether the window is always on top.
An always on top window stays on top, even after clicking off of it.
pub fn set_window_state(self, state: WindowState) -> WindowDesc<T>
pub fn set_window_state(self, state: WindowState) -> WindowDesc<T>
Set initial state for the window.
pub fn with_config(self, config: WindowConfig) -> WindowDesc<T>
pub fn with_config(self, config: WindowConfig) -> WindowDesc<T>
Set the WindowConfig
of window.