Trait kiss_ui::widget::Widget [] [src]

pub trait Widget: IUPWidget {
    fn show(self) -> Self { ... }
    fn hide(self) -> Self { ... }
    fn set_visible(self, visible: bool) -> Self { ... }
    fn set_enabled(self, enabled: bool) -> Self { ... }
    fn set_position(self, x: i32, y: i32) -> Self { ... }
    fn get_position(self) -> (i32, i32) { ... }
    fn set_name(self, name: &str) -> Self { ... }
    fn get_name(&self) -> Option<WidgetStr> { ... }
    fn get_sibling(self) -> Option<BaseWidget> { ... }
    fn get_parent(self) -> Option<BaseWidget> { ... }
    fn get_dialog(self) -> Option<Dialog> { ... }
    fn get_size_pixels(self) -> (u32, u32) { ... }
    fn store<N: Into<String>>(self, name: N) -> Option<BaseWidget> { ... }
    fn to_base(self) -> BaseWidget { ... }
}

Trait implemented for all widget types.

Some methods may not apply to some widgets.

Provided Methods

fn show(self) -> Self

Show this widget if it was previously hidden.

Does nothing if the widget is already shown, or if the operation does not apply.

fn hide(self) -> Self

Hide this widget if it was previously visible.

Does nothing if the widget is already hidden, or if the operation does not apply.

fn set_visible(self, visible: bool) -> Self

Set the widget's visibility state.

.set_visible(true) is equivalent to calling .show(), and .set_visible(false) is equivalent to calling .hide().

Does nothing if the widget is in the same visibility state as the one being set, or if the operation does not apply.

fn set_enabled(self, enabled: bool) -> Self

Set the widget's enabled state.

When a widget is disabled, it does not react to user interaction or invoke any callbacks.

Does nothing if the widget does not support being disabled.

fn set_position(self, x: i32, y: i32) -> Self

Set the position of this widget relative to the top-left corner of its parent.

Does nothing if the widget is not renderable or not attached to a parent.

fn get_position(self) -> (i32, i32)

Get the position of this widget relative to the top-left corner of its parent.

Returns (0, 0) if the widget is not renderable, not attached to a parent, or if that is the widget's actual relative position.

fn set_name(self, name: &str) -> Self

Set the name of the widget so it can be found within its parent.

Does nothing if the widget does not support having a name.

Panics

If any WidgetStr instances from self.get_name() are still reachable.

fn get_name(&self) -> Option<WidgetStr>

Get the name of this widget, if the widget supports having a name and one is set.

fn get_sibling(self) -> Option<BaseWidget>

Get the next child in the parent after this widget, based on the order in which they were added.

Returns None if this widget is an only child or is not attached to a parent.

fn get_parent(self) -> Option<BaseWidget>

Get the parent of this widget.

Returns None if this widget has no parent.

fn get_dialog(self) -> Option<Dialog>

Get the containing dialog of this widget.

Returns None if this widget is not attached to a dialog.

fn get_size_pixels(self) -> (u32, u32)

Get the rendered size of this widget, in pixels.

Returns (0, 0) if this widget has no rendered size.

fn store<N: Into<String>>(self, name: N) -> Option<BaseWidget>

Store this widget under name, returning the previous widget stored, if any.

It may later be retrieved from any valid KISS-UI context by calling BaseWidget::load(name).

fn to_base(self) -> BaseWidget

Implementors