# IStyleHost

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/styling/trait-istylehost/

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

```rust
trait IStyleHost: IResourceHost
```

Defines an element that has a [`Styles`](/docs/0.5.0/api/ferroui-base/styling/struct-styles/) collection.

Implemented by [`StyledElement`](/docs/0.5.0/api/ferroui-base/struct-styledelement/) and by the application object, which
holds the global styles and is the root of the styling-parent chain. Every
style host is also a resource host.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/i_style_host.rs#L12)

## Members

- [`is_styles_initialized`](#function-is_styles_initialized)
- [`styles`](#function-styles)
- [`styling_parent`](#function-styling_parent)
- [`styles_added`](#function-styles_added)
- [`styles_removed`](#function-styles_removed)

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

### is_styles_initialized

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

Whether the styles collection has been created.

The styles collection is created lazily; this lets a style lookup
skip hosts without styles without creating the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/i_style_host.rs#L17)

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

### styles

```rust
fn styles(self: &Self) -> Ref<Styles>
```

The styles for the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/i_style_host.rs#L20)

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

### styling_parent

```rust
fn styling_parent(self: &Self) -> Option<StyleHostRef>
```

The parent style host element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/i_style_host.rs#L23)

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

### styles_added

```rust
fn styles_added(self: &Self, styles: &[Rc<dyn IStyle>])
```

Called when styles are added to the styles collection of the host or
a nested styles collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/i_style_host.rs#L27)

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

### styles_removed

```rust
fn styles_removed(self: &Self, styles: &[Rc<dyn IStyle>])
```

Called when styles are removed from the styles collection of the host
or a nested styles collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/i_style_host.rs#L31)

## Trait implementations

- [`IStyleHost`](/docs/0.5.0/api/ferroui-base/styling/trait-istylehost/)

## Availability

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