3.3.2 Windows
3.3.2.1 Window
3.3.2.2 Dialog
On this page:
Window
Window.Style
Window.Style.no_  resize_  border
Window.Style.no_  title
Window.Style.no_  system_  menu
Window.Style.hide_  menu_  bar
Window.Style.float
Window.Style.fullscreen_  button
Window.Style.fullscreen_  aux

image

class

class gui.Window():

  implements WindowView

  constructor (

    ~title: title :: ObsOrValue.of(String) = "Untitled",

    ~style: style :: ObsOrValue.of(List.of(Window.Style)) = [],

    ~size: size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~position: position :: ObsOrValue.of(View.Position) = #'center,

    ~align: align :: ObsOrValue.of(View.Alignment) = [#'center, #'center],

    ~min_size: min_size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~stretch: stretch :: ObsOrValue.of(View.Stretch) = [#true, #true],

    ~enable: enable :: ObsOrValue.of(Boolean) = #true,

    ~menu_bar: menu_bar :: maybe(MenuBar) = #false,

    ~window_callbacks: window_callbacks :: maybe(WindowCallbacks) = #false,

    child :: ObsOrValue.of(WindowChildView && !WindowView), ...

  )

Creates a top-level window view that can be instantiated with render. The child views supply the window content.

The ~size argument supplies the window’s initial or current size, while ~min_size, the window content, and ~stretch constrain the size that a user can choose when resizing the window. The ~position argument similar provides the window’s initial or current position, but a user can move the window—depending on window decorations controlled in part by the ~style argument, such as whether a title bar is present. See Geometry Management for information about ~align, ~min_size, and ~stretch.

A menu bar supplied as the ~menu_bar argument is active when the window is active. Depending on the platform, the menu bar is either within the window or at the top of the screen when the window is frontmost.

When a window is disabled via ~enable, all content within the window is also disabled. Whether the menu bar is disabled along with a window depends on whether it is in the window or at the top of the screen.

The ~window_callbacks argument configures callbacks that are common to all WindowChildViews. See WindowCallbacks for more information.

A window style option:

  • #'no_resize_border: Disables window resizing by a user.

  • #'no_title: Omits a title bar for the window.

  • #'no_system_menu: Omits the system menu (Windows).

  • #'hide_menu_bar: Hides the menu bar and dock when the window is active (Mac OS) or asks the window manager to make the window fullscreen (Unix).

  • #'float: Causes the window to stay in front of all other non-floating windows. On Mac OS, a floating window shares the focus with an active non-floating window. When this style is combined with #'no_caption, then showing the frame does not cause the keyboard focus to shift to the window, and on Unix, clicking the frame does not move the focus. on Windows, a floating window has no taskbar button.

  • #'fullscreen_button: Includes a button on the window’s title bar to put the window in fullscreen mode (Mac OS 10.7 and later).

  • #'fullscreen_aux: Allows the window to accompany another that is in fullscreen mode (Mac OS 10.7 and later).