Struct Activity2D
pub struct Activity2D(/* private fields */);Expand description
An Activity is a part of application UI that is responsible for a task. For example, a media player application can have Activity nodes, such as radio, music player, and AUX. However, an Activity can also be a smaller task, such as an Activity for the popup volume indicator that appears only when the user changes the volume in a media player. An Activity can be visual, but does not have to be. For example, an Activity that is visual can instantiate a prefab to show a popup window, while an Activity that is not visual can be music playback which plays music in the background regardless of other Activity nodes.
§Application UI structure and navigation
The Activity, Data-Driven Exclusive Activity Host, Exclusive Activity Host, and Parallel Activity Host nodes together enable you to create the UI that user can navigate in your application. You implement the navigation as a reaction to user interaction or changes to data coming to the application, by activating and deactivating Activity nodes to switch application views and to show different application layers, such as popup windows. That way you can control which parts of your application UI the user can see and interact with.
Use the Activity, Data-Driven Exclusive Activity Host, Exclusive Activity Host, and Parallel Activity Host nodes to form the navigation graph. Activity nodes define the content elements and the Activity Host nodes define the navigation pattern in your application UI. In each Activity Host node, use Activity nodes to create UI content within applications that an Activity Host represents. When you use these nodes in your application, you navigate application UI by sending to the Activity Host node the address of the Activity node to which you want to navigate. For example, with Activity Host and Activity nodes you can organize your UI to show a different views in your application, such as media player, contacts, and phone view, and to show content in popup windows.
Use Activity Host nodes to activate and deactivate Activity nodes:
- When an Activity node is active, the Activity prefab is attached to the node tree, is visible, and the user can interact with its content.
- When an Activity node is inactive, the Activity prefab is not attached to the node tree, is not visible, and the user cannot interact with its content.
The Activity and Activity Host nodes inherit from the ContentLayout class to lay out their content like a Content Layout node. See ContentLayout2D and ContentLayout3D.
See ParallelActivityHost2D, ParallelActivityHost3D, ExclusiveActivityHost2D, and ExclusiveActivityHost3D.
§Status management of Activity nodes
Each Activity node has the Status property that indicates the status of that Activity. When an Activity becomes active or inactive, the Status property changes and in your application you can react to these changes. You can use the Is Initially Active property to set which Activity node in an Exclusive Activity Host or Parallel Activity Host node is active at application startup. However, only one Activity node can be active at a time in a Data-Driven Exclusive Activity Host and Exclusive Activity Host nodes.
When one Activity node (Activity A) is active and you decide to activate another Activity node (Activity B), this is how the Activity status changes:
- Activity A goes to exclusive deactivation and, if content of the Activity B prefab is not yet loaded, Activity Host node gets a request to load the Activity B prefab and asynchronously load the content of the Activity B prefab.
- When the Activity B prefab is loaded, Activity A goes to parallel deactivation. Once Kanzi loads the content of the Activity B prefab, Kanzi instantiates the Activity B prefab and goes into parallel activation.
- Activity A becomes inactive. Kanzi virtualizes the properties of Activity A.
- Activity B goes to exclusive activation.
§Programming
See Code behind.
§Creating transitions between Activity nodes
You can create transitions for status changes of Activity nodes.
To create transitions between Activity nodes:
- Create a state manager and set its Controller Property to the Status property.
- In Activity nodes set the Status Manager property to the state manager that you created in the previous step.
- Create the states that map to the different statuses of Activity nodes.
- In the state manager define the transitions that you want to use.
§Data and logic programming of Activity nodes
For each Activity node you can define properties that are specific to that Activity node. For example, Activity node for a music player can switch music on and off, or change the volume level.
When you create a property for an Activity node, set the namespace of that property to ActivityProperty. You can create properties with int, bool, float, and enum data types. If you use code behind for an Activity, Kanzi adds the properties of that Activity to the code behind.
The values of these properties implement the state machine and logic of your Kanzi application, which is why Kanzi preserves the values of these properties even when an Activity is virtual. When Kanzi virtualizes an Activity, it serializes the properties of that Activity and when Kanzi devirtualizes that Activity, it deserializes the state of that Activity and restores its property values.
§Code behind
Code behind is a workflow where you associate code with an instance of an Activity instead of a type. In Kanzi Studio in the Activity Browser window, you can generate a code behind stub for any Activity node. This stub is associated with that particular Activity and has access to the properties of that Activity. In code behind you can write code that you can associate with the view or controller parts of the model-view-controller pattern. For example, you can:
- React to Activity status changes.
- Connect to a remote service when the Activity is activated and save data and disconnect when an Activity is deactivated.
- Install Kanzi command handlers and define their implementations, such as increase the volume when the user presses a button.
- Implement complex UI interaction, such as drag-and-drop of data between UI elements.
- React to changes of status of an Activity.
§Virtualization
The main goal of Activity virtualization is to manage memory consumption in your application efficiently. Since the navigation graph of the entire application can be large, keeping the UI and assets loaded in memory at all times is rarely feasible.
When you activate an Activity, its Activity Host dynamically loads the prefab and asynchronously loads the required resources. On deactivation, the Activity Host detaches the Activity from the node tree and deletes the Activity instance. However, the acquired resources remain in the memory.
To release the resources of deactivated Activities, call ResourceManager::purge().
§Controlling virtualization
By default, when you deactivate an Activity, Kanzi serializes the values of Activity properties for that Activity and its child Activities. Besides the values of Activity properties that you add, this includes information about the focus and activation state of Activities. Keep in mind that Kanzi does not serialize the runtime state of other, non-Activity properties.
When you activate a deactivated Activity, Kanzi restores the values of Activity properties for that Activity and its child Activities. When you disable virtualization, Kanzi does not preserve the values of Activity properties.
You can also reset the serialized state of an Activity, before activating or after deactivating that Activity. By default, Kanzi restores the serialized state.
§Activity persistence
By default, when you deactivate an Activity, Kanzi detaches the Activity from the node tree and deletes the Activity instance. You can set Kanzi to preserve the Activity instance when the Activity is deactivated. When you activate such an Activity again, Kanzi restores the Activity node in the same state as it was before deactivation, even if you disable virtualization for this Activity. This way you can skip Activity instantiation when you activate the Activity again.
Implementations§
§impl Activity2D
impl Activity2D
Methods from Deref<Target = Node2D>§
pub fn get_aspect_ratio(&self) -> Result<f32, Error>
pub fn get_aspect_ratio(&self) -> Result<f32, Error>
pub fn set_aspect_ratio(&self, value: f32) -> Result<(), Error>
pub fn set_aspect_ratio(&self, value: f32) -> Result<(), Error>
pub fn get_caching_mode(&self) -> Result<CachingMode, Error>
pub fn get_caching_mode(&self) -> Result<CachingMode, Error>
pub fn set_caching_mode(&self, value: CachingMode) -> Result<(), Error>
pub fn set_caching_mode(&self, value: CachingMode) -> Result<(), Error>
pub fn get_cache_valid(&self) -> Result<bool, Error>
pub fn get_cache_valid(&self) -> Result<bool, Error>
See: CACHE_VALID_PROPERTY
pub fn set_cache_valid(&self, value: bool) -> Result<(), Error>
pub fn set_cache_valid(&self, value: bool) -> Result<(), Error>
See: CACHE_VALID_PROPERTY
pub fn get_layout_transformation(&self) -> Result<SRTValue2D, Error>
pub fn get_layout_transformation(&self) -> Result<SRTValue2D, Error>
pub fn set_layout_transformation(&self, value: SRTValue2D) -> Result<(), Error>
pub fn set_layout_transformation(&self, value: SRTValue2D) -> Result<(), Error>
pub fn get_perspective_transformation(&self) -> Result<SRTValue3D, Error>
pub fn get_perspective_transformation(&self) -> Result<SRTValue3D, Error>
pub fn set_perspective_transformation(
&self,
value: SRTValue3D,
) -> Result<(), Error>
pub fn set_perspective_transformation( &self, value: SRTValue3D, ) -> Result<(), Error>
pub fn get_perspective_transformation_mode(
&self,
) -> Result<PerspectiveTransformationMode, Error>
pub fn get_perspective_transformation_mode( &self, ) -> Result<PerspectiveTransformationMode, Error>
pub fn set_perspective_transformation_mode(
&self,
value: PerspectiveTransformationMode,
) -> Result<(), Error>
pub fn set_perspective_transformation_mode( &self, value: PerspectiveTransformationMode, ) -> Result<(), Error>
pub fn get_perspective_transformation_fov(&self) -> Result<f32, Error>
pub fn get_perspective_transformation_fov(&self) -> Result<f32, Error>
pub fn set_perspective_transformation_fov(
&self,
value: f32,
) -> Result<(), Error>
pub fn set_perspective_transformation_fov( &self, value: f32, ) -> Result<(), Error>
pub fn get_perspective_transformation_pivot(&self) -> Result<Vector3, Error>
pub fn get_perspective_transformation_pivot(&self) -> Result<Vector3, Error>
pub fn set_perspective_transformation_pivot(
&self,
value: Vector3,
) -> Result<(), Error>
pub fn set_perspective_transformation_pivot( &self, value: Vector3, ) -> Result<(), Error>
pub fn get_perspective_transformation_origin(&self) -> Result<Vector3, Error>
pub fn get_perspective_transformation_origin(&self) -> Result<Vector3, Error>
pub fn set_perspective_transformation_origin(
&self,
value: Vector3,
) -> Result<(), Error>
pub fn set_perspective_transformation_origin( &self, value: Vector3, ) -> Result<(), Error>
pub fn get_render_transformation_origin(&self) -> Result<Vector2, Error>
pub fn get_render_transformation_origin(&self) -> Result<Vector2, Error>
pub fn set_render_transformation_origin(
&self,
value: Vector2,
) -> Result<(), Error>
pub fn set_render_transformation_origin( &self, value: Vector2, ) -> Result<(), Error>
pub fn get_render_transformation(&self) -> Result<SRTValue2D, Error>
pub fn get_render_transformation(&self) -> Result<SRTValue2D, Error>
pub fn set_render_transformation(&self, value: SRTValue2D) -> Result<(), Error>
pub fn set_render_transformation(&self, value: SRTValue2D) -> Result<(), Error>
pub fn get_snap_to_pixel(&self) -> Result<bool, Error>
pub fn get_snap_to_pixel(&self) -> Result<bool, Error>
pub fn set_snap_to_pixel(&self, value: bool) -> Result<(), Error>
pub fn set_snap_to_pixel(&self, value: bool) -> Result<(), Error>
pub fn get_force_composition(&self) -> Result<bool, Error>
pub fn get_force_composition(&self) -> Result<bool, Error>
pub fn set_force_composition(&self, value: bool) -> Result<(), Error>
pub fn set_force_composition(&self, value: bool) -> Result<(), Error>
pub fn get_foreground_hint(&self) -> Result<ForegroundHint, Error>
pub fn get_foreground_hint(&self) -> Result<ForegroundHint, Error>
pub fn set_foreground_hint(&self, value: ForegroundHint) -> Result<(), Error>
pub fn set_foreground_hint(&self, value: ForegroundHint) -> Result<(), Error>
pub fn get_offscreen_rendering(&self) -> Result<bool, Error>
pub fn get_offscreen_rendering(&self) -> Result<bool, Error>
pub fn set_offscreen_rendering(&self, value: bool) -> Result<(), Error>
pub fn set_offscreen_rendering(&self, value: bool) -> Result<(), Error>
pub fn get_disable_render_target_clear(&self) -> Result<bool, Error>
pub fn get_disable_render_target_clear(&self) -> Result<bool, Error>
pub fn set_disable_render_target_clear(&self, value: bool) -> Result<(), Error>
pub fn set_disable_render_target_clear(&self, value: bool) -> Result<(), Error>
pub fn get_pixel_format(&self) -> Result<PixelFormat, Error>
pub fn get_pixel_format(&self) -> Result<PixelFormat, Error>
pub fn set_pixel_format(&self, value: PixelFormat) -> Result<(), Error>
pub fn set_pixel_format(&self, value: PixelFormat) -> Result<(), Error>
pub fn get_multisample_level(&self) -> Result<MultisampleCount, Error>
pub fn get_multisample_level(&self) -> Result<MultisampleCount, Error>
pub fn set_multisample_level(
&self,
value: MultisampleCount,
) -> Result<(), Error>
pub fn set_multisample_level( &self, value: MultisampleCount, ) -> Result<(), Error>
pub fn get_render_self(&self) -> Result<bool, Error>
pub fn get_render_self(&self) -> Result<bool, Error>
See: RENDER_SELF_PROPERTY
pub fn set_render_self(&self, value: bool) -> Result<(), Error>
pub fn set_render_self(&self, value: bool) -> Result<(), Error>
See: RENDER_SELF_PROPERTY
pub fn get_render_target_minimum_width(&self) -> Result<f32, Error>
pub fn get_render_target_minimum_width(&self) -> Result<f32, Error>
pub fn set_render_target_minimum_width(&self, value: f32) -> Result<(), Error>
pub fn set_render_target_minimum_width(&self, value: f32) -> Result<(), Error>
pub fn get_render_target_minimum_height(&self) -> Result<f32, Error>
pub fn get_render_target_minimum_height(&self) -> Result<f32, Error>
pub fn set_render_target_minimum_height(&self, value: f32) -> Result<(), Error>
pub fn set_render_target_minimum_height(&self, value: f32) -> Result<(), Error>
pub fn get_render_target_reallocation_limit(&self) -> Result<f32, Error>
pub fn get_render_target_reallocation_limit(&self) -> Result<f32, Error>
pub fn set_render_target_reallocation_limit(
&self,
value: f32,
) -> Result<(), Error>
pub fn set_render_target_reallocation_limit( &self, value: f32, ) -> Result<(), Error>
pub fn get_effect(&self) -> Result<Option<Weak<Resource>>, Error>
pub fn get_effect(&self) -> Result<Option<Weak<Resource>>, Error>
See: EFFECT_PROPERTY
pub fn set_effect(&self, value: Option<&Resource>) -> Result<(), Error>
pub fn set_effect(&self, value: Option<&Resource>) -> Result<(), Error>
See: EFFECT_PROPERTY
pub fn has_child(&self, child: &Node) -> Result<bool, Error>
pub fn has_child(&self, child: &Node) -> Result<bool, Error>
Returns whether the given node is a child of this node.
pub fn get_child_count(&self) -> Result<u64, Error>
pub fn get_child_count(&self) -> Result<u64, Error>
Gets the number of children of the node.
pub fn get_child(&self, index: u64) -> Result<Weak<Node2D>, Error>
pub fn get_child(&self, index: u64) -> Result<Weak<Node2D>, Error>
Returns a child from given index from object node.
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn get_child_unchecked(
&self,
index: u64,
) -> Result<Weak<Node2D>, Error>
pub unsafe fn get_child_unchecked( &self, index: u64, ) -> Result<Weak<Node2D>, Error>
Returns a child from given index from object node.
§Safety
The caller must ensure that index < self.get_child_count().
pub fn get_child_index(&self, child: &Node) -> Result<u64, Error>
pub fn get_child_index(&self, child: &Node) -> Result<u64, Error>
Returns the index of a child in an object node.
§Error
Returns an INVALID_ARGUMENT error if the provided Node2D is not a child of self.
pub unsafe fn get_child_index_unchecked(
&self,
child: &Node,
) -> Result<u64, Error>
pub unsafe fn get_child_index_unchecked( &self, child: &Node, ) -> Result<u64, Error>
Returns the index of a child in an object node.
§Safety
The caller must ensure that self.has_child(child).
pub fn add_child(&self, child: &Node2D) -> Result<(), Error>
pub fn add_child(&self, child: &Node2D) -> Result<(), Error>
Adds a child node.
Adding a 3D node node as a child of a 2D node is only allowed when adding a scene to a viewport. Screens can have only one child which is a 2D node.
pub fn insert_child(&self, index: u64, child: &Node2D) -> Result<(), Error>
pub fn insert_child(&self, index: u64, child: &Node2D) -> Result<(), Error>
Adds a child node for object node to given index.
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn insert_child_unchecked(
&self,
index: u64,
child: &Node2D,
) -> Result<(), Error>
pub unsafe fn insert_child_unchecked( &self, index: u64, child: &Node2D, ) -> Result<(), Error>
Adds a child node for object node to given index.
§Safety
The caller must ensure that index <= self.get_child_count().
pub fn remove_child(&self, child: &Node2D) -> Result<(), Error>
pub fn remove_child(&self, child: &Node2D) -> Result<(), Error>
Removes child node.
§Errors
Returns an INVALID_ARGUMENT error if the provided Node2D is not a child of self.
pub unsafe fn remove_child_unchecked(&self, child: &Node2D) -> Result<(), Error>
pub unsafe fn remove_child_unchecked(&self, child: &Node2D) -> Result<(), Error>
pub fn remove_child_at_index(&self, index: u64) -> Result<(), Error>
pub fn remove_child_at_index(&self, index: u64) -> Result<(), Error>
Removes child node at specified index.
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn remove_child_at_index_unchecked(
&self,
index: u64,
) -> Result<(), Error>
pub unsafe fn remove_child_at_index_unchecked( &self, index: u64, ) -> Result<(), Error>
Removes child node at specified index.
§Safety
The caller must ensure that index < self.get_child_count().
pub fn remove_all_children(&self) -> Result<(), Error>
pub fn remove_all_children(&self) -> Result<(), Error>
Removes all child nodes.
pub fn get_world_transform(&self) -> Result<Matrix3x3, Error>
pub fn get_world_transform(&self) -> Result<Matrix3x3, Error>
Gets the world transformation matrix.
pub fn move_to_back(&self) -> Result<(), Error>
pub fn move_to_back(&self) -> Result<(), Error>
Repositions the node to the beginning of its parent’s children, so that it is drawn first.
pub fn move_to_front(&self) -> Result<(), Error>
pub fn move_to_front(&self) -> Result<(), Error>
Repositions the node to the end of its parent’s children, so that it is drawn last.
pub fn get_desired_size(&self) -> Result<Vector2, Error>
pub fn get_desired_size(&self) -> Result<Vector2, Error>
Gets the desired size of a node.
pub fn set_desired_size(&self, value: Vector2) -> Result<(), Error>
pub fn set_desired_size(&self, value: Vector2) -> Result<(), Error>
Sets the desired size of a node.
pub fn get_allocated_size(&self) -> Result<Vector2, Error>
pub fn get_allocated_size(&self) -> Result<Vector2, Error>
Gets the allocated size of a node.
pub fn set_allocated_size(&self, value: Vector2) -> Result<(), Error>
pub fn set_allocated_size(&self, value: Vector2) -> Result<(), Error>
Sets the allocated size of a node.
pub fn get_actual_size(&self) -> Result<Vector2, Error>
pub fn get_actual_size(&self) -> Result<Vector2, Error>
Gets the actual size of a node.
pub fn set_actual_size(&self, value: Vector2) -> Result<(), Error>
pub fn set_actual_size(&self, value: Vector2) -> Result<(), Error>
Sets the actual size of a node.
pub fn get_arrange_transform(&self) -> Result<Matrix3x3, Error>
pub fn get_arrange_transform(&self) -> Result<Matrix3x3, Error>
Gets the arrange transform.
pub fn set_arrange_transform(&self, value: Matrix3x3) -> Result<(), Error>
pub fn set_arrange_transform(&self, value: Matrix3x3) -> Result<(), Error>
Sets the arrange transform. If the layout transform differs from the existing transform, calling this function invalidates the arrange.
pub fn layout(&self) -> Result<(), Error>
pub fn layout(&self) -> Result<(), Error>
Does a layout pass starting from this node and iterating recursively all of its children. Does a layout pass with no root transformation (identity).
Measure pass only descends up to nodes marked for requiring measure and then propagates upwards for all nodes that were changed. After measure, all nodes marked for requiring arrange and all their children are arranged.
The actual size of a node is not known before layout. You can call layout manually to determine the actual sizes of nodes. Before calling layout, the node must have allocated size set to limit node area to anything less than infinity. Normal layout process sets allocated size to current composition size.
pub fn measure(
&self,
available_size: Option<Vector2>,
handle_stretch: bool,
) -> Result<bool, Error>
pub fn measure( &self, available_size: Option<Vector2>, handle_stretch: bool, ) -> Result<bool, Error>
pub fn get_children_iterator(&self) -> Result<Node2DChildrenIterator, Error>
pub fn get_children_iterator(&self) -> Result<Node2DChildrenIterator, Error>
Gets an iterator over 2D node children.
pub fn get_children_rev_iterator(&self) -> Result<Node2DChildrenIterator, Error>
pub fn get_children_rev_iterator(&self) -> Result<Node2DChildrenIterator, Error>
Gets a reverse iterator over 2D node children.
Methods from Deref<Target = Node>§
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
See: NAME_PROPERTY
pub fn get_path(&self) -> Result<KanziString, Error>
pub fn get_path(&self) -> Result<KanziString, Error>
See: PATH_PROPERTY
pub fn get_locale(&self) -> Result<KanziString, Error>
pub fn get_locale(&self) -> Result<KanziString, Error>
See: LOCALE_PROPERTY
pub fn set_locale(&self, value: impl AsRef<KanziStr>) -> Result<(), Error>
pub fn set_locale(&self, value: impl AsRef<KanziStr>) -> Result<(), Error>
See: LOCALE_PROPERTY
pub fn get_width(&self) -> Result<f32, Error>
pub fn get_width(&self) -> Result<f32, Error>
See: WIDTH_PROPERTY
pub fn get_height(&self) -> Result<f32, Error>
pub fn get_height(&self) -> Result<f32, Error>
See: HEIGHT_PROPERTY
pub fn set_height(&self, value: f32) -> Result<(), Error>
pub fn set_height(&self, value: f32) -> Result<(), Error>
See: HEIGHT_PROPERTY
pub fn get_depth(&self) -> Result<f32, Error>
pub fn get_depth(&self) -> Result<f32, Error>
See: DEPTH_PROPERTY
pub fn get_actual_width(&self) -> Result<f32, Error>
pub fn get_actual_width(&self) -> Result<f32, Error>
pub fn set_actual_width(&self, value: f32) -> Result<(), Error>
pub fn set_actual_width(&self, value: f32) -> Result<(), Error>
pub fn get_actual_height(&self) -> Result<f32, Error>
pub fn get_actual_height(&self) -> Result<f32, Error>
pub fn set_actual_height(&self, value: f32) -> Result<(), Error>
pub fn set_actual_height(&self, value: f32) -> Result<(), Error>
pub fn get_actual_depth(&self) -> Result<f32, Error>
pub fn get_actual_depth(&self) -> Result<f32, Error>
pub fn set_actual_depth(&self, value: f32) -> Result<(), Error>
pub fn set_actual_depth(&self, value: f32) -> Result<(), Error>
pub fn get_horizontal_alignment(&self) -> Result<HorizontalAlignment, Error>
pub fn get_horizontal_alignment(&self) -> Result<HorizontalAlignment, Error>
pub fn set_horizontal_alignment(
&self,
value: HorizontalAlignment,
) -> Result<(), Error>
pub fn set_horizontal_alignment( &self, value: HorizontalAlignment, ) -> Result<(), Error>
pub fn get_vertical_alignment(&self) -> Result<VerticalAlignment, Error>
pub fn get_vertical_alignment(&self) -> Result<VerticalAlignment, Error>
pub fn set_vertical_alignment(
&self,
value: VerticalAlignment,
) -> Result<(), Error>
pub fn set_vertical_alignment( &self, value: VerticalAlignment, ) -> Result<(), Error>
pub fn get_depth_alignment(&self) -> Result<DepthAlignment, Error>
pub fn get_depth_alignment(&self) -> Result<DepthAlignment, Error>
pub fn set_depth_alignment(&self, value: DepthAlignment) -> Result<(), Error>
pub fn set_depth_alignment(&self, value: DepthAlignment) -> Result<(), Error>
pub fn get_horizontal_margin(&self) -> Result<Vector2, Error>
pub fn get_horizontal_margin(&self) -> Result<Vector2, Error>
pub fn set_horizontal_margin(&self, value: Vector2) -> Result<(), Error>
pub fn set_horizontal_margin(&self, value: Vector2) -> Result<(), Error>
pub fn get_vertical_margin(&self) -> Result<Vector2, Error>
pub fn get_vertical_margin(&self) -> Result<Vector2, Error>
pub fn set_vertical_margin(&self, value: Vector2) -> Result<(), Error>
pub fn set_vertical_margin(&self, value: Vector2) -> Result<(), Error>
pub fn get_depth_margin(&self) -> Result<Vector2, Error>
pub fn get_depth_margin(&self) -> Result<Vector2, Error>
pub fn set_depth_margin(&self, value: Vector2) -> Result<(), Error>
pub fn set_depth_margin(&self, value: Vector2) -> Result<(), Error>
pub fn get_hit_testable(&self) -> Result<bool, Error>
pub fn get_hit_testable(&self) -> Result<bool, Error>
pub fn set_hit_testable(&self, value: bool) -> Result<(), Error>
pub fn set_hit_testable(&self, value: bool) -> Result<(), Error>
pub fn get_hit_testable_container(&self) -> Result<bool, Error>
pub fn get_hit_testable_container(&self) -> Result<bool, Error>
pub fn set_hit_testable_container(&self, value: bool) -> Result<(), Error>
pub fn set_hit_testable_container(&self, value: bool) -> Result<(), Error>
pub fn get_visible(&self) -> Result<bool, Error>
pub fn get_visible(&self) -> Result<bool, Error>
See: VISIBLE_PROPERTY
pub fn set_visible(&self, value: bool) -> Result<(), Error>
pub fn set_visible(&self, value: bool) -> Result<(), Error>
See: VISIBLE_PROPERTY
pub fn get_enabled(&self) -> Result<bool, Error>
pub fn get_enabled(&self) -> Result<bool, Error>
See: ENABLED_PROPERTY
pub fn set_enabled(&self, value: bool) -> Result<(), Error>
pub fn set_enabled(&self, value: bool) -> Result<(), Error>
See: ENABLED_PROPERTY
pub fn get_effectively_enabled(&self) -> Result<bool, Error>
pub fn get_effectively_enabled(&self) -> Result<bool, Error>
pub fn set_effectively_enabled(&self, value: bool) -> Result<(), Error>
pub fn set_effectively_enabled(&self, value: bool) -> Result<(), Error>
pub fn get_focusable(&self) -> Result<bool, Error>
pub fn get_focusable(&self) -> Result<bool, Error>
See: FOCUSABLE_PROPERTY
pub fn set_focusable(&self, value: bool) -> Result<(), Error>
pub fn set_focusable(&self, value: bool) -> Result<(), Error>
See: FOCUSABLE_PROPERTY
pub fn get_focused(&self) -> Result<bool, Error>
pub fn get_focused(&self) -> Result<bool, Error>
See: FOCUSED_PROPERTY
pub fn set_focused(&self, value: bool) -> Result<(), Error>
pub fn set_focused(&self, value: bool) -> Result<(), Error>
See: FOCUSED_PROPERTY
pub fn get_focus_state(&self) -> Result<FocusState, Error>
pub fn get_focus_state(&self) -> Result<FocusState, Error>
See: FOCUS_STATE_PROPERTY
pub fn set_focus_state(&self, value: FocusState) -> Result<(), Error>
pub fn set_focus_state(&self, value: FocusState) -> Result<(), Error>
See: FOCUS_STATE_PROPERTY
pub fn get_font_family(&self) -> Result<Option<Weak<Resource>>, Error>
pub fn get_font_family(&self) -> Result<Option<Weak<Resource>>, Error>
See: FONT_FAMILY_PROPERTY
pub fn set_font_family(&self, value: Option<&Resource>) -> Result<(), Error>
pub fn set_font_family(&self, value: Option<&Resource>) -> Result<(), Error>
See: FONT_FAMILY_PROPERTY
pub fn get_visible_amount_in_parent(&self) -> Result<f32, Error>
pub fn get_visible_amount_in_parent(&self) -> Result<f32, Error>
pub fn set_visible_amount_in_parent(&self, value: f32) -> Result<(), Error>
pub fn set_visible_amount_in_parent(&self, value: f32) -> Result<(), Error>
pub fn get_clip_children(&self) -> Result<bool, Error>
pub fn get_clip_children(&self) -> Result<bool, Error>
pub fn set_clip_children(&self, value: bool) -> Result<(), Error>
pub fn set_clip_children(&self, value: bool) -> Result<(), Error>
pub fn get_content_stretch(&self) -> Result<ContentStretch, Error>
pub fn get_content_stretch(&self) -> Result<ContentStretch, Error>
pub fn set_content_stretch(&self, value: ContentStretch) -> Result<(), Error>
pub fn set_content_stretch(&self, value: ContentStretch) -> Result<(), Error>
pub fn get_opacity(&self) -> Result<f32, Error>
pub fn get_opacity(&self) -> Result<f32, Error>
See: OPACITY_PROPERTY
pub fn set_opacity(&self, value: f32) -> Result<(), Error>
pub fn set_opacity(&self, value: f32) -> Result<(), Error>
See: OPACITY_PROPERTY
pub fn get_hover(&self) -> Result<bool, Error>
pub fn get_hover(&self) -> Result<bool, Error>
See: HOVER_PROPERTY
pub fn get_projection_2d_to_3d_scale(&self) -> Result<f32, Error>
pub fn get_projection_2d_to_3d_scale(&self) -> Result<f32, Error>
pub fn set_projection_2d_to_3d_scale(&self, value: f32) -> Result<(), Error>
pub fn set_projection_2d_to_3d_scale(&self, value: f32) -> Result<(), Error>
pub fn get_created_from_kzb(&self) -> Result<bool, Error>
pub fn get_created_from_kzb(&self) -> Result<bool, Error>
pub fn set_created_from_kzb(&self, value: bool) -> Result<(), Error>
pub fn set_created_from_kzb(&self, value: bool) -> Result<(), Error>
pub fn set_binding(
&self,
binding: &AbstractBinding,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding( &self, binding: &AbstractBinding, ) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding1<T>(
&self,
binding: &AbstractBinding,
property_type: &PropertyType<T>,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding1<T>( &self, binding: &AbstractBinding, property_type: &PropertyType<T>, ) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding2<T>(
&self,
binding: &AbstractBinding,
property_type: &PropertyType<T>,
property_field: PropertyField,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding2<T>( &self, binding: &AbstractBinding, property_type: &PropertyType<T>, property_field: PropertyField, ) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding_with_owner<T>(
&self,
binding: &AbstractBinding,
owner_object: &Object,
property_type: &PropertyType<T>,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding_with_owner<T>( &self, binding: &AbstractBinding, owner_object: &Object, property_type: &PropertyType<T>, ) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding_with_owner1<T>(
&self,
binding: &AbstractBinding,
owner_object: &Object,
property_type: &PropertyType<T>,
property_field: PropertyField,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_binding_with_owner1<T>( &self, binding: &AbstractBinding, owner_object: &Object, property_type: &PropertyType<T>, property_field: PropertyField, ) -> Result<AbstractBindingRuntime, Error>
pub fn set_modifier_binding<T>(
&self,
binding: &AbstractBinding,
property_type: &PropertyType<T>,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_modifier_binding<T>( &self, binding: &AbstractBinding, property_type: &PropertyType<T>, ) -> Result<AbstractBindingRuntime, Error>
Wrapper for setting a modifier binding.
As opposed to value source created by Self::set_binding, creates a property modifier binding.
Whole property is used.
§Arguments
binding- Binding to set.property_type- Target property type.
§Returns
Binding runtime handler created for the binding.
pub fn set_modifier_binding1<T>(
&self,
binding: &AbstractBinding,
property_type: &PropertyType<T>,
property_field: PropertyField,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_modifier_binding1<T>( &self, binding: &AbstractBinding, property_type: &PropertyType<T>, property_field: PropertyField, ) -> Result<AbstractBindingRuntime, Error>
Wrapper for setting a modifier binding.
As opposed to value source created by Self::set_binding, creates a property modifier binding.
§Arguments
binding- Binding to set.property_type- Target property type.field- Property field.
§Returns
Binding runtime handler created for the binding.
pub fn set_modifier_binding_with_owner<T>(
&self,
binding: &AbstractBinding,
owner_object: &Object,
property_type: &PropertyType<T>,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_modifier_binding_with_owner<T>( &self, binding: &AbstractBinding, owner_object: &Object, property_type: &PropertyType<T>, ) -> Result<AbstractBindingRuntime, Error>
Wrapper for setting a modifier binding.
As opposed to value source created by Self::set_binding, creates a property modifier binding.
§Arguments
binding- Binding to set.owner- Owner shared pointer for the binding.property_type- Target property type.
§Returns
Binding runtime handler created for the binding.
pub fn set_modifier_binding_with_owner1<T>(
&self,
binding: &AbstractBinding,
owner_object: &Object,
property_type: &PropertyType<T>,
property_field: PropertyField,
) -> Result<AbstractBindingRuntime, Error>
pub fn set_modifier_binding_with_owner1<T>( &self, binding: &AbstractBinding, owner_object: &Object, property_type: &PropertyType<T>, property_field: PropertyField, ) -> Result<AbstractBindingRuntime, Error>
Wrapper for setting a modifier binding.
As opposed to value source created by Self::set_binding, creates a property modifier binding.
§Arguments
binding- Binding to set.owner- Owner shared pointer for the binding.property_type- Target property type.field- Property field.
§Returns
Binding runtime handler created for the binding.
pub fn remove_binding(
&self,
binding_runtime: &AbstractBindingRuntime,
) -> Result<(), Error>
pub fn remove_binding( &self, binding_runtime: &AbstractBindingRuntime, ) -> Result<(), Error>
pub fn remove_bindings_with_owner(
&self,
owner_object: &Object,
) -> Result<(), Error>
pub fn remove_bindings_with_owner( &self, owner_object: &Object, ) -> Result<(), Error>
Removes all binding runtimes with the specified owner.
§Arguments
owner- Owner of the binding runtime.
pub fn add_input_manipulator(
&self,
input_manipulator: &InputManipulator,
) -> Result<(), Error>
pub fn add_input_manipulator( &self, input_manipulator: &InputManipulator, ) -> Result<(), Error>
Transfers the ownership and attaches an input manipulator to an object node.
§Arguments
input_manipulator- The input manipulator to add.
pub fn remove_input_manipulator(
&self,
input_manipulator: &InputManipulator,
) -> Result<(), Error>
pub fn remove_input_manipulator( &self, input_manipulator: &InputManipulator, ) -> Result<(), Error>
Removes the ownership and detaches an input manipulator from an object node.
§Arguments
input_manipulator- The input manipulator to remove.
pub fn get_resource_dictionary(
&self,
) -> Result<Option<Weak<ResourceDictionary>>, Error>
pub fn get_resource_dictionary( &self, ) -> Result<Option<Weak<ResourceDictionary>>, Error>
If a node has a resource dictionary, returns the resource dictionary of that node.
§Returns
The resource dictionary of the node. If None is returned, the node does not have a resource dictionary.
pub fn acquire_resource_dictionary(
&self,
) -> Result<Weak<ResourceDictionary>, Error>
pub fn acquire_resource_dictionary( &self, ) -> Result<Weak<ResourceDictionary>, Error>
Gets a resource dictionary of a node. If a resource dictionary does not exist, the function creates it.
§Returns
The resource dictionary of the node.
pub fn notify_resource_dictionary_modified(&self) -> Result<(), Error>
pub fn notify_resource_dictionary_modified(&self) -> Result<(), Error>
Forces the re-evaluation of resource IDs in a node tree.
If you modify a resource dictionary of a node that is already attached, you can use this function to update the resource properties.
Note that you need to use this function only if you modify the dictionary directly through
Self::get_resource_dictionary or Self::acquire_resource_dictionary.
If you use other Node class functions like Self::add_resource or Self::set_resource_dictionary,
you do not need to call this function.
pub fn set_resource_dictionary(
&self,
resource_dictionary: &ResourceDictionary,
) -> Result<(), Error>
pub fn set_resource_dictionary( &self, resource_dictionary: &ResourceDictionary, ) -> Result<(), Error>
Replaces the resource dictionary of a node. Updates all the resource references of the child nodes.
§Arguments
resource_dictionary- The resource dictionary.
pub fn add_resource_dictionary(
&self,
resource_dictionary: &ResourceDictionary,
) -> Result<(), Error>
pub fn add_resource_dictionary( &self, resource_dictionary: &ResourceDictionary, ) -> Result<(), Error>
Adds a nested resource dictionary to the resource dictionary of a node. Updates all the resource references of the child nodes.
§Arguments
resource_dictionary- The nested resource dictionary.
pub fn is_named(&self, name: impl AsRef<KanziStr>) -> Result<bool, Error>
pub fn is_effectively_visible(&self) -> Result<bool, Error>
pub fn is_effectively_visible(&self) -> Result<bool, Error>
Returns whether a node and its ancestor nodes are visible.
pub fn is_effectively_focusable(&self) -> Result<bool, Error>
pub fn is_effectively_focusable(&self) -> Result<bool, Error>
Returns whether a node is focusable. A node is focusable when it is a focus scope node
or has FOCUSABLE_PROPERTY attached and set to true, or both.
pub fn is_initialized(&self) -> Result<bool, Error>
pub fn is_initialized(&self) -> Result<bool, Error>
Returns true if initialize() has been called, false otherwise.
pub fn is_attached(&self) -> Result<bool, Error>
pub fn is_attached(&self) -> Result<bool, Error>
Returns true if the node is attached to a screen or one of its descendants.
pub fn is_attaching(&self) -> Result<bool, Error>
pub fn is_attaching(&self) -> Result<bool, Error>
Returns true if node is in the process of attaching, false otherwise.
pub fn is_detaching(&self) -> Result<bool, Error>
pub fn is_detaching(&self) -> Result<bool, Error>
Returns true if the node currently detaching.
pub unsafe fn attach_recursive(&self) -> Result<(), Error>
pub unsafe fn attach_recursive(&self) -> Result<(), Error>
Attaches an object node and its children recursively.
§Safety
The caller must ensure that Self::detach_recursive is called before an object is destroyed.
pub unsafe fn detach_recursive(&self) -> Result<(), Error>
pub unsafe fn detach_recursive(&self) -> Result<(), Error>
Detaches a node and its descendants.
§Safety
The caller must ensure that Self::attach_recursive was called on an object.
pub fn try_set_focus(&self) -> Result<Option<Weak<Node>>, Error>
pub fn try_set_focus(&self) -> Result<Option<Weak<Node>>, Error>
Tries to move the focus to this node. If this node is a focus scope node, this method tries to focus the
preserved focus of the focus scope, or tries to focus on the first focusable descendant node of this node.
This is a convenience function of the FocusManager::trySetFocus(), that uses the node as target node.
§Returns
If this method successfully moved focus, returns this node or a descendant node of this node.
If None is return, this method did not move focus.
pub fn lookup_node<T>(
&self,
name: impl AsRef<KanziStr>,
) -> Result<Option<Weak<T>>, Error>where
T: MetaInherits<Node>,
pub fn lookup_node<T>(
&self,
name: impl AsRef<KanziStr>,
) -> Result<Option<Weak<T>>, Error>where
T: MetaInherits<Node>,
Returns a node of specified type by looking it up with specified path or alias.
If None is returned, couldn’t find a node with a given name or node was found but of a different type
pub fn lookup_node_raw(
&self,
name: impl AsRef<KanziStr>,
) -> Result<Option<Weak<Node>>, Error>
pub fn lookup_node_raw( &self, name: impl AsRef<KanziStr>, ) -> Result<Option<Weak<Node>>, Error>
Returns a node of specified type by looking it up with specified path or alias.
If None is returned, couldn’t find a node with a given name.
pub fn get_abstract_child_count(&self) -> Result<u64, Error>
pub fn add_abstract_child(&self, child: &Node) -> Result<bool, Error>
pub fn get_abstract_child_index(&self, child: &Node) -> Result<u64, Error>
pub fn get_abstract_child(&self, index: u64) -> Result<Weak<Node>, Error>
pub fn get_abstract_child(&self, index: u64) -> Result<Weak<Node>, Error>
§Errors
Returns an INDEX_OUT_OF_BOUNDS error if the index is out of bounds.
pub unsafe fn get_abstract_child_unchecked(
&self,
index: u64,
) -> Result<Weak<Node>, Error>
pub unsafe fn get_abstract_child_unchecked( &self, index: u64, ) -> Result<Weak<Node>, Error>
§Safety
The caller must ensure that index < self.get_abstract_child_count().
pub fn remove_abstract_child(&self, child: &Node) -> Result<bool, Error>
pub fn add_message_handler<T>(
&self,
message_type: &MessageType<T>,
closure: impl FnMut(T) -> Result<(), Error> + 'static,
) -> Result<MessageSubscriptionToken, Error>where
T: MessageArgumentsConstraint,
pub fn add_message_handler<T>(
&self,
message_type: &MessageType<T>,
closure: impl FnMut(T) -> Result<(), Error> + 'static,
) -> Result<MessageSubscriptionToken, Error>where
T: MessageArgumentsConstraint,
Adds a message handler where the handler is a function. The handler is invoked when a message of messageType is signaled in the node the handler is added to.
pub fn add_message_handler_raw<T>(
&self,
message_type: &MessageType<T>,
closure: impl Handler,
) -> Result<MessageSubscriptionToken, Error>
pub fn add_message_handler_raw<T>( &self, message_type: &MessageType<T>, closure: impl Handler, ) -> Result<MessageSubscriptionToken, Error>
Adds a message handler where the handler is a function. The handler is invoked when a message of messageType is signaled in the node the handler is added to.
pub fn add_message_handler_from_source<T>(
&self,
message_type: &MessageType<T>,
message_source_filter: &Object,
closure: impl Handler,
) -> Result<MessageSubscriptionToken, Error>
pub fn add_message_handler_from_source<T>( &self, message_type: &MessageType<T>, message_source_filter: &Object, closure: impl Handler, ) -> Result<MessageSubscriptionToken, Error>
Adds a message handler where the handler is a function and you explicitly define the accepted source. The handler is invoked when a message of messageType bubbles through the node to which you add the handler, but only when you dispatch it from the given source node.
pub fn add_message_filter<T>(
&self,
message_type: &MessageType<T>,
closure: impl Handler,
) -> Result<MessageSubscriptionToken, Error>
pub fn add_message_filter<T>( &self, message_type: &MessageType<T>, closure: impl Handler, ) -> Result<MessageSubscriptionToken, Error>
Adds a message filter where the filter is a function. The filter is invoked when a message of messageType bubbles through the node the filter is added to.
pub fn add_tunneling_message_handler<T>(
&self,
message_type: &MessageType<T>,
message_source_filter: &Object,
closure: impl Handler,
) -> Result<MessageSubscriptionToken, Error>
pub fn add_tunneling_message_handler<T>( &self, message_type: &MessageType<T>, message_source_filter: &Object, closure: impl Handler, ) -> Result<MessageSubscriptionToken, Error>
Adds a message handler where the handler is a function and you explicitly define the accepted source. The handler is invoked when a message of messageType tunnels through the node to which you add the handler, but only when you dispatch it from the given source node.
pub fn add_tunneling_message_filter<T>(
&self,
message_type: &MessageType<T>,
closure: impl Handler,
) -> Result<MessageSubscriptionToken, Error>
pub fn add_tunneling_message_filter<T>( &self, message_type: &MessageType<T>, closure: impl Handler, ) -> Result<MessageSubscriptionToken, Error>
Adds a message filter where the filter is a function. The filter is invoked when a message of messageType tunnels through the node to which you add this filter.
pub fn remove_message_handler(
&self,
token: &MessageSubscriptionToken,
) -> Result<(), Error>
pub fn remove_message_handler( &self, token: &MessageSubscriptionToken, ) -> Result<(), Error>
Removes a message subscription.
pub fn dispatch_message<T>(
&self,
message_type: &MessageType<T>,
args: &T,
) -> Result<(), Error>where
T: MessageArgumentsConstraint,
pub fn dispatch_message<T>(
&self,
message_type: &MessageType<T>,
args: &T,
) -> Result<(), Error>where
T: MessageArgumentsConstraint,
Dispatches a message from this node with specified arguments.
pub fn dispatch_message_raw<T>(
&self,
message_type: &MessageType<T>,
args: &MessageArguments,
) -> Result<(), Error>
pub fn dispatch_message_raw<T>( &self, message_type: &MessageType<T>, args: &MessageArguments, ) -> Result<(), Error>
Dispatches a message from this node with specified arguments. No type verification is done
pub fn add_resource(
&self,
resource_id: &ResourceId,
resource_url: impl AsRef<KanziStr>,
) -> Result<(), Error>
pub fn add_resource( &self, resource_id: &ResourceId, resource_url: impl AsRef<KanziStr>, ) -> Result<(), Error>
Adds a resource manager resource to an object node.
If resource_id already exists in object, removes the existing entry.
pub fn remove_resource(&self, resource_id: &ResourceId) -> Result<(), Error>
pub fn remove_resource(&self, resource_id: &ResourceId) -> Result<(), Error>
Removes a resource with given ID from object node resource dictionary.
Does not do anything if resource_id was not found.
pub fn contains_resource(&self, resource_id: &ResourceId) -> Result<bool, Error>
pub fn contains_resource(&self, resource_id: &ResourceId) -> Result<bool, Error>
Returns if object node resource dictionary contains the resource with given ID. Resource can be any type: style, alias or resource manager resource.
pub fn find_resource_url(
&self,
resource_id: &ResourceId,
) -> Result<Option<KanziString>, Error>
pub fn find_resource_url( &self, resource_id: &ResourceId, ) -> Result<Option<KanziString>, Error>
Tries to find Resource URL for Resource ID from this node.
pub fn acquire_resource(
&self,
resource_id: &ResourceId,
) -> Result<Resource, Error>
pub fn acquire_resource( &self, resource_id: &ResourceId, ) -> Result<Resource, Error>
Acquires a resource from the node or the node’s closest ancestor having the resource id in the resource dictionary.
§Arguments
resource_id- Name of the resource.
pub fn try_acquire_resource(
&self,
resource_id: &ResourceId,
) -> Result<Option<Resource>, Error>
pub fn try_acquire_resource( &self, resource_id: &ResourceId, ) -> Result<Option<Resource>, Error>
Acquires a resource from the node or the node’s closest ancestor having the resource id in the resource dictionary.
§Arguments
resource_id- Name of the resource.
pub fn acquire_resource_async(
&self,
resource_id: &ResourceId,
closure: impl AcquireFinishedCallback,
) -> Result<Option<ResourceAcquireTask>, Error>
pub fn acquire_resource_async( &self, resource_id: &ResourceId, closure: impl AcquireFinishedCallback, ) -> Result<Option<ResourceAcquireTask>, Error>
pub fn add_anonymous_resource(&self, resource: &Resource) -> Result<(), Error>
pub fn add_anonymous_resource(&self, resource: &Resource) -> Result<(), Error>
Adds anonymous resource (such as style) for object node resources.
pub fn remove_anonymous_resource(
&self,
resource: &Resource,
) -> Result<(), Error>
pub fn remove_anonymous_resource( &self, resource: &Resource, ) -> Result<(), Error>
Removes anonymous resource from object node resources.
pub fn add_node_component(
&self,
node_component: &NodeComponent,
) -> Result<(), Error>
pub fn add_node_component( &self, node_component: &NodeComponent, ) -> Result<(), Error>
Transfers the ownership of a node component to an object node.
pub fn add_node_component_with_owner(
&self,
node_component: &NodeComponent,
owner: Option<&Object>,
) -> Result<(), Error>
pub fn add_node_component_with_owner( &self, node_component: &NodeComponent, owner: Option<&Object>, ) -> Result<(), Error>
Transfers the ownership of a node component to an object node and sets the owner of the node component.
pub fn remove_node_component(
&self,
node_component: &NodeComponent,
) -> Result<(), Error>
pub fn remove_node_component( &self, node_component: &NodeComponent, ) -> Result<(), Error>
Removes the ownership of a node component from an object node.
pub fn remove_node_component_with_owner(
&self,
owner: Option<&Object>,
) -> Result<(), Error>
pub fn remove_node_component_with_owner( &self, owner: Option<&Object>, ) -> Result<(), Error>
Removes all bindings with the specified owner.
pub fn lookup_node_component(
&self,
name: impl AsRef<KanziStr>,
) -> Result<Option<Weak<NodeComponent>>, Error>
pub fn lookup_node_component( &self, name: impl AsRef<KanziStr>, ) -> Result<Option<Weak<NodeComponent>>, Error>
Returns a node component of specified type by looking it up with specified name. If name is not specified, then the first anonymous node component is returned.
pub fn get_node_component_iterator(
&self,
) -> Result<NodeComponentIterator, Error>
pub fn get_node_component_iterator( &self, ) -> Result<NodeComponentIterator, Error>
Gets the node component iterator.
pub fn get_node_components(&self) -> Result<Vec<Weak<NodeComponent>>, Error>
pub fn get_node_components(&self) -> Result<Vec<Weak<NodeComponent>>, Error>
Gets all node components.
pub fn get_change_flags(&self) -> Result<i32, Error>
pub fn get_change_flags(&self) -> Result<i32, Error>
Gets current change flags.
pub fn get_child_change_flags(&self) -> Result<i32, Error>
pub fn get_child_change_flags(&self) -> Result<i32, Error>
Gets current child change flags.
pub fn set_change_flag(&self, flag: i32) -> Result<(), Error>
pub fn set_change_flag(&self, flag: i32) -> Result<(), Error>
Sets a change flag.
pub fn clear_change_flag(&self, flag: i32) -> Result<(), Error>
pub fn clear_change_flag(&self, flag: i32) -> Result<(), Error>
Clears a change flag.
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 Activity2D
impl Clone for Activity2D
§fn clone(&self) -> Activity2D
fn clone(&self) -> Activity2D
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl ConcreteObjectConstraint for Activity2D
impl ConcreteObjectConstraint for Activity2D
§impl Debug for Activity2D
impl Debug for Activity2D
§impl Deref for Activity2D
impl Deref for Activity2D
§type Target = ContentLayout2D
type Target = ContentLayout2D
§fn deref(&self) -> &<Activity2D as Deref>::Target
fn deref(&self) -> &<Activity2D as Deref>::Target
§impl IActivityConcept for Activity2D
impl IActivityConcept for Activity2D
§fn get_status(&self) -> Result<ActivityStatus, Error>
fn get_status(&self) -> Result<ActivityStatus, Error>
STATUS_PROPERTY§fn set_status(&self, value: ActivityStatus) -> Result<(), Error>
fn set_status(&self, value: ActivityStatus) -> Result<(), Error>
STATUS_PROPERTY§fn get_dummy_state_manager(&self) -> Result<f32, Error>
fn get_dummy_state_manager(&self) -> Result<f32, Error>
§fn get_activated_by_activation_modifier(&self) -> Result<bool, Error>
fn get_activated_by_activation_modifier(&self) -> Result<bool, Error>
§fn get_save_last_focused_node(&self) -> Result<bool, Error>
fn get_save_last_focused_node(&self) -> Result<bool, Error>
§fn get_keep_activity_alive(&self) -> Result<KeepAlivePolicy, Error>
fn get_keep_activity_alive(&self) -> Result<KeepAlivePolicy, Error>
§fn set_keep_activity_alive(&self, value: KeepAlivePolicy) -> Result<(), Error>
fn set_keep_activity_alive(&self, value: KeepAlivePolicy) -> Result<(), Error>
§impl IActivityElement for Activity2D
impl IActivityElement for Activity2D
§fn get_attached(&self) -> Result<bool, Error>
fn get_attached(&self) -> Result<bool, Error>
ATTACHED_PROPERTY§fn set_attached(&self, value: bool) -> Result<(), Error>
fn set_attached(&self, value: bool) -> Result<(), Error>
ATTACHED_PROPERTY