Skip to main content

Widget

Struct Widget 

Source
pub struct Widget {
    pub ctx: WidgetCtx,
    pub style: Style,
    pub children: Vec<Widget>,
    pub content: Vec<Text>,
    pub pos: Vec2,
    pub id: u32,
    pub callback: fn(&mut Widget),
}

Fields§

§ctx: WidgetCtx§style: Style§children: Vec<Widget>§content: Vec<Text>§pos: Vec2§id: u32§callback: fn(&mut Widget)

Implementations§

Source§

impl Widget

Source

pub fn new() -> Self

Source

pub fn style(&mut self, style: Style)

Source

pub fn text(&mut self, text: impl Into<String>) -> &mut Text

Source

pub fn clear(&mut self, win_ctx: &mut Win)

Source

pub fn show(&mut self, widget_pos: Vec2, f_ctx: &mut Win)

Trait Implementations§

Source§

impl Default for Widget

Source§

fn default() -> Self

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

impl Stylable for Widget

Source§

fn get_style(&mut self) -> &mut Style

Source§

fn foreground(self, col: Color) -> Self

Source§

fn background(self, col: Color) -> Self

Source§

fn position(self, x: Layout, y: Layout) -> Self

Source§

fn position_x(self, x: Layout) -> Self

Source§

fn position_y(self, y: Layout) -> Self

Source§

fn size(self, x: Layout, y: Layout) -> Self

Source§

fn size_x(self, x: Layout) -> Self

Source§

fn size_y(self, y: Layout) -> Self

Source§

fn margin(self, x: Layout, y: Layout) -> Self

Source§

fn margin_x(self, x: Layout) -> Self

Source§

fn margin_y(self, y: Layout) -> Self

Source§

fn attribute(self, attr: Attr) -> Self

Source§

fn remove_attribute(self, attr: Attr) -> Self

Source§

fn border(self, border: Border) -> Self

Source§

fn color(self, cs: ColorSet) -> Self

Source§

fn align(self, alignment: Alignment) -> Self

Source§

fn set_wrap(self, wrapping: bool) -> Self

Source§

fn style(self, style: Style) -> Self

Auto Trait Implementations§

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.