# TitleBar

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

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

```rust
struct TitleBar
```

The title bar of a window (WinUI's `TitleBar`): a back button, a pane toggle button, a left
header, an icon, a title and a subtitle, content (a search box, in WinUI Gallery) and a right
header, drawn in the title bar of the window when the client area extends into it.

The control sets the states of WinUI as pseudo-classes, which the control theme of the WinUI
theme (`src/FerroUI.Themes.WinUI/Controls/TitleBar.xaml`) styles: `:back-button-visible`,
`:pane-toggle-button-visible`, `:left-header-visible`, `:icon-visible`,
`:title-text-visible`, `:subtitle-text-visible`, `:content-visible`,
`:right-header-visible` (the Visible states of their groups; their absence is Collapsed),
`:deactivated` (the Deactivated states: the window is not active), `:expanded-height`
(HeightGroup: content or a header), `:compact` (DisplayModeGroup: the content no longer fits
beside the title) and `:negative-inset-spacing` (LeftHeaderSpacingGroup). The template parts
are WinUI's: `LeftPaddingColumn` and `RightPaddingColumn` (borders in FerroUI, a column
definition has no name), `PART_BackButton`,
`PART_PaneToggleButton`, `PART_Icon`, `PART_LeftHeaderPresenter`, `PART_ContentPresenterGrid`,
`PART_ContentPresenter` and `PART_RightHeaderPresenter`. The Fluent and Simple themes have no
template for it (docs/porting/winui-controls.md, section 5.1).

The window: WinUI's `AppWindow` gives the insets of the caption buttons, the drag regions and
the activation. The port takes the insets from `Window::caption_button_insets` (the traffic
lights of macOS at the left, the caption buttons the toolkit draws at the right), marks the
title bar as the drag region of the window and its back button, pane toggle button, headers and
the interactive controls of its content as elements that take the input
([`WindowDecorationProperties`](/docs/0.5.0/api/ferroui-controls/chrome/struct-windowdecorationproperties/) roles, which take effect while the client area extends into the
decorations), and follows `WindowBase::is_active`. A title is the title of the window while
the bar shows it, as in WinUI.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`title_property`](#function-title_property)
- [`subtitle_property`](#function-subtitle_property)
- [`icon_source_property`](#function-icon_source_property)
- [`left_header_property`](#function-left_header_property)
- [`content_property`](#function-content_property)
- [`right_header_property`](#function-right_header_property)
- [`is_back_button_visible_property`](#function-is_back_button_visible_property)
- [`is_back_button_enabled_property`](#function-is_back_button_enabled_property)
- [`is_pane_toggle_button_visible_property`](#function-is_pane_toggle_button_visible_property)
- [`auto_refresh_drag_regions_property`](#function-auto_refresh_drag_regions_property)
- [`template_settings_property`](#function-template_settings_property)
- [`is_drag_region_property`](#function-is_drag_region_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`title`](#function-title)
- [`set_title`](#function-set_title)
- [`subtitle`](#function-subtitle)
- [`set_subtitle`](#function-set_subtitle)
- [`icon_source`](#function-icon_source)
- [`set_icon_source`](#function-set_icon_source)
- [`left_header`](#function-left_header)
- [`set_left_header`](#function-set_left_header)
- [`content`](#function-content)
- [`set_content`](#function-set_content)
- [`right_header`](#function-right_header)
- [`set_right_header`](#function-set_right_header)
- [`is_back_button_visible`](#function-is_back_button_visible)
- [`set_is_back_button_visible`](#function-set_is_back_button_visible)
- [`is_back_button_enabled`](#function-is_back_button_enabled)
- [`set_is_back_button_enabled`](#function-set_is_back_button_enabled)
- [`is_pane_toggle_button_visible`](#function-is_pane_toggle_button_visible)
- [`set_is_pane_toggle_button_visible`](#function-set_is_pane_toggle_button_visible)
- [`auto_refresh_drag_regions`](#function-auto_refresh_drag_regions)
- [`set_auto_refresh_drag_regions`](#function-set_auto_refresh_drag_regions)
- [`template_settings`](#function-template_settings)
- [`get_is_drag_region`](#function-get_is_drag_region)
- [`set_is_drag_region`](#function-set_is_drag_region)
- [`recompute_drag_regions`](#function-recompute_drag_regions)
- [`back_requested`](#function-back_requested)
- [`pane_toggle_requested`](#function-pane_toggle_requested)
- [`window`](#function-window)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

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

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<TitleBar>
```

Returns a strong reference to this object.

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

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

### title_property

```rust
fn title_property() -> &'static StyledProperty<String>
```

Defines the `Title` property: the title the bar shows, which is also the title of its
window.

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

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

### subtitle_property

```rust
fn subtitle_property() -> &'static StyledProperty<String>
```

Defines the `Subtitle` property: the text beside the title.

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

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

### icon_source_property

```rust
fn icon_source_property() -> &'static StyledProperty<Option<Ref<IconSource>>>
```

Defines the `IconSource` property: the icon before the title.

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

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

### left_header_property

```rust
fn left_header_property() -> &'static StyledProperty<Option<Ref<Control>>>
```

Defines the `LeftHeader` property: an element after the buttons, before the icon.

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

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

### content_property

```rust
fn content_property() -> &'static StyledProperty<Option<Ref<Control>>>
```

Defines the `Content` property: the element in the middle of the bar (a search box).

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

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

### right_header_property

```rust
fn right_header_property() -> &'static StyledProperty<Option<Ref<Control>>>
```

Defines the `RightHeader` property: an element at the right of the bar, before the
caption buttons.

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

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

### is_back_button_visible_property

```rust
fn is_back_button_visible_property() -> &'static StyledProperty<bool>
```

Defines the `IsBackButtonVisible` property (false by default).

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

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

### is_back_button_enabled_property

```rust
fn is_back_button_enabled_property() -> &'static StyledProperty<bool>
```

Defines the `IsBackButtonEnabled` property (true by default).

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

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

### is_pane_toggle_button_visible_property

```rust
fn is_pane_toggle_button_visible_property() -> &'static StyledProperty<bool>
```

Defines the `IsPaneToggleButtonVisible` property (false by default).

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

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

### auto_refresh_drag_regions_property

```rust
fn auto_refresh_drag_regions_property() -> &'static StyledProperty<bool>
```

Defines the `AutoRefreshDragRegions` property: whether the bar finds the interactive
elements of its content again when the content changes its layout (false by default:
once, after the content is first laid out, as in WinUI).

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

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

### template_settings_property

```rust
fn template_settings_property() -> &'static DirectProperty<TitleBar, Ref<TitleBarTemplateSettings>>
```

Defines the `TemplateSettings` property: the values the template binds to (read-only).

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

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

### is_drag_region_property

```rust
fn is_drag_region_property() -> &'static AttachedProperty<Option<bool>>
```

Defines the `IsDragRegion` attached property of an element of the content: `Some(true)`
drags the window (and, on a control, its whole area), `Some(false)` takes the input, and
`None` (the default) leaves it to the bar, which makes the enabled controls take the
input.

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

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

### construct

```rust
fn construct() -> Self
```



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

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

### new

```rust
fn new() -> Ref<Self>
```



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

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

### title

```rust
fn title(self: &Self) -> String
```



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

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

### set_title

```rust
fn set_title(self: &Self, value: &str)
```



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

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

### subtitle

```rust
fn subtitle(self: &Self) -> String
```



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

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

### set_subtitle

```rust
fn set_subtitle(self: &Self, value: &str)
```



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

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

### icon_source

```rust
fn icon_source(self: &Self) -> Option<Ref<IconSource>>
```



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

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

### set_icon_source

```rust
fn set_icon_source(self: &Self, value: Option<Ref<IconSource>>)
```



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

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

### left_header

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



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

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

### set_left_header

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



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

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

### content

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



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

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

### set_content

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



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

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

### right_header

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



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

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

### set_right_header

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



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

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

### is_back_button_visible

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



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

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

### set_is_back_button_visible

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



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

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

### is_back_button_enabled

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



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

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

### set_is_back_button_enabled

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



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

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

### is_pane_toggle_button_visible

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



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

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

### set_is_pane_toggle_button_visible

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



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

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

### auto_refresh_drag_regions

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



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

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

### set_auto_refresh_drag_regions

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



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

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

### template_settings

```rust
fn template_settings(self: &Self) -> Ref<TitleBarTemplateSettings>
```



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

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

### get_is_drag_region

```rust
fn get_is_drag_region(element: &Visual) -> Option<bool>
```

The `IsDragRegion` of `element`.

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

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

### set_is_drag_region

```rust
fn set_is_drag_region(element: &Visual, value: Option<bool>)
```

Sets the `IsDragRegion` of `element`; the title bar it is in finds its interactive
elements again.

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

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

### recompute_drag_regions

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

Finds the interactive elements of the bar again after the application changed its
content (WinUI's `RecomputeDragRegions`).

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

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

### back_requested

```rust
fn back_requested(self: &Self, handler: impl Fn(&TitleBar) -> () + 'static) -> Subscription
```

Adds a handler of `BackRequested`: the back button was clicked.

Dropping the returned guard removes the handler;
`Subscription::detach` keeps it for the life of the title bar.

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

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

### pane_toggle_requested

```rust
fn pane_toggle_requested(self: &Self, handler: impl Fn(&TitleBar) -> () + 'static) -> Subscription
```

Adds a handler of `PaneToggleRequested`: the pane toggle button was clicked.

Dropping the returned guard removes the handler; `Subscription::detach`
keeps it for the life of the title bar.

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

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

### window

```rust
fn window(self: &Self) -> Option<Ref<Window>>
```

The window of the bar, while it is in one.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<TitleBar>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)

## Availability

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