[−][src]Trait kas::WidgetCore
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
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]
Self: Sized,
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.
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
.