Plushie.Widget.Window (Plushie v0.6.0)

Copy Markdown View Source

Top-level window container node.

Holds window-level configuration (title, size, position, decorations, etc.) and wraps the child widget tree for that window. The runtime detects window nodes by their "window" type string and synchronizes open/close/update operations with the Rust binary via the bridge.

Props

  • title (string) -- window title bar text.
  • size ({width, height}) -- initial window size in pixels.
  • width (number) -- window width in pixels (alternative to size).
  • height (number) -- window height in pixels (alternative to size).
  • position ({x, y}) -- initial window position.
  • min_size ({width, height}) -- minimum window dimensions.
  • max_size ({width, height}) -- maximum window dimensions.
  • maximized (boolean) -- start maximized.
  • fullscreen (boolean) -- start in fullscreen mode.
  • visible (boolean) -- whether the window is visible.
  • resizable (boolean) -- whether the window can be resized.
  • closeable (boolean) -- whether the window close button is shown.
  • minimizable (boolean) -- whether the window can be minimized.
  • decorations (boolean) -- whether to show window decorations (title bar, borders).
  • transparent (boolean) -- whether the window background is transparent.
  • blur (boolean) -- whether to blur the window background.
  • level (atom) -- window stacking level (:normal, :always_on_top, :always_on_bottom).
  • exit_on_close_request (boolean) -- whether closing the window exits the app.
  • scale_factor (number) -- window scale factor override.
  • theme -- per-window theme. A built-in theme atom (e.g. :dark, :nord), :system to follow OS preference, or a custom palette map from Plushie.Type.Theme.custom/2. Overrides the app-level theme from settings/0 for this window only.

Summary

Functions

Sets whether to blur the window background.

Converts this window struct to a ui_node() map via the Plushie.Widget protocol.

Sets whether the window close button is shown.

Sets whether to show window decorations.

Sets whether closing the window exits the app.

Appends multiple children to the window.

Sets whether the window starts in fullscreen.

Sets the window height.

Sets the window stacking level.

Sets the maximum window size.

Sets whether the window starts maximized.

Sets the minimum window size.

Sets whether the window can be minimized.

Creates a new window struct with optional keyword opts.

Sets the initial window position.

Appends a child to the window.

Sets whether the window is resizable.

Sets the window scale factor.

Sets the window size as a {width, height} tuple.

Sets the per-window theme.

Sets the window title.

Sets whether the window background is transparent.

Sets whether the window is visible.

Sets the window width.

Applies keyword options to an existing window struct.

Types

option()

@type option() ::
  {:title, String.t()}
  | {:size, {number(), number()}}
  | {:width, number()}
  | {:height, number()}
  | {:position, {number(), number()}}
  | {:min_size, {number(), number()}}
  | {:max_size, {number(), number()}}
  | {:maximized, boolean()}
  | {:fullscreen, boolean()}
  | {:visible, boolean()}
  | {:resizable, boolean()}
  | {:closeable, boolean()}
  | {:minimizable, boolean()}
  | {:decorations, boolean()}
  | {:transparent, boolean()}
  | {:blur, boolean()}
  | {:level, atom()}
  | {:exit_on_close_request, boolean()}
  | {:scale_factor, number()}
  | {:theme, Plushie.Type.Theme.t()}

t()

@type t() :: %Plushie.Widget.Window{
  blur: boolean() | nil,
  children: [Plushie.Widget.child()],
  closeable: boolean() | nil,
  decorations: boolean() | nil,
  exit_on_close_request: boolean() | nil,
  fullscreen: boolean() | nil,
  height: number() | nil,
  id: String.t(),
  level: atom() | nil,
  max_size: {number(), number()} | nil,
  maximized: boolean() | nil,
  min_size: {number(), number()} | nil,
  minimizable: boolean() | nil,
  position: {number(), number()} | nil,
  resizable: boolean() | nil,
  scale_factor: number() | nil,
  size: {number(), number()} | nil,
  theme: Plushie.Type.Theme.t() | nil,
  title: String.t() | nil,
  transparent: boolean() | nil,
  visible: boolean() | nil,
  width: number() | nil
}

Functions

blur(w, blur)

@spec blur(window :: t(), blur :: boolean()) :: t()

Sets whether to blur the window background.

build(w)

@spec build(window :: t()) :: Plushie.Widget.ui_node()

Converts this window struct to a ui_node() map via the Plushie.Widget protocol.

closeable(w, closeable)

@spec closeable(window :: t(), closeable :: boolean()) :: t()

Sets whether the window close button is shown.

decorations(w, decorations)

@spec decorations(window :: t(), decorations :: boolean()) :: t()

Sets whether to show window decorations.

exit_on_close_request(w, v)

@spec exit_on_close_request(window :: t(), exit_on_close_request :: boolean()) :: t()

Sets whether closing the window exits the app.

extend(w, children)

@spec extend(window :: t(), children :: [Plushie.Widget.child()]) :: t()

Appends multiple children to the window.

fullscreen(w, fullscreen)

@spec fullscreen(window :: t(), fullscreen :: boolean()) :: t()

Sets whether the window starts in fullscreen.

height(w, height)

@spec height(window :: t(), height :: number()) :: t()

Sets the window height.

level(w, level)

@spec level(window :: t(), level :: atom()) :: t()

Sets the window stacking level.

max_size(w, max)

@spec max_size(window :: t(), max_size :: {number(), number()}) :: t()

Sets the maximum window size.

maximized(w, maximized)

@spec maximized(window :: t(), maximized :: boolean()) :: t()

Sets whether the window starts maximized.

min_size(w, min)

@spec min_size(window :: t(), min_size :: {number(), number()}) :: t()

Sets the minimum window size.

minimizable(w, minimizable)

@spec minimizable(window :: t(), minimizable :: boolean()) :: t()

Sets whether the window can be minimized.

new(id, opts \\ [])

@spec new(id :: String.t(), opts :: [option()]) :: t()

Creates a new window struct with optional keyword opts.

position(w, pos)

@spec position(window :: t(), position :: {number(), number()}) :: t()

Sets the initial window position.

push(w, child)

@spec push(window :: t(), child :: Plushie.Widget.child()) :: t()

Appends a child to the window.

resizable(w, resizable)

@spec resizable(window :: t(), resizable :: boolean()) :: t()

Sets whether the window is resizable.

scale_factor(w, scale_factor)

@spec scale_factor(window :: t(), scale_factor :: number()) :: t()

Sets the window scale factor.

size(w, size)

@spec size(window :: t(), size :: {number(), number()}) :: t()

Sets the window size as a {width, height} tuple.

theme(w, theme)

@spec theme(window :: t(), theme :: Plushie.Type.Theme.t()) :: t()

Sets the per-window theme.

title(w, title)

@spec title(window :: t(), title :: String.t()) :: t()

Sets the window title.

transparent(w, transparent)

@spec transparent(window :: t(), transparent :: boolean()) :: t()

Sets whether the window background is transparent.

visible(w, visible)

@spec visible(window :: t(), visible :: boolean()) :: t()

Sets whether the window is visible.

width(w, width)

@spec width(window :: t(), width :: number()) :: t()

Sets the window width.

with_options(w, opts)

@spec with_options(window :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing window struct.