# FerroView

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-browser/struct-ferroview/

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

```rust
struct FerroView
```

Shows content in an element of the web page.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L16)

## Members

- [`new`](#function-new)
- [`content`](#function-content)
- [`set_content`](#function-set_content)
- [`is_accessibility_enabled`](#function-is_accessibility_enabled)
- [`set_accessibility_enabled`](#function-set_accessibility_enabled)
- [`accessibility`](#function-accessibility)
- [`dispose`](#function-dispose)

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

### new

```rust
fn new(div_id: &str) -> Rc<Self>
```

Creates a view over the element with the given id.

`div_id` is the ID of the html element where the content should be
rendered.
## Panics
Panics when the document has no such element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L29)

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

### content

```rust
fn content(self: &Self) -> Option<Ref<Control>>
```

The content of the view.
## Panics
Panics when the content of the top-level was set to something that
is not a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L114)

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

### set_content

```rust
fn set_content(self: &Self, value: Option<Ref<Control>>)
```

Sets the content of the view.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L123)

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

### is_accessibility_enabled

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

Whether the view mirrors the automation tree of its controls into the
page (for screen readers, the element picker of the developer tools
and automation by role). Not in the original.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L130)

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

### set_accessibility_enabled

```rust
fn set_accessibility_enabled(self: &Self, enabled: bool)
```

Turns the mirror of the automation tree of the view on or off,
whatever `BrowserPlatformOptions::accessibility` chose. Not in the
original.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L137)

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

### accessibility

```rust
fn accessibility(self: &Self) -> Option<&Rc<BrowserAccessibility>>
```

The mirror of the automation tree of the view. Not in the original.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L144)

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

### dispose

```rust
fn dispose(self: &Self)
```

Closes the view: its top-level is disposed, which releases the
surface of the canvas (on the thread that renders, the render target
of the canvas and what drew to it) and stops the renderer of the
view. The elements of the view stay in the page. The view cannot be
used afterwards.

Not from upstream, whose view has no way to be closed (the top-level
under it is disposable there as here). A page that shows and removes
views would otherwise keep the canvas and the graphics context of
every view it ever had.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Browser/FerroUI.Browser/ferro_view.rs#L162)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`

## Availability

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