Trait zng::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: 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§
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: Box<dyn UiNodeBoxed>) -> Box<dyn UiNodeBoxed>
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§
sourcefn var(&self, i: usize) -> &(dyn AnyVar + 'static)
fn var(&self, i: usize) -> &(dyn AnyVar + 'static)
Gets a InputKind::Var
.
Is a BoxedVar<T>
.
sourcefn value(&self, i: usize) -> &(dyn AnyVarValue + 'static)
fn value(&self, i: usize) -> &(dyn AnyVarValue + 'static)
Gets a InputKind::Value
.
sourcefn ui_node_list(&self, i: usize) -> &ArcNodeList<Box<dyn UiNodeListBoxed>>
fn ui_node_list(&self, i: usize) -> &ArcNodeList<Box<dyn UiNodeListBoxed>>
Gets a InputKind::UiNodeList
.
sourcefn widget_handler(&self, i: usize) -> &(dyn AnyArcWidgetHandler + 'static)
fn widget_handler(&self, i: usize) -> &(dyn AnyArcWidgetHandler + 'static)
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) -> &Box<dyn VarBoxed<T>>where
T: VarValue,
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.
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) -> Box<dyn VarBoxed<Txt>>
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.
Trait Implementations§
source§impl Clone for Box<dyn PropertyArgs>
impl Clone for Box<dyn PropertyArgs>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more