Visual
struct · ferroui-base · v0.5.0
struct Visual
Base class for controls that provides rendering and related visual properties.
The visual class represents elements that have a visual on-screen
representation and stores all the information needed for a renderer to
render the control. To traverse the visual tree, use the methods in the
visual_tree module.
Members
calculate_distance_from_ancestorcalculate_distance_from_rootfind_common_visual_ancestorget_visual_ancestorsget_self_and_visual_ancestorsfind_ancestor_of_typefind_ancestor_of_type_wherefind_descendant_of_typefind_descendant_of_type_whereget_transformed_boundsget_visual_atget_visual_at_filteredget_visual_at_geometryget_visual_at_geometry_filteredget_visuals_atget_visuals_at_filteredget_visuals_at_geometryget_visuals_at_geometry_filteredget_visual_childrenget_visual_descendantsget_self_and_visual_descendantsget_visual_parentget_visual_parent_of_typeget_visual_rootget_layout_rootget_layout_managerget_input_rootget_platform_settingsis_visual_ancestor_ofsort_by_z_indexpoint_to_clientpoint_to_screentransform_to_visualtranslate_pointrotationset_rotationrotation_axisset_rotation_axisscaleset_scalecenter_pointset_center_pointtransform_matrixset_transform_matrixopacity_transitionset_opacity_transitionrotation_transitionset_rotation_transitionscale_transitionset_scale_transitiontranslation_transitionset_translation_transitionshadowset_shadowtheme_shadow_castertheme_shadow_visualset_theme_shadow_delegated_to_childset_theme_shadow_popupTYPEto_refrenderon_attached_to_visual_tree_coreon_detached_from_visual_tree_coreon_attached_to_visual_treeon_detached_from_visual_treeon_visual_parent_changedbypass_flow_direction_policiesinvalidate_mirror_transformclip_to_bounds_radiuscustom_hit_testcustom_hit_test_geometryensure_initialized_for_visual_brushdetach_from_compositorsynchronize_composition_child_visualssynchronize_composition_propertiesrequires_composition_visualbounds_propertyclip_to_bounds_propertyclip_propertyshadow_propertytranslation_propertycache_mode_propertyeffect_propertyopacity_mask_propertyrender_transform_propertyrender_transform_origin_propertyis_visible_propertyopacity_propertyhas_mirror_transform_propertyflow_direction_propertyvisual_parent_propertyz_index_propertyconstructnewattached_to_visual_treedetached_from_visual_treeis_effectively_visible_changedboundsset_boundsclip_to_boundsset_clip_to_boundsclipset_clipcache_modeset_cache_modeeffectset_effectopacity_maskset_opacity_maskrender_transformset_render_transformrender_transform_originset_render_transform_originis_effectively_visibleis_visibleset_is_visibleopacityset_opacitymanipulation_transformset_manipulation_transformhas_mirror_transformset_has_mirror_transformflow_directionset_flow_directionget_flow_directionset_flow_direction_onz_indexset_z_indexvisual_childrenvisual_children_countvisual_children_snapshotvisual_roothas_composition_visualhas_composition_itemcomposition_visuals_on_demandset_composition_visuals_on_demandchild_composition_visualset_child_composition_visuallightshas_lightslight_target_idstranslationset_translationis_hidden_by_compositionadd_composition_hide_requestremove_composition_hide_requestis_render_suppressedadd_render_suppression_requestremove_render_suppression_requestis_shown_by_compositionadd_composition_show_requestremove_composition_show_requestcomposition_layer_visualset_composition_layer_visualhas_non_uniform_z_index_childrenis_attached_to_visual_treevisual_parentinvalidate_visualinvalidate_composition_propertiesaffects_render
calculate_distance_from_ancestor
fn calculate_distance_from_ancestor(self: &Self, ancestor: Option<&Visual>) -> Option<usize>
Calculates the distance from a visual's ancestor.
Returns the number of steps from the visual to the ancestor, or
None if this visual is not a descendent of ancestor. With no
ancestor given, never matches and returns None.
calculate_distance_from_root
fn calculate_distance_from_root(self: &Self) -> usize
Calculates the distance from a visual's root.
find_common_visual_ancestor
fn find_common_visual_ancestor(self: &Self, target: &Visual) -> Option<Ref<Visual>>
Tries to get the first common ancestor of two visuals.
get_visual_ancestors
fn get_visual_ancestors(self: &Self) -> VisualAncestors
Enumerates the ancestors of the visual in the visual tree.
get_self_and_visual_ancestors
fn get_self_and_visual_ancestors(self: &Self) -> VisualAncestors
Enumerates the visual and its ancestors in the visual tree.
find_ancestor_of_type
fn find_ancestor_of_type<T: ObjectType>(self: &Self, include_self: bool) -> Option<Ref<T>>
Finds the first ancestor of class T, optionally starting with the
visual itself.
find_ancestor_of_type_where
fn find_ancestor_of_type_where<T: ObjectType>(self: &Self, include_self: bool, predicate: impl Fn(&T) -> bool) -> Option<Ref<T>>
Finds the first ancestor of class T that matches a predicate,
optionally starting with the visual itself.
find_descendant_of_type
fn find_descendant_of_type<T: ObjectType>(self: &Self, include_self: bool) -> Option<Ref<T>>
Finds the first descendant of class T (depth first), optionally
starting with the visual itself.
find_descendant_of_type_where
fn find_descendant_of_type_where<T: ObjectType>(self: &Self, include_self: bool, predicate: impl Fn(&T) -> bool) -> Option<Ref<T>>
Finds the first descendant of class T that matches a predicate
(depth first), optionally starting with the visual itself.
get_transformed_bounds
fn get_transformed_bounds(self: &Self) -> Option<TransformedBounds>
Gets the bounds of the visual in the coordinate space of its root,
with the clip applied by its ancestors. Returns None if the visual
or one of its ancestors is invisible.
get_visual_at
fn get_visual_at(self: &Self, p: Point) -> Option<Ref<Visual>>
Gets the first visible visual at a point, in the coordinates of this visual.
get_visual_at_filtered
fn get_visual_at_filtered(self: &Self, p: Point, filter: &dyn Fn(&Visual) -> bool) -> Option<Ref<Visual>>
Gets the first visual at a point, in the coordinates of this visual.
If filter returns false for a visual then the visual and all its
descendants are excluded from the results.
get_visual_at_geometry
fn get_visual_at_geometry(self: &Self, geometry: &Geometry) -> Option<GeometryHitTestResult>
Gets the first visible visual intersecting a geometry, in the coordinates of this visual, with the details of the intersection.
get_visual_at_geometry_filtered
fn get_visual_at_geometry_filtered(self: &Self, geometry: &Geometry, filter: &dyn Fn(&Visual) -> bool) -> Option<GeometryHitTestResult>
Gets the first visual intersecting a geometry, in the coordinates of this visual, with the details of the intersection.
If filter returns false for a visual then the visual and all its
descendants are excluded from the results.
get_visuals_at
fn get_visuals_at(self: &Self, p: Point) -> Vec<Ref<Visual>>
Enumerates the visible visuals at a point, in the coordinates of this visual, topmost first.
get_visuals_at_filtered
fn get_visuals_at_filtered(self: &Self, p: Point, filter: &dyn Fn(&Visual) -> bool) -> Vec<Ref<Visual>>
Enumerates the visuals at a point, in the coordinates of this visual, topmost first.
If filter returns false for a visual then the visual and all its
descendants are excluded from the results.
get_visuals_at_geometry
fn get_visuals_at_geometry(self: &Self, geometry: &Geometry) -> Vec<GeometryHitTestResult>
Enumerates the visible visuals intersecting a geometry, in the coordinates of this visual, topmost first, with the details of the intersections.
get_visuals_at_geometry_filtered
fn get_visuals_at_geometry_filtered(self: &Self, geometry: &Geometry, filter: &dyn Fn(&Visual) -> bool) -> Vec<GeometryHitTestResult>
Enumerates the visuals intersecting a geometry, in the coordinates of this visual, topmost first, with the details of the intersections.
If filter returns false for a visual then the visual and all its
descendants are excluded from the results.
get_visual_children
fn get_visual_children(self: &Self) -> Rc<Vec<Ref<Visual>>>
Gets a snapshot of the visual children of the visual.
get_visual_descendants
fn get_visual_descendants(self: &Self) -> VisualDescendants
Enumerates the descendants of the visual in the visual tree, in depth-first pre-order.
get_self_and_visual_descendants
fn get_self_and_visual_descendants(self: &Self) -> VisualDescendants
Enumerates the visual and its descendants in the visual tree, in depth-first pre-order.
get_visual_parent
fn get_visual_parent(self: &Self) -> Option<Ref<Visual>>
Gets the visual parent of the visual.
get_visual_parent_of_type
fn get_visual_parent_of_type<T: ObjectType>(self: &Self) -> Option<Ref<T>>
Gets the visual parent of the visual, if it is of class T.
get_visual_root
fn get_visual_root(self: &Self) -> Option<Ref<Visual>>
The root visual of the presentation source the visual is attached to.
get_layout_root
fn get_layout_root(self: &Self) -> Option<Rc<dyn ILayoutRoot>>
The layout root of the tree the visual is attached to.
get_layout_manager
fn get_layout_manager(self: &Self) -> Option<Rc<dyn ILayoutManager>>
The layout manager of the presentation source of the visual, or
None when the visual is not attached to a visual root.
get_input_root
fn get_input_root(self: &Self) -> Option<Rc<dyn IInputRoot>>
The input root of the tree the visual is attached to.
get_platform_settings
fn get_platform_settings(self: &Self) -> Option<Rc<dyn IPlatformSettings>>
The platform settings of the tree the visual is attached to.
is_visual_ancestor_of
fn is_visual_ancestor_of(self: &Self, target: &Visual) -> bool
Tests whether this visual is an ancestor of target.
sort_by_z_index
fn sort_by_z_index(elements: &[Ref<Visual>]) -> Vec<Ref<Visual>>
Sorts visuals for hit testing: by descending Z index, and for equal Z indices by descending position in the input, so that the topmost visual comes first.
point_to_client
fn point_to_client(self: &Self, point: PixelPoint) -> Point
Converts a point from screen to client coordinates.
Panics if the visual does not belong to a visual tree.
point_to_screen
fn point_to_screen(self: &Self, point: Point) -> PixelPoint
Converts a point from client to screen coordinates.
Panics if the visual does not belong to a visual tree.
transform_to_visual
fn transform_to_visual(self: &Self, to: &Visual) -> Option<Matrix>
Returns a transform that transforms the visual's coordinates into
the coordinates of the specified to visual, or None if the
visuals don't share a common ancestor.
translate_point
fn translate_point(self: &Self, point: Point, relative_to: &Visual) -> Option<Point>
Translates a point relative to this visual to coordinates that are
relative to the specified visual, or returns None if the visuals
don't share a common ancestor.
rotation
fn rotation(self: &Self) -> f32
UIElement.Rotation: the rotation of the element in degrees, clockwise, around
rotation_axis through center_point. Zero
until set.
Around the Z axis it is the RotationAngle of the composition visual (in radians);
around another axis it is the Orientation of the composition visual, a quaternion.
While neither the rotation nor its axis was set, both are left to the application.
set_rotation
fn set_rotation(self: &Self, value: f32)
Sets rotation.
rotation_axis
fn rotation_axis(self: &Self) -> Vector3
UIElement.RotationAxis: the axis rotation turns the element around.
The Z axis (0, 0, 1) until set.
Deviation (winui-composition.md): the renderers are 2D, so a rotation around another axis shows only its projection on the plane of the element (no perspective). A zero axis is taken as the Z axis.
set_rotation_axis
fn set_rotation_axis(self: &Self, value: Vector3)
Sets rotation_axis.
scale
fn scale(self: &Self) -> Vector3
UIElement.Scale: the scale of the element around center_point,
the Scale of its composition visual. (1, 1, 1) until set.
set_scale
fn set_scale(self: &Self, value: Vector3)
Sets scale.
center_point
fn center_point(self: &Self) -> Vector3
UIElement.CenterPoint: the point, in the coordinates of the element, that
scale and rotation are around; the CenterPoint of
its composition visual. The origin until set.
set_center_point
fn set_center_point(self: &Self, value: Vector3)
Sets center_point.
transform_matrix
fn transform_matrix(self: &Self) -> Matrix4x4
UIElement.TransformMatrix: a transform of the element in addition to the other facades.
The identity until set.
The composition visual has a 2D TransformMatrix, which the renderer fills with the
render transform of the element; the 2D affine part of this matrix (M11, M12, M21,
M22, M41, M42) is applied after the render transform.
Deviation (winui-composition.md): WinUI applies TransformMatrix after the other facade
transforms; the composition visual applies its TransformMatrix before Scale,
RotationAngle, Orientation and Translation, so here the matrix acts before those
facades. The 3D part of the matrix is ignored.
set_transform_matrix
fn set_transform_matrix(self: &Self, value: Matrix4x4)
Sets transform_matrix.
opacity_transition
fn opacity_transition(self: &Self) -> Option<ScalarTransition>
UIElement.OpacityTransition: animates the changes of the Opacity of the element.
None (no animation) by default.
set_opacity_transition
fn set_opacity_transition(self: &Self, value: Option<ScalarTransition>)
Sets opacity_transition.
rotation_transition
fn rotation_transition(self: &Self) -> Option<ScalarTransition>
UIElement.RotationTransition: animates the changes of rotation (and
of rotation_axis). None by default.
set_rotation_transition
fn set_rotation_transition(self: &Self, value: Option<ScalarTransition>)
Sets rotation_transition.
scale_transition
fn scale_transition(self: &Self) -> Option<Vector3Transition>
UIElement.ScaleTransition: animates the changes of scale. None by
default.
set_scale_transition
fn set_scale_transition(self: &Self, value: Option<Vector3Transition>)
Sets scale_transition.
translation_transition
fn translation_transition(self: &Self) -> Option<Vector3Transition>
UIElement.TranslationTransition: animates the changes of
translation. None by default.
set_translation_transition
fn set_translation_transition(self: &Self, value: Option<Vector3Transition>)
Sets translation_transition.
shadow
fn shadow(self: &Self) -> Option<Ref<crate::media::Shadow>>
UIElement.Shadow: the shadow the element casts, a
ThemeShadow (the one shadow there is).
The shadow of a popup is cast by the child of the popup.
set_shadow
fn set_shadow(self: &Self, value: Option<Ref<crate::media::Shadow>>)
theme_shadow_caster
fn theme_shadow_caster(self: &Self) -> Option<(Ref<ThemeShadow>, Ref<Visual>)>
The theme shadow the visual casts and the element whose elevation (the
Z of its Translation) the shadow has: its own ThemeShadow, or, for
the child of a popup with a theme shadow, the popup's (with the
popup's elevation, which wins over the child's own shadow). None for
a visual that delegates its shadow to its child (a popup) and for one
without a theme shadow.
theme_shadow_visual
fn theme_shadow_visual(self: &Self) -> Option<Rc<ThemeShadowVisual>>
The visual that draws the theme shadow of this visual, while there is one.
set_theme_shadow_delegated_to_child
fn set_theme_shadow_delegated_to_child(self: &Self, value: bool)
For a popup (WinUI's Popup, whose Shadow is cast by its child):
whether the shadow of this visual is cast by its child rather than by
itself.
set_theme_shadow_popup
fn set_theme_shadow_popup(self: &Self, popup: Option<&Visual>)
For the child of a popup: the popup whose Shadow the child casts as
its own (NeedsDropShadowVisual: "Child of Popup with Shadow is
implicitly a shadow caster").
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<Visual>
Returns a strong reference to this object.
render
fn render(self: &Self, context: &mut DrawingContext<'_>)
Renders the visual to a drawing context.
on_attached_to_visual_tree_core
fn on_attached_to_visual_tree_core(self: &Self, e: &VisualTreeAttachmentEventArgs)
Calls the on_attached_to_visual_tree method for this control and
all of its visual descendants.
on_detached_from_visual_tree_core
fn on_detached_from_visual_tree_core(self: &Self, e: &VisualTreeAttachmentEventArgs)
Calls the on_detached_from_visual_tree method for this control
and all of its visual descendants.
on_attached_to_visual_tree
fn on_attached_to_visual_tree(self: &Self, e: &VisualTreeAttachmentEventArgs)
Called when the control is added to a rooted visual tree.
on_detached_from_visual_tree
fn on_detached_from_visual_tree(self: &Self, e: &VisualTreeAttachmentEventArgs)
Called when the control is removed from a rooted visual tree.
on_visual_parent_changed
fn on_visual_parent_changed(self: &Self, old_parent: Option<&Ref<Visual>>, new_parent: Option<&Ref<Visual>>)
Called when the control's visual parent changes.
bypass_flow_direction_policies
fn bypass_flow_direction_policies(self: &Self) -> bool
Whether the control ignores the flow direction policies, i.e. is never mirrored.
invalidate_mirror_transform
fn invalidate_mirror_transform(self: &Self)
Computes the has_mirror_transform value according to the flow
direction of this visual and its parent.
clip_to_bounds_radius
fn clip_to_bounds_radius(self: &Self) -> Option<crate::CornerRadius>
The corner radius the visual clips its content with when
clip_to_bounds is set; None for a plain rectangular clip.
(Upstream: the IVisualWithRoundRectClip interface.)
custom_hit_test
fn custom_hit_test(self: &Self, point: crate::Point) -> Option<bool>
The custom hit test of the visual at a point in its own
coordinates; None when the visual has none and is hit by what
it occupies or draws. (Upstream: the ICustomHitTest interface;
a class implementing it overrides this and the geometry form.)
custom_hit_test_geometry
fn custom_hit_test_geometry(self: &Self, geometry: &Ref<crate::media::Geometry>) -> Option<crate::media::IntersectionResult>
The custom hit test of the visual against a geometry in its own
coordinates; None when the visual has none.
ensure_initialized_for_visual_brush
fn ensure_initialized_for_visual_brush(self: &Self)
Ensures that the visual is ready to use as the visual in a
visual brush. (Upstream: the IVisualBrushInitialize interface;
a class implementing it overrides this.)
detach_from_compositor
fn detach_from_compositor(self: &Self)
Releases the composition visual of the visual.
synchronize_composition_child_visuals
fn synchronize_composition_child_visuals(self: &Self)
Makes the children of the composition visual match the visual children (in Z order) and the child composition visual.
synchronize_composition_properties
fn synchronize_composition_properties(self: &Self)
Copies the properties of the visual to its composition visual.
requires_composition_visual
fn requires_composition_visual(self: &Self) -> bool
Whether the visual has a composition visual of its own whatever it draws: a class
whose create_composition_visual makes a
composition visual that shows something itself says so here. Any other visual gets
its composition visual once it sets something the compositor applies, or is asked
for it (docs/porting/desktop-performance.md, section 9.41); until then what it draws
is an item of the composition visual of the nearest visual above it that has one
(section 9.42).
bounds_property
fn bounds_property() -> &'static DirectProperty<Visual, Rect>
Defines the Bounds property.
clip_to_bounds_property
fn clip_to_bounds_property() -> &'static StyledProperty<bool>
Defines the ClipToBounds property.
clip_property
fn clip_property() -> &'static StyledProperty<Option<Ref<Geometry>>>
Defines the Clip property.
shadow_property
fn shadow_property() -> &'static StyledProperty<Option<Ref<crate::media::Shadow>>>
Defines the Shadow property (WinUI UIElement.Shadow): the shadow the element casts,
a ThemeShadow.
translation_property
fn translation_property() -> &'static DirectProperty<Visual, crate::Vector3D>
Defines the Translation property (WinUI UIElement.Translation): the facade
translation as a property markup can set
(Translation="0,0,32").
cache_mode_property
fn cache_mode_property() -> &'static StyledProperty<Option<Ref<CacheMode>>>
Defines the CacheMode property.
effect_property
fn effect_property() -> &'static StyledProperty<Option<Rc<dyn IEffect>>>
Defines the Effect property.
opacity_mask_property
fn opacity_mask_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the OpacityMask property.
render_transform_property
fn render_transform_property() -> &'static StyledProperty<Option<Rc<dyn ITransform>>>
Defines the RenderTransform property.
render_transform_origin_property
fn render_transform_origin_property() -> &'static StyledProperty<RelativePoint>
Defines the RenderTransformOrigin property.
is_visible_property
fn is_visible_property() -> &'static StyledProperty<bool>
Defines the IsVisible property.
opacity_property
fn opacity_property() -> &'static StyledProperty<f64>
Defines the Opacity property.
has_mirror_transform_property
fn has_mirror_transform_property() -> &'static DirectProperty<Visual, bool>
Defines the HasMirrorTransform property.
flow_direction_property
fn flow_direction_property() -> &'static AttachedProperty<FlowDirection>
Defines the FlowDirection attached property.
visual_parent_property
fn visual_parent_property() -> &'static DirectProperty<Visual, Option<Ref<Visual>>>
Defines the VisualParent property.
z_index_property
fn z_index_property() -> &'static StyledProperty<i32>
Defines the ZIndex property.
construct
fn construct() -> Self
Creates the class data; see crate::FerroObject::construct.
new
fn new() -> Ref<Self>
attached_to_visual_tree
fn attached_to_visual_tree(self: &Self, handler: impl Fn(&VisualTreeAttachmentEventArgs) -> () + 'static) -> Subscription
Raised when the control is attached to a rooted visual tree.
detached_from_visual_tree
fn detached_from_visual_tree(self: &Self, handler: impl Fn(&VisualTreeAttachmentEventArgs) -> () + 'static) -> Subscription
Raised when the control is detached from a rooted visual tree.
is_effectively_visible_changed
fn is_effectively_visible_changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Raised when is_effectively_visible changes.
bounds
fn bounds(self: &Self) -> Rect
The bounds of the control relative to its parent.
set_bounds
fn set_bounds(self: &Self, value: Rect)
Sets the bounds of the control. Called by the layout system.
clip_to_bounds
fn clip_to_bounds(self: &Self) -> bool
Whether the control should be clipped to its bounds.
set_clip_to_bounds
fn set_clip_to_bounds(self: &Self, value: bool)
clip
fn clip(self: &Self) -> Option<Ref<Geometry>>
The geometry clip for this visual.
set_clip
fn set_clip(self: &Self, value: impl Into<Nullable<Geometry>>)
cache_mode
fn cache_mode(self: &Self) -> Option<Ref<CacheMode>>
The cache mode of the visual.
set_cache_mode
fn set_cache_mode(self: &Self, value: impl Into<Nullable<CacheMode>>)
effect
fn effect(self: &Self) -> Option<Rc<dyn IEffect>>
The effect of the control.
set_effect
fn set_effect(self: &Self, value: Option<Rc<dyn IEffect>>)
opacity_mask
fn opacity_mask(self: &Self) -> Option<Rc<dyn IBrush>>
The opacity mask of the control.
set_opacity_mask
fn set_opacity_mask(self: &Self, value: Option<Rc<dyn IBrush>>)
render_transform
fn render_transform(self: &Self) -> Option<Rc<dyn ITransform>>
The render transform of the control.
set_render_transform
fn set_render_transform(self: &Self, value: Option<Rc<dyn ITransform>>)
render_transform_origin
fn render_transform_origin(self: &Self) -> RelativePoint
The transform origin of the control.
set_render_transform_origin
fn set_render_transform_origin(self: &Self, value: RelativePoint)
is_effectively_visible
fn is_effectively_visible(self: &Self) -> bool
Whether this control and all its parents are visible.
is_visible
fn is_visible(self: &Self) -> bool
Whether this control is visible.
set_is_visible
fn set_is_visible(self: &Self, value: bool)
opacity
fn opacity(self: &Self) -> f64
The opacity of the control.
set_opacity
fn set_opacity(self: &Self, value: f64)
manipulation_transform
fn manipulation_transform(self: &Self) -> Option<crate::Matrix>
The manipulation transform of the visual (not upstream): a transform its parent applies
to it after its render transform and before its position, about its top left corner. The
scroll presenter of a zooming scroll viewer scales its content this way (WinUI applies the
zoom of DirectManipulation to the content of a scroll viewer); it takes part in rendering,
hit testing and the transforms between visuals as the render transform does. None by
default.
set_manipulation_transform
fn set_manipulation_transform(self: &Self, value: Option<crate::Matrix>)
Sets manipulation_transform; the identity is no
transform.
has_mirror_transform
fn has_mirror_transform(self: &Self) -> bool
Whether the control is mirrored relative to its parent because of its flow direction.
set_has_mirror_transform
fn set_has_mirror_transform(self: &Self, value: bool)
Sets the mirror transform flag.
flow_direction
fn flow_direction(self: &Self) -> FlowDirection
The text flow direction.
set_flow_direction
fn set_flow_direction(self: &Self, value: FlowDirection)
get_flow_direction
fn get_flow_direction(visual: &Visual) -> FlowDirection
Gets the value of the attached FlowDirection property on a visual.
set_flow_direction_on
fn set_flow_direction_on(visual: &Visual, value: FlowDirection)
Sets the value of the attached FlowDirection property on a visual.
z_index
fn z_index(self: &Self) -> i32
The Z index of the control.
Controls with a higher Z index appear in front of controls with a lower one. Among controls with the same value, order of appearance in the visual children decides.
set_z_index
fn set_z_index(self: &Self, value: i32)
visual_children
fn visual_children(self: &Self) -> &FerroList<Ref<Visual>>
The control's child visuals.
visual_children_count
fn visual_children_count(self: &Self) -> usize
The number of visual children, without creating the collection.
visual_children_snapshot
fn visual_children_snapshot(self: &Self) -> Option<Rc<Vec<Ref<Visual>>>>
A snapshot of the visual children, without creating the collection.
visual_root
fn visual_root(self: &Self) -> Option<Ref<Visual>>
The root of the visual tree, if the control is attached to one.
has_composition_visual
fn has_composition_visual(self: &Self) -> bool
Whether the visual has a composition visual of its own now. A visual attached to a tree
that has none is shown by the composition visual of the nearest visual above it that has
one: what the visual draws is an item of that composition visual
(has_composition_item), and the composition visuals of
the visuals under it are its children (docs/porting/desktop-performance.md, sections
9.41 and 9.42).
has_composition_item
fn has_composition_item(self: &Self) -> bool
Whether what the visual draws is shown now by the composition visual of the nearest visual above it that has one, as an item of it: the visual has no composition visual of its own (docs/porting/desktop-performance.md, section 9.42).
composition_visuals_on_demand
fn composition_visuals_on_demand() -> bool
Whether visuals get their composition visuals on demand (the default), or each of them when it is attached to a visual tree.
set_composition_visuals_on_demand
fn set_composition_visuals_on_demand(value: bool)
Sets whether visuals get their composition visuals on demand. With false every visual
has a composition visual from the moment it is attached to a visual tree, as upstream.
It applies to the visuals attached from then on; it is meant to be set once, before the
first window.
child_composition_visual
fn child_composition_visual(self: &Self) -> Option<Rc<CompositionVisual>>
The composition visual shown as the last child of the composition
visual of this visual (see ElementComposition).
set_child_composition_visual
fn set_child_composition_visual(self: &Self, value: Option<Rc<CompositionVisual>>)
lights
fn lights(self: &Self) -> FerroList<Ref<crate::media::XamlLight>>
UIElement.Lights: the XAML lights the element holds. A light added
to the collection is connected to the element (OnConnected) while
the element is in a visual tree, and lights the targets of its id in
the subtree of the element (winui-materials.md).
has_lights
fn has_lights(self: &Self) -> bool
Whether the element holds a lights collection.
light_target_ids
fn light_target_ids(self: &Self) -> Vec<String>
The ids of the XAML lights that target the element.
translation
fn translation(self: &Self) -> crate::Vector3D
UIElement.Translation: the translation of the composition visual of the visual, applied
after its render transform. Zero until set.
As in WinUI the translation is not a styled property; setting it hands the Translation
of the composition visual to this facade, which writes it whenever the visual is
rendered again. While it was never set, the application may animate the Translation of
the composition visual itself.
set_translation
fn set_translation(self: &Self, value: crate::Vector3D)
is_hidden_by_composition
fn is_hidden_by_composition(self: &Self) -> bool
Whether the composition visual of the visual is hidden by requests of the composition
API (see add_composition_hide_request).
add_composition_hide_request
fn add_composition_hide_request(self: &Self)
Hides the composition visual of the visual until the matching
remove_composition_hide_request, whatever
IsVisible says. Requests are counted. A connected animation hides its source and
destination this way while it shows them through visual surfaces, which render a hidden
visual (WinUI hides the element's visual with SetConnectedAnimationRunning).
remove_composition_hide_request
fn remove_composition_hide_request(self: &Self)
Ends a request of add_composition_hide_request.
is_render_suppressed
fn is_render_suppressed(self: &Self) -> bool
Whether presentation owners have suppressed this visual and its descendants in all render paths. Suppression changes no styled property, layout or logical visibility. It also applies to immediate bitmap and visual-brush captures; composition-only hiding remains independently capturable for connected animations.
add_render_suppression_request
fn add_render_suppression_request(self: &Self)
Suppresses drawing until a matching remove request. Independent owners may hold requests concurrently. Input behavior is deliberately separate: editors that suppress presentation may additionally install their own temporary hit-test policy.
remove_render_suppression_request
fn remove_render_suppression_request(self: &Self)
Releases one request without changing another owner's suppression or authored values. Removing a request when none is active is harmless.
is_shown_by_composition
fn is_shown_by_composition(self: &Self) -> bool
Whether the composition visual of the visual is kept visible by requests of the
composition API although IsVisible is false (see
add_composition_show_request).
add_composition_show_request
fn add_composition_show_request(self: &Self)
Keeps the composition visual of the visual visible until the matching
remove_composition_show_request, whatever
IsVisible says. Requests are counted. An implicit hide animation keeps the element
visible this way until it completes. A hide request wins over a show request.
remove_composition_show_request
fn remove_composition_show_request(self: &Self)
Ends a request of add_composition_show_request.
composition_layer_visual
fn composition_layer_visual(self: &Self) -> Option<Rc<CompositionVisual>>
A composition visual shown above the children of the visual and above its child
composition visual (the layer of the connected animations of a top level, WinUI's
ConnectedAnimationRoot).
set_composition_layer_visual
fn set_composition_layer_visual(self: &Self, value: Option<Rc<CompositionVisual>>)
Sets the visual of composition_layer_visual.
has_non_uniform_z_index_children
fn has_non_uniform_z_index_children(self: &Self) -> bool
Whether any child has a non-default Z index.
is_attached_to_visual_tree
fn is_attached_to_visual_tree(self: &Self) -> bool
Whether this control is attached to a visual root.
visual_parent
fn visual_parent(self: &Self) -> Option<Ref<Visual>>
The control's parent visual.
invalidate_visual
fn invalidate_visual(self: &Self)
Invalidates the visual and queues a repaint.
invalidate_composition_properties
fn invalidate_composition_properties(self: &Self)
Invalidates the composition properties of this visual (its render transform and opacity)
but not its drawing: the renderer synchronizes the properties without calling render
again. A FerroUI addition (docs/porting/desktop-performance.md, section 9.5): upstream
invalidates the visual, which records its drawing again.
affects_render
fn affects_render<T: ObjectType + Upcast<Visual>>(properties: &[&'static FerroProperty])
Indicates that a property change should cause invalidate_visual to
be called on objects of class T.
When the value of such a property is a media object that can change (a brush, pen, geometry, transform, effect or image), its invalidation invalidates the visual as well.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<Visual>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplStyledElementImplVisualImplDrop
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.