InfoBar
struct · ferroui-controls · v0.5.0
struct InfoBar
An inline message of the application (WinUI's InfoBar): a title, a message, an action button
and content, with the icon and the colours of its severity, shown while
is_open and closed by its close button or by the application.
The control sets the states of WinUI as pseudo-classes, which the control theme of the WinUI
theme (src/FerroUI.Themes.WinUI/Controls/InfoBar.xaml) styles: :informational,
:success, :warning, :error (SeverityLevels), :standard-icon-visible,
:user-icon-visible (IconStates; neither is NoIconVisible), :close-button-collapsed,
:open (InfoBarVisible; its absence is InfoBarCollapsed), :foreground-set (a Foreground
set on the bar itself) and :no-banner-content (no title, message or action button). The
template parts it looks up are the button CloseButton and the severity icon StandardIcon;
the content is presented by PART_ContentPresenter (WinUI's ContentArea). The Fluent and
Simple themes have no template for it (docs/porting/winui-controls.md, section 5.1).
Differences from WinUI (docs/porting/winui-controls.md, section 10.2): the bar is a
ContentControl; UI Automation notifications are not raised (the peer reports the title and
the message as the name and a live setting of the severity instead); the texts of the close
button and the severity icons are WinUI's English texts.
Members
TYPEto_refis_open_propertytitle_propertymessage_propertyseverity_propertyicon_source_propertyis_icon_visible_propertyis_closable_propertyclose_button_style_propertyclose_button_command_propertyclose_button_command_parameter_propertyaction_button_propertytemplate_settings_propertyconstructnewis_openset_is_opentitleset_titlemessageset_messageseverityset_severityicon_sourceset_icon_sourceis_icon_visibleset_is_icon_visibleis_closableset_is_closableclose_button_styleset_close_button_styleclose_button_commandset_close_button_commandclose_button_command_parameterset_close_button_command_parameteraction_buttonset_action_buttontemplate_settingsclose_button_clickclosingclosedopened
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<InfoBar>
Returns a strong reference to this object.
is_open_property
fn is_open_property() -> &'static StyledProperty<bool>
Defines the IsOpen property: whether the bar is shown. false by default.
title_property
fn title_property() -> &'static StyledProperty<String>
Defines the Title property: the title of the message.
message_property
fn message_property() -> &'static StyledProperty<String>
Defines the Message property: the text of the message.
severity_property
fn severity_property() -> &'static StyledProperty<InfoBarSeverity>
Defines the Severity property: the kind of the message, which selects its icon and
colours. Informational by default.
icon_source_property
fn icon_source_property() -> &'static StyledProperty<Option<Ref<IconSource>>>
Defines the IconSource property: an icon of the application shown in place of the
icon of the severity.
is_icon_visible_property
fn is_icon_visible_property() -> &'static StyledProperty<bool>
Defines the IsIconVisible property: whether an icon is shown. true by default.
is_closable_property
fn is_closable_property() -> &'static StyledProperty<bool>
Defines the IsClosable property: whether the close button is shown. true by
default.
close_button_style_property
fn close_button_style_property() -> &'static StyledProperty<Option<Ref<ControlTheme>>>
Defines the CloseButtonStyle property: the control theme of the close button
(WinUI's style; the WinUI theme sets InfoBarCloseButtonStyle).
close_button_command_property
fn close_button_command_property() -> &'static StyledProperty<Option<Rc<dyn ICommand>>>
Defines the CloseButtonCommand property: the command of the close button.
close_button_command_parameter_property
fn close_button_command_parameter_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the CloseButtonCommandParameter property: the parameter of the command of the
close button.
action_button_property
fn action_button_property() -> &'static StyledProperty<Option<Ref<Button>>>
Defines the ActionButton property: a button shown after the message.
template_settings_property
fn template_settings_property() -> &'static DirectProperty<InfoBar, Ref<InfoBarTemplateSettings>>
Defines the TemplateSettings property: the values the template binds to (read-only).
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
Creates an info bar.
is_open
fn is_open(self: &Self) -> bool
Gets whether the bar is shown.
set_is_open
fn set_is_open(self: &Self, value: bool)
Sets whether the bar is shown.
title
fn title(self: &Self) -> String
Gets the title.
set_title
fn set_title(self: &Self, value: impl Into<String>)
Sets the title.
message
fn message(self: &Self) -> String
Gets the message.
set_message
fn set_message(self: &Self, value: impl Into<String>)
Sets the message.
severity
fn severity(self: &Self) -> InfoBarSeverity
Gets the severity.
set_severity
fn set_severity(self: &Self, value: InfoBarSeverity)
Sets the severity.
icon_source
fn icon_source(self: &Self) -> Option<Ref<IconSource>>
Gets the icon of the application.
set_icon_source
fn set_icon_source(self: &Self, value: Option<Ref<IconSource>>)
Sets the icon of the application.
is_icon_visible
fn is_icon_visible(self: &Self) -> bool
Gets whether an icon is shown.
set_is_icon_visible
fn set_is_icon_visible(self: &Self, value: bool)
Sets whether an icon is shown.
is_closable
fn is_closable(self: &Self) -> bool
Gets whether the close button is shown.
set_is_closable
fn set_is_closable(self: &Self, value: bool)
Sets whether the close button is shown.
close_button_style
fn close_button_style(self: &Self) -> Option<Ref<ControlTheme>>
Gets the control theme of the close button.
set_close_button_style
fn set_close_button_style(self: &Self, value: Option<Ref<ControlTheme>>)
Sets the control theme of the close button.
close_button_command
fn close_button_command(self: &Self) -> Option<Rc<dyn ICommand>>
Gets the command of the close button.
set_close_button_command
fn set_close_button_command(self: &Self, value: Option<Rc<dyn ICommand>>)
Sets the command of the close button.
close_button_command_parameter
fn close_button_command_parameter(self: &Self) -> Option<BoxedValue>
Gets the parameter of the command of the close button.
set_close_button_command_parameter
fn set_close_button_command_parameter(self: &Self, value: Option<BoxedValue>)
Sets the parameter of the command of the close button.
action_button
fn action_button(self: &Self) -> Option<Ref<Button>>
Gets the action button.
set_action_button
fn set_action_button(self: &Self, value: Option<Ref<Button>>)
Sets the action button.
template_settings
fn template_settings(self: &Self) -> Ref<InfoBarTemplateSettings>
Gets the values the template binds to; each bar has its own.
close_button_click
fn close_button_click(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Adds a handler of CloseButtonClick, raised when the close button is clicked, before the
bar closes. Dropping the returned guard removes the handler; Subscription::detach keeps
it for the life of the bar.
closing
fn closing(self: &Self, handler: impl Fn(&InfoBarClosingEventArgs) -> () + 'static) -> Subscription
Adds a handler of Closing, raised when the bar is about to close; a handler may cancel it.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the bar.
closed
fn closed(self: &Self, handler: impl Fn(&InfoBarClosedEventArgs) -> () + 'static) -> Subscription
Adds a handler of Closed, raised when the bar has closed. Dropping the returned guard
removes the handler; Subscription::detach keeps it for the life of the bar.
opened
fn opened(self: &Self, handler: impl Fn(&InfoBarOpenedEventArgs) -> () + 'static) -> Subscription
Adds a handler of Opened, raised when the bar opens. Dropping the returned guard removes
the handler; Subscription::detach keeps it for the life of the bar.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtContentControlImplExtControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<InfoBar>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleStyledElementImplVisualImplLayoutableImplInteractiveImplInputElementImplContentControlImplFerroObjectImplControlImplTemplatedControlImplDrop
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.