zng_app::widget::builder

Trait PropertyArgs

source
pub trait PropertyArgs: Send + Sync {
    // Required methods
    fn clone_boxed(&self) -> Box<dyn PropertyArgs>;
    fn property(&self) -> PropertyInfo;
    fn instantiate(&self, child: BoxedUiNode) -> BoxedUiNode;

    // Provided methods
    fn var(&self, i: usize) -> &dyn AnyVar { ... }
    fn value(&self, i: usize) -> &dyn AnyVarValue { ... }
    fn ui_node(&self, i: usize) -> &ArcNode<BoxedUiNode> { ... }
    fn ui_node_list(&self, i: usize) -> &ArcNodeList<BoxedUiNodeList> { ... }
    fn widget_handler(&self, i: usize) -> &dyn AnyArcWidgetHandler { ... }
}
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 instantiate(&self, child: BoxedUiNode) -> BoxedUiNode

Create a property instance with args clone or taken.

If the property is PropertyInfo::capture the child is returned.

Provided Methods§

source

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

Gets a InputKind::Var.

Is a BoxedVar<T>.

source

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

source

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

source

fn ui_node_list(&self, i: usize) -> &ArcNodeList<BoxedUiNodeList>

source

fn widget_handler(&self, i: usize) -> &dyn AnyArcWidgetHandler

Gets a InputKind::WidgetHandler.

Is a ArcWidgetHandler<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) -> &BoxedVar<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) -> &ArcWidgetHandler<A>
where A: 'static + Clone,

Gets a strongly typed widget_handler.

Panics if the args type does not match.

source

pub fn live_debug(&self, i: usize) -> BoxedVar<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, build_actions: PropertyBuildActions, build_actions_when_data: PropertyBuildActionsWhenData, ) -> 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 copy 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§