pub struct ThemeVariant(/* private fields */);Expand description
Specifies a UI theme variant that should be used for the control and application types.
Theme variants are compared by their key.
Implementations§
Source§impl ThemeVariant
impl ThemeVariant
Sourcepub fn new(
key: impl Into<ResourceKey>,
inherit_variant: Option<ThemeVariant>,
) -> Self
pub fn new( key: impl Into<ResourceKey>, inherit_variant: Option<ThemeVariant>, ) -> Self
Creates a theme variant.
key is the key of the custom theme variant. inherit_variant is the
variant that this variant inherits from: if set, a resource that is
missing from the theme dictionary of the current variant is looked up
in the dictionary of the inherited one. Inheriting the default variant
is not supported.
Sourcepub fn default() -> ThemeVariant
pub fn default() -> ThemeVariant
Use the default theme variant: inherit the variant from the parent, and at the root use the variant of the platform.
Sourcepub fn light() -> ThemeVariant
pub fn light() -> ThemeVariant
Use the Light theme variant.
Sourcepub fn dark() -> ThemeVariant
pub fn dark() -> ThemeVariant
Use the Dark theme variant.
Sourcepub fn actual_theme_variant_property() -> &'static StyledProperty<Option<ThemeVariant>>
pub fn actual_theme_variant_property() -> &'static StyledProperty<Option<ThemeVariant>>
Defines the ActualThemeVariant property: the theme variant in
effect for an element, inherited down the tree. It is None
until a root or an element with a requested variant sets it.
Sourcepub fn requested_theme_variant_property() -> &'static StyledProperty<Option<ThemeVariant>>
pub fn requested_theme_variant_property() -> &'static StyledProperty<Option<ThemeVariant>>
Defines the RequestedThemeVariant property: the theme variant requested for an element and its descendants.
Sourcepub fn key(&self) -> &ResourceKey
pub fn key(&self) -> &ResourceKey
Key of the theme variant by which variants are compared.
Sourcepub fn inherit_variant(&self) -> Option<ThemeVariant>
pub fn inherit_variant(&self) -> Option<ThemeVariant>
The theme variant that this variant inherits from.
Sourcepub fn update_actual_theme_variant(target: &FerroObject)
pub fn update_actual_theme_variant(target: &FerroObject)
Updates the actual theme variant of target from its requested
theme variant: a requested variant other than the default becomes the
actual one, otherwise the actual variant is inherited.
Sourcepub fn register_theme_variant_root_type(type_: &'static TypeInfo)
pub fn register_theme_variant_root_type(type_: &'static TypeInfo)
Declares that the objects of a class that is not a styled element
(the application class) are roots of theme variant resolution.
Styled elements say so through the is_theme_variant_root virtual.
(Upstream: the IThemeVariantRoot interface.)
Sourcepub fn to_platform_theme_variant(
theme_variant: Option<&ThemeVariant>,
) -> Option<PlatformThemeVariant>
pub fn to_platform_theme_variant( theme_variant: Option<&ThemeVariant>, ) -> Option<PlatformThemeVariant>
The platform theme variant of a theme variant (the original’s explicit conversion to a nullable platform theme variant): the light and the dark variant convert to their counterparts, another variant converts as the variant it inherits from, and a variant that inherits from neither, or no variant, converts to nothing.
Trait Implementations§
Source§impl Clone for ThemeVariant
impl Clone for ThemeVariant
Source§impl Debug for ThemeVariant
impl Debug for ThemeVariant
Source§impl Default for ThemeVariant
impl Default for ThemeVariant
Source§impl Display for ThemeVariant
impl Display for ThemeVariant
impl Eq for ThemeVariant
Source§impl From<PlatformThemeVariant> for ThemeVariant
The original’s explicit conversion from a platform theme variant.
impl From<PlatformThemeVariant> for ThemeVariant
The original’s explicit conversion from a platform theme variant.
Source§fn from(theme_variant: PlatformThemeVariant) -> Self
fn from(theme_variant: PlatformThemeVariant) -> Self
Source§impl FromStr for ThemeVariant
impl FromStr for ThemeVariant
Source§impl Hash for ThemeVariant
impl Hash for ThemeVariant
Source§impl MarkupTyped for ThemeVariant
impl MarkupTyped for ThemeVariant
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !RefUnwindSafe for ThemeVariant
impl !Send for ThemeVariant
impl !Sync for ThemeVariant
impl !UnwindSafe for ThemeVariant
impl Freeze for ThemeVariant
impl Unpin for ThemeVariant
impl UnsafeUnpin for ThemeVariant
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more