PropertyArgs

Trait PropertyArgs 

Source
pub trait PropertyArgs: Send + Sync {
    // Required methods
    fn clone_boxed(&self) -> Box<dyn PropertyArgs>;
    fn property(&self) -> PropertyInfo;
    fn build_action(&self, wgt: &mut WidgetBuilding);
    fn instantiate(&self, child: UiNode) -> UiNode;

    // Provided methods
    fn var(&self, i: usize) -> &AnyVar { ... }
    fn value(&self, i: usize) -> &dyn AnyVarValue { ... }
    fn ui_node(&self, i: usize) -> &ArcNode { ... }
    fn handler(&self, i: usize) -> &dyn AnyArcHandler { ... }
}
Expand description

Represents a property instantiation request.

Required Methods§

Source

fn clone_boxed(&self) -> Box<dyn PropertyArgs>

Clones the arguments.

Source

fn property(&self) -> PropertyInfo

Property info.

Source

fn build_action(&self, wgt: &mut WidgetBuilding)

Apply the build action property from the args.

if the property is not PropertyInfo::build_action does nothing.

Source

fn instantiate(&self, child: UiNode) -> UiNode

Create a property instance from args clone or taken.

If the property is PropertyInfo::build_action the child is returned unchanged.

Provided Methods§

Source

fn var(&self, i: usize) -> &AnyVar

Source

fn value(&self, i: usize) -> &dyn AnyVarValue

Source

fn ui_node(&self, i: usize) -> &ArcNode

Source

fn handler(&self, i: usize) -> &dyn AnyArcHandler

Gets a InputKind::Handler.

Is an ArcHandler<A>.

Implementations§

Source§

impl dyn PropertyArgs + '_

Source

pub fn id(&self) -> PropertyId

Unique ID.

Source

pub fn downcast_value<T>(&self, i: usize) -> &T
where T: VarValue,

Gets a strongly typed value.

Panics if the type does not match.

Source

pub fn downcast_var<T>(&self, i: usize) -> Var<T>
where T: VarValue,

Gets a strongly typed var.

Panics if the variable value type does not match.

Source

pub fn downcast_handler<A>(&self, i: usize) -> &ArcHandler<A>
where A: 'static + Clone,

Gets a strongly typed handler.

Panics if the args type does not match.

Source

pub fn live_debug(&self, i: usize) -> Var<Txt>

Gets the property input as a debug variable.

If the input is a variable the returned variable will update with it, if not it is a static print.

Note that you must call this in the widget context to get the correct value.

Source

pub fn debug(&self, i: usize) -> Txt

Gets the property input current value as a debug text.

Note that you must call this in the widget context to get the correct value.

Source

pub fn new_build( &self, attributes: PropertyAttributes, attributes_when_data: PropertyAttributesWhenData, ) -> Box<dyn PropertyArgs>

Call new with the same instance info and args, but with the build_actions and build_actions_when_data.

Trait Implementations§

Source§

impl Clone for Box<dyn PropertyArgs>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for &dyn PropertyArgs

Source§

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

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

impl Debug for Box<dyn PropertyArgs>

Source§

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

Formats the value using the given formatter. Read more

Implementors§