Trait zng_app::widget::builder::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§
sourcefn clone_boxed(&self) -> Box<dyn PropertyArgs>
fn clone_boxed(&self) -> Box<dyn PropertyArgs>
Clones the arguments.
sourcefn property(&self) -> PropertyInfo
fn property(&self) -> PropertyInfo
Property info.
sourcefn instantiate(&self, child: BoxedUiNode) -> BoxedUiNode
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§
sourcefn var(&self, i: usize) -> &dyn AnyVar
fn var(&self, i: usize) -> &dyn AnyVar
Gets a InputKind::Var
.
Is a BoxedVar<T>
.
sourcefn value(&self, i: usize) -> &dyn AnyVarValue
fn value(&self, i: usize) -> &dyn AnyVarValue
Gets a InputKind::Value
.
sourcefn ui_node(&self, i: usize) -> &ArcNode<BoxedUiNode>
fn ui_node(&self, i: usize) -> &ArcNode<BoxedUiNode>
Gets a InputKind::UiNode
.
sourcefn ui_node_list(&self, i: usize) -> &ArcNodeList<BoxedUiNodeList>
fn ui_node_list(&self, i: usize) -> &ArcNodeList<BoxedUiNodeList>
Gets a InputKind::UiNodeList
.
sourcefn widget_handler(&self, i: usize) -> &dyn AnyArcWidgetHandler
fn widget_handler(&self, i: usize) -> &dyn AnyArcWidgetHandler
Gets a InputKind::WidgetHandler
.
Is a ArcWidgetHandler<A>
.
Implementations§
source§impl dyn PropertyArgs + '_
impl dyn PropertyArgs + '_
sourcepub fn id(&self) -> PropertyId
pub fn id(&self) -> PropertyId
Unique ID.
sourcepub fn downcast_value<T>(&self, i: usize) -> &Twhere
T: VarValue,
pub fn downcast_value<T>(&self, i: usize) -> &Twhere
T: VarValue,
Gets a strongly typed value
.
Panics if the type does not match.
sourcepub fn downcast_var<T>(&self, i: usize) -> &BoxedVar<T>where
T: VarValue,
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.
sourcepub fn downcast_handler<A>(&self, i: usize) -> &ArcWidgetHandler<A>where
A: 'static + Clone,
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.
sourcepub fn live_debug(&self, i: usize) -> BoxedVar<Txt>
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.
sourcepub fn debug(&self, i: usize) -> Txt
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.
sourcepub fn new_build(
&self,
build_actions: PropertyBuildActions,
build_actions_when_data: PropertyBuildActionsWhenData,
) -> Box<dyn PropertyArgs>
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
.