pub struct InteractiveStyle {
pub normal: Style,
pub hover: Option<Style>,
pub focus: Option<Style>,
pub active: Option<Style>,
pub disabled: Option<Style>,
}Expand description
Style variants for different interaction states.
Each variant is an optional Style overlay. When resolving, the variant
for the current state is merged on top of the normal base style using
Style::patch, preserving CSS-like specificity: the more specific state
wins for any property it sets.
Fields§
§normal: StyleBase style applied in all states.
hover: Option<Style>Override applied when hovered.
focus: Option<Style>Override applied when focused.
active: Option<Style>Override applied when active (pressed).
disabled: Option<Style>Override applied when disabled.
Implementations§
Source§impl InteractiveStyle
impl InteractiveStyle
Sourcepub fn resolve(&self, state: InteractionState) -> Style
pub fn resolve(&self, state: InteractionState) -> Style
Resolve the style for the given interaction state.
Starts with normal and patches the state-specific override on top.
For FocusedHovered, both focus and hover are applied (focus first,
then hover, so hover wins for conflicting properties).
Sourcepub fn has_override(&self, state: InteractionState) -> bool
pub fn has_override(&self, state: InteractionState) -> bool
Check whether the given state has a specific override.
Trait Implementations§
Source§impl Clone for InteractiveStyle
impl Clone for InteractiveStyle
Source§fn clone(&self) -> InteractiveStyle
fn clone(&self) -> InteractiveStyle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InteractiveStyle
impl Debug for InteractiveStyle
Source§impl Default for InteractiveStyle
impl Default for InteractiveStyle
Source§impl From<Style> for InteractiveStyle
impl From<Style> for InteractiveStyle
Source§impl PartialEq for InteractiveStyle
impl PartialEq for InteractiveStyle
impl StructuralPartialEq for InteractiveStyle
Auto Trait Implementations§
impl Freeze for InteractiveStyle
impl RefUnwindSafe for InteractiveStyle
impl Send for InteractiveStyle
impl Sync for InteractiveStyle
impl Unpin for InteractiveStyle
impl UnsafeUnpin for InteractiveStyle
impl UnwindSafe for InteractiveStyle
Blanket Implementations§
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
Mutably borrows from an owned value. Read more