pub struct CommonStyle {
pub bold: Option<bool>,
pub italic: Option<bool>,
pub underline: Option<bool>,
pub strikethrough: Option<bool>,
pub font_family: Option<Option<String>>,
pub font_size: Option<Option<f64>>,
pub text_color: Option<Option<Color>>,
pub highlight: Option<Option<Color>>,
pub align: Option<TextHAlign>,
pub list: Option<ListKind>,
}Expand description
Per-attribute summary of the styles across a selection, for toolbar state.
Each field is None when the selected runs disagree on that attribute
(“mixed”), or Some(value) when they all share value. For the
inherit-able attributes the value is itself an Option (None = “all
inherit the widget default”, Some(x) = “all set to x”).
Fields§
§bold: Option<bool>Shared bold state, or None when the selection is mixed.
italic: Option<bool>Shared italic state, or None when mixed.
underline: Option<bool>Shared underline state, or None when mixed.
strikethrough: Option<bool>Shared strikethrough state, or None when mixed.
font_family: Option<Option<String>>Shared font family (inner None = all inherit default), or None when mixed.
font_size: Option<Option<f64>>Shared font size (inner None = all inherit default), or None when mixed.
text_color: Option<Option<Color>>Shared text colour (inner None = all inherit default), or None when mixed.
highlight: Option<Option<Color>>Shared highlight colour (inner None = none), or None when mixed.
align: Option<TextHAlign>Block-level alignment shared by every block the selection touches, or
None when they disagree (mixed). Drives the toolbar’s L/C/R alignment
radio group. Only populated by range_common_style — the inline-only
CommonStyle::of_style path leaves it None.
list: Option<ListKind>Block-level list decoration shared by every touched block, or None
when mixed. Drives the ordered/bullet toggles: Some(ListKind::None)
means “all plain paragraphs”, so neither list button is active.
Implementations§
Source§impl CommonStyle
impl CommonStyle
Sourcepub fn of_style(style: &InlineStyle) -> Self
pub fn of_style(style: &InlineStyle) -> Self
A CommonStyle in which every attribute agrees with style — the
summary of a single uniform run. Used by the editor to report the
pending caret style (a toggled format awaiting the next keystroke) to
the toolbar, where no run yet carries it.
Trait Implementations§
Source§impl Clone for CommonStyle
impl Clone for CommonStyle
Source§fn clone(&self) -> CommonStyle
fn clone(&self) -> CommonStyle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommonStyle
impl Debug for CommonStyle
Source§impl Default for CommonStyle
impl Default for CommonStyle
Source§fn default() -> CommonStyle
fn default() -> CommonStyle
Source§impl PartialEq for CommonStyle
impl PartialEq for CommonStyle
impl StructuralPartialEq for CommonStyle
Auto Trait Implementations§
impl Freeze for CommonStyle
impl RefUnwindSafe for CommonStyle
impl Send for CommonStyle
impl Sync for CommonStyle
impl Unpin for CommonStyle
impl UnsafeUnpin for CommonStyle
impl UnwindSafe for CommonStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().