Struct egui::style::Spacing

source ·
pub struct Spacing {
Show 19 fields pub item_spacing: Vec2, pub window_margin: Margin, pub button_padding: Vec2, pub menu_margin: Margin, pub indent: f32, pub interact_size: Vec2, pub slider_width: f32, pub combo_width: f32, pub text_edit_width: f32, pub icon_width: f32, pub icon_width_inner: f32, pub icon_spacing: f32, pub tooltip_width: f32, pub indent_ends_with_horizontal_line: bool, pub combo_height: f32, pub scroll_bar_width: f32, pub scroll_handle_min_length: f32, pub scroll_bar_inner_margin: f32, pub scroll_bar_outer_margin: f32,
}
Expand description

Controls the sizes and distances between widgets.

Fields§

§item_spacing: Vec2

Horizontal and vertical spacing between widgets.

To add extra space between widgets, use Ui::add_space.

item_spacing is inserted after adding a widget, so to increase the spacing between widgets A and B you need to change item_spacing before adding A.

§window_margin: Margin

Horizontal and vertical margins within a window frame.

§button_padding: Vec2

Button size is text size plus this on each side

§menu_margin: Margin

Horizontal and vertical margins within a menu frame.

§indent: f32

Indent collapsing regions etc by this much.

§interact_size: Vec2

Minimum size of a DragValue, color picker button, and other small widgets. interact_size.y is the default height of button, slider, etc. Anything clickable should be (at least) this size.

§slider_width: f32

Default width of a Slider.

§combo_width: f32

Default (minimum) width of a ComboBox.

§text_edit_width: f32

Default width of a TextEdit.

§icon_width: f32

Checkboxes, radio button and collapsing headers have an icon at the start. This is the width/height of the outer part of this icon (e.g. the BOX of the checkbox).

§icon_width_inner: f32

Checkboxes, radio button and collapsing headers have an icon at the start. This is the width/height of the inner part of this icon (e.g. the check of the checkbox).

§icon_spacing: f32

Checkboxes, radio button and collapsing headers have an icon at the start. This is the spacing between the icon and the text

§tooltip_width: f32

Width of a tooltip (on_hover_ui, on_hover_text etc).

§indent_ends_with_horizontal_line: bool

End indented regions with a horizontal line

§combo_height: f32

Height of a combo-box before showing scroll bars.

§scroll_bar_width: f32§scroll_handle_min_length: f32

Make sure the scroll handle is at least this big

§scroll_bar_inner_margin: f32

Margin between contents and scroll bar.

§scroll_bar_outer_margin: f32

Margin between scroll bar and the outer container (e.g. right of a vertical scroll bar).

Implementations§

source§

impl Spacing

source

pub fn icon_rectangles(&self, rect: Rect) -> (Rect, Rect)

Returns small icon rectangle and big icon rectangle

source§

impl Spacing

source

pub fn ui(&mut self, ui: &mut Ui)

Trait Implementations§

source§

impl Clone for Spacing

source§

fn clone(&self) -> Spacing

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 Spacing

source§

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

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

impl Default for Spacing

source§

fn default() -> Self

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

impl PartialEq<Spacing> for Spacing

source§

fn eq(&self, other: &Spacing) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Spacing

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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.
source§

impl<T> SerializableAny for Twhere T: 'static + Any + Clone + Send + Sync,