# Struct `kurogane::WindowOptions`

```rust
pub struct WindowOptions { /* private fields */ }
```

How an application window opens. It holds the name the application knows
it by, its title, size and place, the size it cannot be made smaller than
and its state.

Sizes and places are in density-independent pixels (DIP) which the
display's scale turns into pixels. A size of 800 by 600 is 1200 by 900
pixels on a display at 150%. A place is on the screen, from the top-left
corner of the primary display.

A size and a place are the window's content, the area its page shows
in, without the frame the system draws around it. Centring a window and
keeping it on a display take the whole window, frame included, on
Windows and macOS. Under X11 the window manager adds the frame once the
window shows. There the content is centred and kept on the display.

```rust
App::new("dist")
    .window(WindowOptions::new().title("Notes").size(1100, 720).min_size(640, 480))
    .run_or_exit();
```

## Methods

### `new`

```rust
pub fn new() -> Self
```

A window titled after its page, 800 by 600 centred on the primary
display, shown normally.

### `name`

```rust
pub fn name(self, name: impl Into<String>) -> Self
```

The application's name for the window, never shown.
[`WindowClosing::name`](https://kurogane-rs.org/docs/api/windows/windowclosing.md#method.name) gives it back as
the window closes to keep its placement under.
[`AppHandle::find_window_by_name`](https://kurogane-rs.org/docs/api/app/apphandle.md#method.find_window_by_name)
finds the window by it. One open window has a name at a time.
[`AppInstance::create_window`](https://kurogane-rs.org/docs/api/app/appinstance.md#method.create_window) is
refused a name an open window has until that window's close is
reported.

[crate::AppInstance::create_window]: https://kurogane-rs.org/docs/api/app/appinstance.md#method.create_window
[crate::AppHandle::find_window_by_name]: https://kurogane-rs.org/docs/api/app/apphandle.md#method.find_window_by_name
[crate::WindowClosing::name]: https://kurogane-rs.org/docs/api/windows/windowclosing.md#method.name

### `title`

```rust
pub fn title(self, title: impl Into<String>) -> Self
```

The window's title, kept whatever title the page gives itself.
Without one the window takes its page's title as a browser tab does.
A page the window shows then names it in the taskbar and the window
switcher.

### `size`

```rust
pub fn size(self, width: u32, height: u32) -> Self
```

The size of the window's content, the window centred on the primary
display and made to fit its work area.
[`placement`](https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.placement), when given, decides the size instead.

[Self::placement]: https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.placement

### `placement`

```rust
pub fn placement(self, placement: WindowPlacement) -> Self
```

Opens the window as `placement` says. That is where it was the last
time ([`WindowClosing::placement`](https://kurogane-rs.org/docs/api/windows/windowclosing.md#method.placement)),
at its size and in its state. It decides the size over
[`size`](https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.size) and sets the state as [`state`](https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.state)
does. Of the two the later call holds. A place no display shows any
more is moved onto the nearest one. A window larger than that
display's work area is made to fit it. Wayland lets no application
place its windows; there only the size applies.

[Self::state]: https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.state
[Self::size]: https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.size
[crate::WindowClosing::placement]: https://kurogane-rs.org/docs/api/windows/windowclosing.md#method.placement

### `min_size`

```rust
pub fn min_size(self, width: u32, height: u32) -> Self
```

The size of content the user cannot make the window smaller than.
A side of 0 leaves that side free.

### `state`

```rust
pub fn state(self, state: WindowState) -> Self
```

How the window first shows. Opened maximized, minimized or
fullscreen, it restores to its size and place. Sets the state
[`placement`](https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.placement) sets. Of the two the later call holds.

[Self::placement]: https://kurogane-rs.org/docs/api/windows/windowoptions.md#method.placement

## Trait implementations

- `impl Clone for WindowOptions`
- `impl Debug for WindowOptions`
- `impl Default for WindowOptions`
- `impl Eq for WindowOptions`
- `impl PartialEq for WindowOptions`

Source: https://github.com/0x48piraj/kurogane/blob/584c586118ee53cc04604007ee038557bd859092/kurogane/src/window_options.rs#L33
