InfoBadge
struct · ferroui-controls · v0.5.0
struct InfoBadge
A small badge that draws attention to an item (WinUI's InfoBadge): a dot, an icon or a
number.
A value of 0 or more is shown as a number and takes precedence over the
icon_source; with the value -1 (the default) the badge shows the icon of
its icon source, and a dot without one. The control sets the states of WinUI as
pseudo-classes, which the control theme of the WinUI theme
(src/FerroUI.Themes.WinUI/Controls/InfoBadge.xaml) styles: :dot, :icon, :font-icon
(an icon of a FontIconSource) and :value (DisplayKindStates). The template binds the
number to value and the icon and the corner radius to the
template_settings. 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): a value below -1 is
coerced to -1 and logged, where WinUI throws; whether CornerRadius is local is followed from
the priority of its changes.
Members
TYPEto_refvalue_propertyicon_source_propertytemplate_settings_propertyconstructnewvalueset_numeric_valueicon_sourceset_icon_sourcetemplate_settings
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<InfoBadge>
Returns a strong reference to this object.
value_property
fn value_property() -> &'static StyledProperty<i32>
Defines the Value property: the number the badge shows when it is 0 or more; -1 (the
default) shows the icon or the dot. A value below -1 is coerced to -1.
icon_source_property
fn icon_source_property() -> &'static StyledProperty<Option<Ref<IconSource>>>
Defines the IconSource property: the icon the badge shows when its value is -1.
template_settings_property
fn template_settings_property() -> &'static DirectProperty<InfoBadge, Ref<InfoBadgeTemplateSettings>>
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 badge.
value
fn value(self: &Self) -> i32
Gets the number the badge shows (-1: the icon or the dot).
set_numeric_value
fn set_numeric_value(self: &Self, value: i32)
Sets the number the badge shows (-1: the icon or the dot). set_value is the setter of
properties of the object, so the setter of Value has this name.
icon_source
fn icon_source(self: &Self) -> Option<Ref<IconSource>>
Gets the icon source.
set_icon_source
fn set_icon_source(self: &Self, value: Option<Ref<IconSource>>)
Sets the icon source.
template_settings
fn template_settings(self: &Self) -> Ref<InfoBadgeTemplateSettings>
Gets the values the template binds to; each badge has its own.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<InfoBadge>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleStyledElementImplVisualImplInteractiveImplInputElementImplControlImplFerroObjectImplLayoutableImplTemplatedControlImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.