pub struct Style<C = Color2>where
C: Updater,{
pub left_margin: Coord,
pub right_margin: Coord,
pub top_margin: Coord,
pub bottom_margin: Coord,
pub min_width: Coord,
pub max_width: Coord,
pub min_height: Coord,
pub max_height: Coord,
pub align_numer: Coord,
pub align_denom: Coord,
pub colors: C,
}
Expand description
Alignment, margin and other settings for texts.
Fields§
§left_margin: Coord
Left margin.
right_margin: Coord
Right margin.
top_margin: Coord
Top margin.
bottom_margin: Coord
Bottom margin.
min_width: Coord
Minimum width.
max_width: Coord
Maximum width.
min_height: Coord
Minimum height.
max_height: Coord
Maximum height.
align_numer: Coord
Alignment align_numererator.
align_denom: Coord
Alignment align_denomominator.
colors: C
Foreground-background color pair.
Implementations§
source§impl<C> Style<C>where
C: Updater,
impl<C> Style<C>where C: Updater,
sourcepub fn with_colors(colors: C) -> Self
pub fn with_colors(colors: C) -> Self
Creates a style with the given colors.
sourcepub fn colors<D>(self, colors: D) -> Style<D>where
D: Updater,
pub fn colors<D>(self, colors: D) -> Style<D>where D: Updater,
Updates the style to the given color updater.
sourcepub fn left_margin(self, left_margin: Coord) -> Self
pub fn left_margin(self, left_margin: Coord) -> Self
Sets left margin.
sourcepub fn right_margin(self, right_margin: Coord) -> Self
pub fn right_margin(self, right_margin: Coord) -> Self
Sets right margin.
sourcepub fn top_margin(self, top_margin: Coord) -> Self
pub fn top_margin(self, top_margin: Coord) -> Self
Sets top margin.
sourcepub fn bottom_margin(self, bottom_margin: Coord) -> Self
pub fn bottom_margin(self, bottom_margin: Coord) -> Self
Sets bottom margin.
sourcepub fn min_height(self, min_height: Coord) -> Self
pub fn min_height(self, min_height: Coord) -> Self
Sets minimum height.
sourcepub fn max_height(self, max_height: Coord) -> Self
pub fn max_height(self, max_height: Coord) -> Self
Sets maximum height.
sourcepub fn align(self, align_numer: Coord, align_denom: Coord) -> Self
pub fn align(self, align_numer: Coord, align_denom: Coord) -> Self
Sets alignment. Numerator and align_denomominator are used such that
line\[index\] * align_numer / align_denom == screen\[index\]
sourcepub fn make_margin_below(&self) -> Vec2
pub fn make_margin_below(&self) -> Vec2
Makes a coordinate pair that contains the margin dimensions that are “less”.
sourcepub fn make_margin_above(&self) -> Vec2
pub fn make_margin_above(&self) -> Vec2
Makes a coordinate pair that contains the margin dimensions that are “greater”.
sourcepub fn make_min_size(&self) -> Vec2
pub fn make_min_size(&self) -> Vec2
Makes a coordinate pair that contains the minima sizes.
sourcepub fn make_max_size(&self) -> Vec2
pub fn make_max_size(&self) -> Vec2
Makes a coordinate pair that contains the maxima sizes.
Trait Implementations§
source§impl<C> PartialEq<Style<C>> for Style<C>where
C: Updater + PartialEq,
impl<C> PartialEq<Style<C>> for Style<C>where C: Updater + PartialEq,
impl<C> Copy for Style<C>where C: Updater + Copy,
impl<C> Eq for Style<C>where C: Updater + Eq,
impl<C> StructuralEq for Style<C>where C: Updater,
impl<C> StructuralPartialEq for Style<C>where C: Updater,
Auto Trait Implementations§
impl<C> RefUnwindSafe for Style<C>where C: RefUnwindSafe,
impl<C> Send for Style<C>where C: Send,
impl<C> Sync for Style<C>where C: Sync,
impl<C> Unpin for Style<C>where C: Unpin,
impl<C> UnwindSafe for Style<C>where C: UnwindSafe,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.