# WindowClosingEventArgs

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-windowclosingeventargs/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct WindowClosingEventArgs
```

Provides data for the window closing event.

The args are a reference object: a copy shares the cancel flag with the
args it was made from, so that a handler given a copy cancels the
closing, and copies compare by identity.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/window_closing_event_args.rs#L31)

## Members

- [`new`](#function-new)
- [`cancel`](#function-cancel)
- [`set_cancel`](#function-set_cancel)
- [`close_reason`](#function-close_reason)
- [`is_programmatic`](#function-is_programmatic)

<a id="function-new"></a>

### new

```rust
fn new(reason: WindowCloseReason, is_programmatic: bool) -> Self
```

Creates the event args. Only the windowing classes raise the event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/window_closing_event_args.rs#L45)

<a id="function-cancel"></a>

### cancel

```rust
fn cancel(self: &Self) -> bool
```

Whether the event should be canceled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/window_closing_event_args.rs#L50)

<a id="function-set_cancel"></a>

### set_cancel

```rust
fn set_cancel(self: &Self, value: bool)
```

Sets whether the event should be canceled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/window_closing_event_args.rs#L55)

<a id="function-close_reason"></a>

### close_reason

```rust
fn close_reason(self: &Self) -> WindowCloseReason
```

Gets a value that indicates why the window is being closed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/window_closing_event_args.rs#L60)

<a id="function-is_programmatic"></a>

### is_programmatic

```rust
fn is_programmatic(self: &Self) -> bool
```

Gets a value indicating whether the window is being closed
programmatically.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/window_closing_event_args.rs#L66)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Debug`
- `PartialEq`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
