zng::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: Box<dyn UiNodeBoxed>) -> Box<dyn UiNodeBoxed>;

    // Provided methods
    fn var(&self, i: usize) -> &(dyn AnyVar + 'static) { ... }
    fn value(&self, i: usize) -> &(dyn AnyVarValue + 'static) { ... }
    fn ui_node(&self, i: usize) -> &ArcNode<Box<dyn UiNodeBoxed>> { ... }
    fn ui_node_list(&self, i: usize) -> &ArcNodeList<Box<dyn UiNodeListBoxed>> { ... }
    fn widget_handler(&self, i: usize) -> &(dyn AnyArcWidgetHandler + 'static) { ... }
}
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: Box<dyn UiNodeBoxed>) -> Box<dyn UiNodeBoxed>

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 + 'static)

Gets a InputKind::Var.

Is a BoxedVar<T>.

source

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

source

fn ui_node(&self, i: usize) -> &ArcNode<Box<dyn UiNodeBoxed>>

source

fn ui_node_list(&self, i: usize) -> &ArcNodeList<Box<dyn UiNodeListBoxed>>

source

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

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) -> &Box<dyn VarBoxed<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) -> Box<dyn VarBoxed<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: Vec<Vec<Box<dyn AnyPropertyBuildAction>>>, build_actions_when_data: Vec<Vec<Option<Arc<dyn Any + Sync + Send>>>>, ) -> 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) -> Box<dyn PropertyArgs>

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<(), Error>

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

impl Debug for Box<dyn PropertyArgs>

source§

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

Formats the value using the given formatter. Read more

Implementors§