Skip to main content

UiDsl

Struct UiDsl 

Source
pub struct UiDsl<D = LayoutDsl> { /* private fields */ }
Expand description

The DslBundle for bevy_ui.

Implementations§

Source§

impl<D> UiDsl<D>

Source

pub fn border_px(&mut self, pixels: u16)

Set the node’s border width, in pixels. Note that this is only visual and has no effect on the cuicui_layout algorithm.

Due to a limitation of CSS, border will be spawned as a child of the actual node entity.

This is because it would be otherwise impossible to arrange children independently of parent properties.

Source

pub fn border(&mut self, pixels: u16, color: Color)

Set the node’s border color and width.

Source

pub fn border_color(&mut self, color: Color)

Set the node’s border color.

Due to a limitation of CSS, border will be spawned as a child of the actual node entity.

This is because it would be otherwise impossible to arrange children independently of parent properties.

Source

pub fn bg(&mut self, color: Color)

Set the node’s background color.

Source

pub fn image(&mut self, image: &Handle<Image>)

Set the node’s background image.

Source

pub fn flip_x(&mut self)

If this node has a background image, flip it on its X axis.

Source

pub fn flip_y(&mut self)

If this node has a background image, flip it on its Y axis.

Source

pub fn text(&mut self, text: &str)

Set the node’s text.

Source

pub fn break_on_char(&mut self)

If this node contains text, set its break behavior to breaking on individual characters.

By default, text breaks on word.

Source

pub fn no_wrap(&mut self)

If this node contains text, only go to next line on ‘\n’ in text.

By default, text breaks on word.

Source

pub fn text_right_align(&mut self)

If this node contains text, align it to the left.

By default, text is aligned left

Source

pub fn text_center_align(&mut self)

If this node contains text, align it to the center.

By default, text is aligned left.

Source

pub fn font_size(&mut self, size: u16)

Set the text size for this node.

Source

pub fn font(&mut self, font: &Handle<Font>)

Set the text font.

Trait Implementations§

Source§

impl<D: Debug> Debug for UiDsl<D>

Source§

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

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

impl<D: Default> Default for UiDsl<D>

Source§

fn default() -> Self

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

impl<D> Deref for UiDsl<D>

Source§

type Target = D

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<D> DerefMut for UiDsl<D>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<D: DslBundle> DslBundle for UiDsl<D>

Source§

fn insert(&mut self, cmds: &mut EntityCommands<'_, '_, '_>)

Add given Bundle to the entity.
Source§

fn node( &mut self, cmds: &mut EntityCommands<'_, '_, '_>, f: impl FnOnce(&mut ChildBuilder<'_, '_, '_>), )

Spawn the entity as a parent of other entities.
Source§

impl IntoUiBundle<UiDsl> for &str

Source§

type Target = <String as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for Handle<Image>

Source§

type Target = <UiImage as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for ImageBundle

Source§

type Target = <ImageBundle as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for ImageBundle

Source§

type Target = ImageBundle

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for String

Source§

type Target = <Text as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for Text

Source§

type Target = <TextBundle as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for TextBundle

Source§

type Target = <TextBundle as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for TextBundle

Source§

type Target = TextBundle

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl IntoUiBundle<UiDsl> for UiImage

Source§

type Target = <ImageBundle as IntoUiBundle<UiDsl>>::Target

The Bundle this can be converted into.
Source§

fn into_ui_bundle(self) -> Self::Target

Convert self into an Self::Target, will be directly inserted by LayoutDsl::ui with an additional Node component. Read more
Source§

impl<D: ParseDsl> ParseDsl for UiDsl<D>

Source§

fn method(&mut self, data: MethodCtx<'_, '_, '_>) -> Result<(), Error>

Apply method named name to self. Read more

Auto Trait Implementations§

§

impl<D = LayoutDsl> !RefUnwindSafe for UiDsl<D>

§

impl<D = LayoutDsl> !UnwindSafe for UiDsl<D>

§

impl<D> Freeze for UiDsl<D>
where D: Freeze,

§

impl<D> Send for UiDsl<D>
where D: Send,

§

impl<D> Sync for UiDsl<D>
where D: Sync,

§

impl<D> Unpin for UiDsl<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for UiDsl<D>
where D: UnsafeUnpin,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>) -> Rc<dyn Any>

Convert 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)

Convert &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)

Convert &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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using data from the given World.
Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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 T
where 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSync for T
where T: Sync,

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