FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TitleBar

    struct · ferroui-controls · v0.5.0

    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 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

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

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

    Returns a strong reference to this object.

    Source

    title_property

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

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

    Source

    subtitle_property

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

    Defines the Subtitle property: the text beside the title.

    Source

    icon_source_property

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

    Defines the IconSource property: the icon before the title.

    Source

    left_header_property

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

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

    Source

    content_property

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

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

    Source

    right_header_property

    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

    is_back_button_visible_property

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

    Defines the IsBackButtonVisible property (false by default).

    Source

    is_back_button_enabled_property

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

    Defines the IsBackButtonEnabled property (true by default).

    Source

    is_pane_toggle_button_visible_property

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

    Defines the IsPaneToggleButtonVisible property (false by default).

    Source

    auto_refresh_drag_regions_property

    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

    template_settings_property

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

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

    Source

    is_drag_region_property

    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

    construct

    fn construct() -> Self
    

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    title

    fn title(self: &Self) -> String
    

    Source

    set_title

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

    Source

    subtitle

    fn subtitle(self: &Self) -> String
    

    Source

    set_subtitle

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

    Source

    icon_source

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

    Source

    set_icon_source

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

    Source

    left_header

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

    Source

    set_left_header

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

    Source

    content

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

    Source

    set_content

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

    Source

    right_header

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

    Source

    set_right_header

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

    Source

    is_back_button_visible

    fn is_back_button_visible(self: &Self) -> bool
    

    Source

    set_is_back_button_visible

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

    Source

    is_back_button_enabled

    fn is_back_button_enabled(self: &Self) -> bool
    

    Source

    set_is_back_button_enabled

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

    Source

    is_pane_toggle_button_visible

    fn is_pane_toggle_button_visible(self: &Self) -> bool
    

    Source

    set_is_pane_toggle_button_visible

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

    Source

    auto_refresh_drag_regions

    fn auto_refresh_drag_regions(self: &Self) -> bool
    

    Source

    set_auto_refresh_drag_regions

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

    Source

    template_settings

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

    Source

    get_is_drag_region

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

    The IsDragRegion of element.

    Source

    set_is_drag_region

    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

    recompute_drag_regions

    fn recompute_drag_regions(self: &Self)
    

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

    Source

    back_requested

    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

    pane_toggle_requested

    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

    window

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

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

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.