# IActivatableLifetime

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/application_lifetimes/trait-iactivatablelifetime/

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

```rust
trait IActivatableLifetime
```

An interface for platforms that can activate and deactivate the
application, and move it into and out of the background.

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

## Members

- [`activated`](#function-activated)
- [`deactivated`](#function-deactivated)
- [`try_leave_background`](#function-try_leave_background)
- [`try_enter_background`](#function-try_enter_background)

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

### activated

```rust
fn activated(self: &Self, handler: Rc<dyn Fn(&ActivatedEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Raised when the application is activated for various reasons, as
described by the `ActivationKind`.
Disposing the returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_activatable_application_lifetime.rs#L11)

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

### deactivated

```rust
fn deactivated(self: &Self, handler: Rc<dyn Fn(&ActivatedEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Raised when the application is deactivated for various reasons, as
described by the `ActivationKind`.
Disposing the returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_activatable_application_lifetime.rs#L16)

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

### try_leave_background

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

Tells the application that it should attempt to leave its background
state. Returns true if it will process the request; false otherwise.

For example on macOS this would be `[NSApp unhide]`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_activatable_application_lifetime.rs#L22)

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

### try_enter_background

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

Tells the application that it should attempt to enter its background
state. Returns true if it will process the request; false otherwise.

For example on macOS this would be `[NSApp hide]`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/application_lifetimes/i_activatable_application_lifetime.rs#L28)

## Trait implementations

- [`IActivatableLifetime`](/docs/0.5.0/api/ferroui-controls/application_lifetimes/trait-iactivatablelifetime/)

## Availability

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