Struct NodeComponent
pub struct NodeComponent(/* private fields */);Expand description
NodeComponent is the base class for all node components. Node component is an isolated piece of logic which can be attached to any node in order to add additional functionality to it. Examples of node component could be Trigger which performs specific actions when certain conditions are met or AnimationPlayer which animates specific properties of the node it is attached to and its child nodes.
Node component can only be attached to a single node at a time. After node component is detached from one node, it can be attached to any other node.
Node component starts to perform its logic after it is attached to a certain node by calling its attach() function. After node component is detached from its node by calling its detach() function it becomes inactive and stops to perform its logic.
Implementations§
§impl NodeComponent
impl NodeComponent
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
See: NAME_PROPERTY
§impl NodeComponent
impl NodeComponent
pub fn get_node(&self) -> Result<Option<Weak<Node>>, Error>
pub fn get_node(&self) -> Result<Option<Weak<Node>>, Error>
Returns the node the node component is attached to
or None if node component is not attached to a node.
pub fn get_state(&self) -> Result<NodeComponentState, Error>
pub fn get_state(&self) -> Result<NodeComponentState, Error>
Gets the state of node component indicating if component is attached to a node, detached from any node or in process of attaching/detaching.
Methods from Deref<Target = Object>§
pub fn as_ptr(&self) -> *mut ObjectWrapper
pub fn as_wrapper(&self) -> &ObjectWrapper
pub fn as_object(&self) -> &Object
pub fn as_object(&self) -> &Object
Represents any type inheriting from Object as &Object.
This is useful for comparisions when PartialEq traits failed to compare objects of
different types.
let child = screen.get_child(0)?;
let parent = child.get_parent()?.into_error(ErrorKind::ObjectNotFound)?;
// assert_eq!(screen, parent); // <- Fails to compile!
assert_eq!(screen.as_object(), parent.as_object());pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers.
Base value is affected by the following inputs where the highest entry in the list determines the base value:
- Local value set with setProperty or loaded from kzb
- Value set by a style affecting the property.
- Value defined by class metadata.
Modifiers are not applied, the highest-priority base value is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
If there is no value sources, None is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the local value of a property type.
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
Evaluates whether there are any inputs into the property value. Both value sources and modifiers are taken into account.
§Returns
Returns true if there are inputs into the property value, false otherwise.
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Removes the local value associated with the property.
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
Returns the metaclass of the dynamic type of the object.
pub fn get_domain(&self) -> Result<Domain, Error>
pub fn get_domain(&self) -> Result<Domain, Error>
Returns the domain the object belongs to.
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the flag to indicate that the property was loaded from KZB.
pub fn debug_string(&self) -> Result<String, Error>
pub fn debug_string(&self) -> Result<String, Error>
Builds a string representation of the object intended for debugging purposes.
Trait Implementations§
§impl Clone for NodeComponent
impl Clone for NodeComponent
§fn clone(&self) -> NodeComponent
fn clone(&self) -> NodeComponent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for NodeComponent
impl Debug for NodeComponent
§impl Deref for NodeComponent
impl Deref for NodeComponent
§impl Inheritable for NodeComponent
impl Inheritable for NodeComponent
§unsafe fn downcast_unchecked<T>(self) -> Twhere
T: Inherits<Self>,
unsafe fn downcast_unchecked<T>(self) -> Twhere
T: Inherits<Self>,
§unsafe fn downcast_unchecked_ref<T>(&self) -> &Twhere
T: Inherits<Self>,
unsafe fn downcast_unchecked_ref<T>(&self) -> &Twhere
T: Inherits<Self>,
§impl Inherits<NodeComponent> for ActivityCodeBehind
impl Inherits<NodeComponent> for ActivityCodeBehind
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for AnimationPlayer
impl Inherits<NodeComponent> for AnimationPlayer
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for ClickManipulatorComponent
impl Inherits<NodeComponent> for ClickManipulatorComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for CodeBehind
impl Inherits<NodeComponent> for CodeBehind
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for DataTrigger
impl Inherits<NodeComponent> for DataTrigger
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for DataTriggerComponent
impl Inherits<NodeComponent> for DataTriggerComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for FloatValueAccumulator
impl Inherits<NodeComponent> for FloatValueAccumulator
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for IntValueAccumulator
impl Inherits<NodeComponent> for IntValueAccumulator
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for KeyManipulatorComponent
impl Inherits<NodeComponent> for KeyManipulatorComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for LongPressManipulatorComponent
impl Inherits<NodeComponent> for LongPressManipulatorComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for MessageTrigger
impl Inherits<NodeComponent> for MessageTrigger
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for MultiClickManipulatorComponent
impl Inherits<NodeComponent> for MultiClickManipulatorComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for OnAttachedTrigger
impl Inherits<NodeComponent> for OnAttachedTrigger
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for OnPropertyChangedTrigger
impl Inherits<NodeComponent> for OnPropertyChangedTrigger
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for PanManipulatorComponent
impl Inherits<NodeComponent> for PanManipulatorComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for PropertyDrivenAnimationPlayer
impl Inherits<NodeComponent> for PropertyDrivenAnimationPlayer
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for PropertyTargetEasingInterpolator
impl Inherits<NodeComponent> for PropertyTargetEasingInterpolator
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for PropertyTargetInterpolator
impl Inherits<NodeComponent> for PropertyTargetInterpolator
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for TimerTrigger
impl Inherits<NodeComponent> for TimerTrigger
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for Trigger
impl Inherits<NodeComponent> for Trigger
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<NodeComponent> for ValueAccumulatorBase
impl Inherits<NodeComponent> for ValueAccumulatorBase
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Object> for NodeComponent
impl Inherits<Object> for NodeComponent
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl MetaclassConstraint for NodeComponent
impl MetaclassConstraint for NodeComponent
§fn get_static_metaclass() -> &'static Metaclass
fn get_static_metaclass() -> &'static Metaclass
§impl ObjectConstraint for NodeComponent
impl ObjectConstraint for NodeComponent
§fn downcast<T>(self) -> Result<Option<T>, Error>where
T: MetaInherits<Self>,
fn downcast<T>(self) -> Result<Option<T>, Error>where
T: MetaInherits<Self>,
§fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>where
T: MetaInherits<Self>,
fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>where
T: MetaInherits<Self>,
§fn is_a<T>(&self) -> Result<bool, Error>where
T: MetaInherits<Self>,
fn is_a<T>(&self) -> Result<bool, Error>where
T: MetaInherits<Self>,
fn downgrade(self) -> Weak<Self>
fn downgrade_ref(&self) -> Weak<Self>
fn lock(self) -> ThreadObject<Self>
fn lock_ref(&self) -> ThreadObject<Self>
§impl<T> PartialEq<T> for NodeComponentwhere
T: ObjectConstraint,
impl<T> PartialEq<T> for NodeComponentwhere
T: ObjectConstraint,
§impl<T> PartialEq<Weak<T>> for NodeComponentwhere
T: ObjectConstraint,
impl<T> PartialEq<Weak<T>> for NodeComponentwhere
T: ObjectConstraint,
impl Eq for NodeComponent
Auto Trait Implementations§
impl Freeze for NodeComponent
impl RefUnwindSafe for NodeComponent
impl !Send for NodeComponent
impl !Sync for NodeComponent
impl Unpin for NodeComponent
impl UnwindSafe for NodeComponent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)