[][src]Trait kas::WidgetCore

pub trait WidgetCore: Any + Debug {
    pub fn as_any(&self) -> &dyn Any;
pub fn as_any_mut(&mut self) -> &mut dyn Any;
pub fn core_data(&self) -> &CoreData;
pub fn widget_name(&self) -> &'static str;
pub fn as_widget(&self) -> &dyn WidgetConfig;
pub fn as_widget_mut(&mut self) -> &mut dyn WidgetConfig; pub fn id(&self) -> WidgetId { ... }
pub fn is_disabled(&self) -> bool { ... }
pub fn set_disabled(&mut self, disabled: bool) -> TkAction { ... }
pub fn with_disabled(self, disabled: bool) -> Self
    where
        Self: Sized
, { ... }
pub fn rect(&self) -> Rect { ... }
pub fn input_state(&self, mgr: &ManagerState, disabled: bool) -> InputState { ... } }

Base widget functionality

See the Widget trait for documentation of the widget family.

This trait must be implement by the derive(Widget) macro. Users must not implement this WidgetCore trait manually or may face unexpected breaking changes.

Required methods

pub fn as_any(&self) -> &dyn Any[src]

Get self as type Any

pub fn as_any_mut(&mut self) -> &mut dyn Any[src]

Get self as type Any (mutable)

pub fn core_data(&self) -> &CoreData[src]

Get direct access to the CoreData providing property storage.

pub fn widget_name(&self) -> &'static str[src]

Get the name of the widget struct

pub fn as_widget(&self) -> &dyn WidgetConfig[src]

Erase type

pub fn as_widget_mut(&mut self) -> &mut dyn WidgetConfig[src]

Erase type

Loading content...

Provided methods

pub fn id(&self) -> WidgetId[src]

Get the widget's numeric identifier

pub fn is_disabled(&self) -> bool[src]

Get whether the widget is disabled

pub fn set_disabled(&mut self, disabled: bool) -> TkAction[src]

Set the disabled state of a widget

If disabled, a widget should not respond to input and should appear greyed out.

The disabled status is inherited by children: events should not be passed to them, and they should also be drawn greyed out.

pub fn with_disabled(self, disabled: bool) -> Self where
    Self: Sized
[src]

Set disabled state (chaining)

This is identical to WidgetCore::set_disabled, but can be called in chaining fashion. Example:

use kas::{WidgetCore, widget::MenuEntry};
let entry = MenuEntry::new("Disabled Item", ()).with_disabled(true);

pub fn rect(&self) -> Rect[src]

Get the widget's region, relative to its parent.

pub fn input_state(&self, mgr: &ManagerState, disabled: bool) -> InputState[src]

Construct InputState

The disabled flag is inherited from parents. InputState::disabled will be true if either disabled or self.is_disabled() are true.

The error state defaults to false since most widgets don't support this.

Loading content...

Implementations

impl dyn WidgetCore[src]

pub fn is<T: Any>(&self) -> bool[src]

Forwards to the method defined on the type Any.

pub fn downcast_ref<T: Any>(&self) -> Option<&T>[src]

Forwards to the method defined on the type Any.

pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>[src]

Forwards to the method defined on the type Any.

Implementations on Foreign Types

impl<M: 'static> WidgetCore for Box<dyn Widget<Msg = M>>[src]

impl<M: 'static> WidgetCore for Box<dyn Menu<Msg = M>>[src]

Loading content...

Implementors

impl WidgetCore for DragHandle[src]

impl WidgetCore for Filler[src]

impl<D: Directional> WidgetCore for ScrollBar<D>[src]

impl<D: Directional, W: Widget> WidgetCore for List<D, W>[src]

impl<D: Directional, W: Widget> WidgetCore for Splitter<D, W>[src]

impl<D: Directional, W: Menu> WidgetCore for MenuBar<D, W>[src]

impl<D: Directional, W: Menu> WidgetCore for SubMenu<D, W>[src]

impl<G: 'static> WidgetCore for EditBox<G>[src]

impl<M: 'static> WidgetCore for CheckBox<M>[src]

impl<M: 'static> WidgetCore for CheckBoxBare<M>[src]

impl<M: 'static> WidgetCore for MenuToggle<M>[src]

impl<M: 'static> WidgetCore for RadioBox<M>[src]

impl<M: 'static> WidgetCore for RadioBoxBare<M>[src]

impl<M: Clone + Debug + 'static> WidgetCore for ComboBox<M>[src]

impl<M: Clone + Debug + 'static> WidgetCore for MenuEntry<M>[src]

impl<M: Clone + Debug + 'static> WidgetCore for TextButton<M>[src]

impl<M: Debug + 'static> WidgetCore for Separator<M>[src]

impl<T: FormattableText + 'static> WidgetCore for Label<T>[src]

impl<T: FormattableText + 'static> WidgetCore for MessageBox<T>[src]

impl<T: SliderType, D: Directional> WidgetCore for Slider<T, D>[src]

impl<W: Widget + 'static> WidgetCore for Window<W>[src]

impl<W: Widget> WidgetCore for Frame<W>[src]

impl<W: Widget> WidgetCore for MenuFrame<W>[src]

impl<W: Widget> WidgetCore for ScrollRegion<W>[src]

impl<W: Widget> WidgetCore for Stack<W>[src]

Loading content...