Struct gpui2::Style

source ·
pub struct Style {
Show 30 fields pub display: Display, pub visibility: Visibility, pub overflow: Point<Overflow>, pub scrollbar_width: f32, pub position: Position, pub inset: Edges<Length>, pub size: Size<Length>, pub min_size: Size<Length>, pub max_size: Size<Length>, pub aspect_ratio: Option<f32>, pub margin: Edges<Length>, pub padding: Edges<DefiniteLength>, pub border_widths: Edges<AbsoluteLength>, pub align_items: Option<AlignItems>, pub align_self: Option<AlignSelf>, pub align_content: Option<AlignContent>, pub justify_content: Option<JustifyContent>, pub gap: Size<DefiniteLength>, pub flex_direction: FlexDirection, pub flex_wrap: FlexWrap, pub flex_basis: Length, pub flex_grow: f32, pub flex_shrink: f32, pub background: Option<Fill>, pub border_color: Option<Hsla>, pub corner_radii: Corners<AbsoluteLength>, pub box_shadow: SmallVec<[BoxShadow; 2]>, pub text: TextStyleRefinement, pub mouse_cursor: Option<CursorStyle>, pub z_index: Option<u32>,
}

Fields§

§display: Display

What layout strategy should be used?

§visibility: Visibility

Should the element be painted on screen?

§overflow: Point<Overflow>

How children overflowing their container should affect layout

§scrollbar_width: f32

How much space (in points) should be reserved for the scrollbars of Overflow::Scroll and Overflow::Auto nodes.

§position: Position

What should the position value of this struct use as a base offset?

§inset: Edges<Length>

How should the position of this element be tweaked relative to the layout defined?

§size: Size<Length>

Sets the initial size of the item

§min_size: Size<Length>

Controls the minimum size of the item

§max_size: Size<Length>

Controls the maximum size of the item

§aspect_ratio: Option<f32>

Sets the preferred aspect ratio for the item. The ratio is calculated as width divided by height.

§margin: Edges<Length>

How large should the margin be on each side?

§padding: Edges<DefiniteLength>

How large should the padding be on each side?

§border_widths: Edges<AbsoluteLength>

How large should the border be on each side?

§align_items: Option<AlignItems>

How this node’s children aligned in the cross/block axis?

§align_self: Option<AlignSelf>

How this node should be aligned in the cross/block axis. Falls back to the parents AlignItems if not set

§align_content: Option<AlignContent>

How should content contained within this item be aligned in the cross/block axis

§justify_content: Option<JustifyContent>

How should contained within this item be aligned in the main/inline axis

§gap: Size<DefiniteLength>

How large should the gaps between items in a flex container be?

§flex_direction: FlexDirection

Which direction does the main axis flow in?

§flex_wrap: FlexWrap

Should elements wrap, or stay in a single line?

§flex_basis: Length

Sets the initial main axis size of the item

§flex_grow: f32

The relative rate at which this item grows when it is expanding to fill space, 0.0 is the default value, and this value must be positive.

§flex_shrink: f32

The relative rate at which this item shrinks when it is contracting to fit into space, 1.0 is the default value, and this value must be positive.

§background: Option<Fill>

The fill color of this element

§border_color: Option<Hsla>

The border color of this element

§corner_radii: Corners<AbsoluteLength>

The radius of the corners of this element

§box_shadow: SmallVec<[BoxShadow; 2]>

Box Shadow of the element

§text: TextStyleRefinement

TEXT

§mouse_cursor: Option<CursorStyle>

The mouse cursor style shown when the mouse pointer is over an element.

§z_index: Option<u32>

Implementations§

source§

impl Style

source

pub fn text_style(&self) -> Option<&TextStyleRefinement>

source

pub fn overflow_mask( &self, bounds: Bounds<Pixels> ) -> Option<ContentMask<Pixels>>

source

pub fn apply_text_style<C, F, R>(&self, cx: &mut C, f: F) -> Rwhere C: BorrowAppContext, F: FnOnce(&mut C) -> R,

source

pub fn apply_overflow<C, F, R>( &self, bounds: Bounds<Pixels>, cx: &mut C, f: F ) -> Rwhere C: BorrowWindow, F: FnOnce(&mut C) -> R,

Apply overflow to content mask

source

pub fn paint(&self, bounds: Bounds<Pixels>, cx: &mut WindowContext<'_>)

Paints the background of an element styled with this style.

Trait Implementations§

source§

impl Clone for Style

source§

fn clone(&self) -> Style

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Style

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Style

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<StyleRefinement> for Stylewhere Option<Display>: Clone, Option<Visibility>: Clone, PointRefinement<Overflow>: Clone, Option<f32>: Clone, Option<Position>: Clone, EdgesRefinement<Length>: Clone, SizeRefinement<Length>: Clone, EdgesRefinement<DefiniteLength>: Clone, EdgesRefinement<AbsoluteLength>: Clone, Option<AlignItems>: Clone, Option<AlignSelf>: Clone, Option<AlignContent>: Clone, Option<JustifyContent>: Clone, SizeRefinement<DefiniteLength>: Clone, Option<FlexDirection>: Clone, Option<FlexWrap>: Clone, Option<Length>: Clone, Option<Fill>: Clone, Option<Hsla>: Clone, CornersRefinement<AbsoluteLength>: Clone, Option<SmallVec<[BoxShadow; 2]>>: Clone, Option<TextStyleRefinement>: Clone, Option<CursorStyle>: Clone, Option<u32>: Clone,

source§

fn from(value: StyleRefinement) -> Self

Converts to this type from the input type.
source§

impl Refineable for Stylewhere Option<Display>: Clone, Option<Visibility>: Clone, PointRefinement<Overflow>: Clone, Option<f32>: Clone, Option<Position>: Clone, EdgesRefinement<Length>: Clone, SizeRefinement<Length>: Clone, EdgesRefinement<DefiniteLength>: Clone, EdgesRefinement<AbsoluteLength>: Clone, Option<AlignItems>: Clone, Option<AlignSelf>: Clone, Option<AlignContent>: Clone, Option<JustifyContent>: Clone, SizeRefinement<DefiniteLength>: Clone, Option<FlexDirection>: Clone, Option<FlexWrap>: Clone, Option<Length>: Clone, Option<Fill>: Clone, Option<Hsla>: Clone, CornersRefinement<AbsoluteLength>: Clone, Option<SmallVec<[BoxShadow; 2]>>: Clone, Option<TextStyleRefinement>: Clone, Option<CursorStyle>: Clone, Option<u32>: Clone,

§

type Refinement = StyleRefinement

source§

fn refine(&mut self, refinement: &Self::Refinement)

source§

fn refined(self, refinement: Self::Refinement) -> Self

§

fn from_cascade(cascade: &Cascade<Self>) -> Selfwhere Self: Default + Sized,

Auto Trait Implementations§

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnwindSafe for Style

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more