Skip to main content

Visual

Struct Visual 

Source
pub struct Visual { /* private fields */ }
Expand description

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.

Implementations§

Source§

impl Visual

Source

pub fn calculate_distance_from_ancestor( &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.

Source

pub fn calculate_distance_from_root(&self) -> usize

Calculates the distance from a visual’s root.

Source

pub fn find_common_visual_ancestor( &self, target: &Visual, ) -> Option<Ref<Visual>>

Tries to get the first common ancestor of two visuals.

Source

pub fn get_visual_ancestors(&self) -> VisualAncestors ⓘ

Enumerates the ancestors of the visual in the visual tree.

Source

pub fn get_self_and_visual_ancestors(&self) -> VisualAncestors ⓘ

Enumerates the visual and its ancestors in the visual tree.

Source

pub fn find_ancestor_of_type<T: ObjectType>( &self, include_self: bool, ) -> Option<Ref<T>>

Finds the first ancestor of class T, optionally starting with the visual itself.

Source

pub fn find_ancestor_of_type_where<T: ObjectType>( &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.

Source

pub fn find_descendant_of_type<T: ObjectType>( &self, include_self: bool, ) -> Option<Ref<T>>

Finds the first descendant of class T (depth first), optionally starting with the visual itself.

Source

pub fn find_descendant_of_type_where<T: ObjectType>( &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.

Source

pub fn get_transformed_bounds(&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.

Source

pub fn get_visual_at(&self, p: Point) -> Option<Ref<Visual>>

Gets the first visible visual at a point, in the coordinates of this visual.

Source

pub fn get_visual_at_filtered( &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.

Source

pub fn get_visual_at_geometry( &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.

Source

pub fn get_visual_at_geometry_filtered( &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.

Source

pub fn get_visuals_at(&self, p: Point) -> Vec<Ref<Visual>>

Enumerates the visible visuals at a point, in the coordinates of this visual, topmost first.

Source

pub fn get_visuals_at_filtered( &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.

Source

pub fn get_visuals_at_geometry( &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.

Source

pub fn get_visuals_at_geometry_filtered( &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.

Source

pub fn get_visual_children(&self) -> Rc<Vec<Ref<Visual>>>

Gets a snapshot of the visual children of the visual.

Source

pub fn get_visual_descendants(&self) -> VisualDescendants ⓘ

Enumerates the descendants of the visual in the visual tree, in depth-first pre-order.

Source

pub fn get_self_and_visual_descendants(&self) -> VisualDescendants ⓘ

Enumerates the visual and its descendants in the visual tree, in depth-first pre-order.

Source

pub fn get_visual_parent(&self) -> Option<Ref<Visual>>

Gets the visual parent of the visual.

Source

pub fn get_visual_parent_of_type<T: ObjectType>(&self) -> Option<Ref<T>>

Gets the visual parent of the visual, if it is of class T.

Source

pub fn get_presentation_source(&self) -> Option<Rc<dyn IPresentationSource>>

The presentation source the visual is attached to.

Source

pub fn get_visual_root(&self) -> Option<Ref<Visual>>

The root visual of the presentation source the visual is attached to.

Source

pub fn get_layout_root(&self) -> Option<Rc<dyn ILayoutRoot>>

The layout root of the tree the visual is attached to.

Source

pub fn get_layout_manager(&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.

Source

pub fn get_input_root(&self) -> Option<Rc<dyn IInputRoot>>

The input root of the tree the visual is attached to.

Source

pub fn get_platform_settings(&self) -> Option<Rc<dyn IPlatformSettings>>

The platform settings of the tree the visual is attached to.

Source

pub fn is_visual_ancestor_of(&self, target: &Visual) -> bool

Tests whether this visual is an ancestor of target.

Source

pub 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.

Source

pub fn point_to_client(&self, point: PixelPoint) -> Point

Converts a point from screen to client coordinates.

Panics if the visual does not belong to a visual tree.

Source

pub fn point_to_screen(&self, point: Point) -> PixelPoint

Converts a point from client to screen coordinates.

Panics if the visual does not belong to a visual tree.

Source

pub fn transform_to_visual(&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.

Source

pub fn translate_point( &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.

Source§

impl Visual

Source

pub fn rotation(&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.

Source

pub fn set_rotation(&self, value: f32)

Sets rotation.

Source

pub fn rotation_axis(&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.

Source

pub fn set_rotation_axis(&self, value: Vector3)

Source

pub fn scale(&self) -> Vector3

UIElement.Scale: the scale of the element around center_point, the Scale of its composition visual. (1, 1, 1) until set.

Source

pub fn set_scale(&self, value: Vector3)

Sets scale.

Source

pub fn center_point(&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.

Source

pub fn set_center_point(&self, value: Vector3)

Source

pub fn transform_matrix(&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.

Source

pub fn set_transform_matrix(&self, value: Matrix4x4)

Source

pub fn opacity_transition(&self) -> Option<ScalarTransition>

UIElement.OpacityTransition: animates the changes of the Opacity of the element. None (no animation) by default.

Source

pub fn set_opacity_transition(&self, value: Option<ScalarTransition>)

Source

pub fn rotation_transition(&self) -> Option<ScalarTransition>

UIElement.RotationTransition: animates the changes of rotation (and of rotation_axis). None by default.

Source

pub fn set_rotation_transition(&self, value: Option<ScalarTransition>)

Source

pub fn scale_transition(&self) -> Option<Vector3Transition>

UIElement.ScaleTransition: animates the changes of scale. None by default.

Source

pub fn set_scale_transition(&self, value: Option<Vector3Transition>)

Source

pub fn translation_transition(&self) -> Option<Vector3Transition>

UIElement.TranslationTransition: animates the changes of translation. None by default.

Source

pub fn set_translation_transition(&self, value: Option<Vector3Transition>)

Source§

impl Visual

Source

pub fn shadow(&self) -> Option<Ref<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.

Source

pub fn set_shadow(&self, value: Option<Ref<Shadow>>)

Source

pub fn theme_shadow_caster(&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.

Source

pub fn theme_shadow_visual(&self) -> Option<Rc<ThemeShadowVisual>>

The visual that draws the theme shadow of this visual, while there is one.

Source

pub fn set_theme_shadow_delegated_to_child(&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.

Source

pub fn set_theme_shadow_popup(&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”).

Source§

impl Visual

Source

pub const TYPE: &'static TypeInfo = <Visual as crate::StaticType>::TYPE

The runtime type of this class.

Source

pub fn to_ref(&self) -> Ref<Visual>

Returns a strong reference to this object.

Source§

impl Visual

Source

pub fn render(&self, context: &mut DrawingContext<'_>)

Renders the visual to a drawing context.

Source

pub fn on_attached_to_visual_tree_core(&self, e: &VisualTreeAttachmentEventArgs)

Calls the on_attached_to_visual_tree method for this control and all of its visual descendants.

Source

pub fn on_detached_from_visual_tree_core( &self, e: &VisualTreeAttachmentEventArgs, )

Calls the on_detached_from_visual_tree method for this control and all of its visual descendants.

Source

pub fn on_attached_to_visual_tree(&self, e: &VisualTreeAttachmentEventArgs)

Called when the control is added to a rooted visual tree.

Source

pub fn on_detached_from_visual_tree(&self, e: &VisualTreeAttachmentEventArgs)

Called when the control is removed from a rooted visual tree.

Source

pub fn on_visual_parent_changed( &self, old_parent: Option<&Ref<Visual>>, new_parent: Option<&Ref<Visual>>, )

Called when the control’s visual parent changes.

Source

pub fn bypass_flow_direction_policies(&self) -> bool

Whether the control ignores the flow direction policies, i.e. is never mirrored.

Source

pub fn invalidate_mirror_transform(&self)

Computes the has_mirror_transform value according to the flow direction of this visual and its parent.

Source

pub fn clip_to_bounds_radius(&self) -> Option<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.)

Source

pub fn custom_hit_test(&self, point: 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.)

Source

pub fn custom_hit_test_geometry( &self, geometry: &Ref<Geometry>, ) -> Option<IntersectionResult>

The custom hit test of the visual against a geometry in its own coordinates; None when the visual has none.

Source

pub fn ensure_initialized_for_visual_brush(&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.)

Source

pub fn create_composition_visual( &self, compositor: &Rc<Compositor>, ) -> CompositionDrawListVisual

Creates the composition visual of the visual on compositor.

Source

pub fn detach_from_compositor(&self)

Releases the composition visual of the visual.

Source

pub fn synchronize_composition_child_visuals(&self)

Makes the children of the composition visual match the visual children (in Z order) and the child composition visual.

Source

pub fn synchronize_composition_properties(&self)

Copies the properties of the visual to its composition visual.

Source§

impl Visual

Source

pub fn bounds_property() -> &'static DirectProperty<Visual, Rect>

Defines the Bounds property.

Source

pub fn clip_to_bounds_property() -> &'static StyledProperty<bool>

Defines the ClipToBounds property.

Source

pub fn clip_property() -> &'static StyledProperty<Option<Ref<Geometry>>>

Defines the Clip property.

Source

pub fn shadow_property() -> &'static StyledProperty<Option<Ref<Shadow>>>

Defines the Shadow property (WinUI UIElement.Shadow): the shadow the element casts, a ThemeShadow.

Source

pub fn translation_property() -> &'static DirectProperty<Visual, Vector3D>

Defines the Translation property (WinUI UIElement.Translation): the facade translation as a property markup can set (Translation="0,0,32").

Source

pub fn cache_mode_property() -> &'static StyledProperty<Option<Ref<CacheMode>>>

Defines the CacheMode property.

Source

pub fn effect_property() -> &'static StyledProperty<Option<Rc<dyn IEffect>>>

Defines the Effect property.

Source

pub fn opacity_mask_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>

Defines the OpacityMask property.

Source

pub fn render_transform_property() -> &'static StyledProperty<Option<Rc<dyn ITransform>>>

Defines the RenderTransform property.

Source

pub fn render_transform_origin_property() -> &'static StyledProperty<RelativePoint>

Defines the RenderTransformOrigin property.

Source

pub fn is_visible_property() -> &'static StyledProperty<bool>

Defines the IsVisible property.

Source

pub fn opacity_property() -> &'static StyledProperty<f64>

Defines the Opacity property.

Source

pub fn has_mirror_transform_property() -> &'static DirectProperty<Visual, bool>

Defines the HasMirrorTransform property.

Source

pub fn flow_direction_property() -> &'static AttachedProperty<FlowDirection>

Defines the FlowDirection attached property.

Source

pub fn visual_parent_property() -> &'static DirectProperty<Visual, Option<Ref<Visual>>>

Defines the VisualParent property.

Source

pub fn z_index_property() -> &'static StyledProperty<i32>

Defines the ZIndex property.

Source§

impl Visual

Source

pub fn construct() -> Self

Creates the class data; see crate::FerroObject::construct.

Source

pub fn new() -> Ref<Self>

Source

pub fn attached_to_visual_tree( &self, handler: impl Fn(&VisualTreeAttachmentEventArgs) + 'static, ) -> Rc<dyn IDisposable>

Raised when the control is attached to a rooted visual tree.

Source

pub fn detached_from_visual_tree( &self, handler: impl Fn(&VisualTreeAttachmentEventArgs) + 'static, ) -> Rc<dyn IDisposable>

Raised when the control is detached from a rooted visual tree.

Source

pub fn is_effectively_visible_changed( &self, handler: impl Fn() + 'static, ) -> Rc<dyn IDisposable>

Raised when is_effectively_visible changes.

Source

pub fn bounds(&self) -> Rect

The bounds of the control relative to its parent.

Source

pub fn set_bounds(&self, value: Rect)

Sets the bounds of the control. Called by the layout system.

Source

pub fn clip_to_bounds(&self) -> bool

Whether the control should be clipped to its bounds.

Source

pub fn set_clip_to_bounds(&self, value: bool)

Source

pub fn clip(&self) -> Option<Ref<Geometry>>

The geometry clip for this visual.

Source

pub fn set_clip(&self, value: impl Into<Nullable<Geometry>>)

Source

pub fn cache_mode(&self) -> Option<Ref<CacheMode>>

The cache mode of the visual.

Source

pub fn set_cache_mode(&self, value: impl Into<Nullable<CacheMode>>)

Source

pub fn effect(&self) -> Option<Rc<dyn IEffect>>

The effect of the control.

Source

pub fn set_effect(&self, value: Option<Rc<dyn IEffect>>)

Source

pub fn opacity_mask(&self) -> Option<Rc<dyn IBrush>>

The opacity mask of the control.

Source

pub fn set_opacity_mask(&self, value: Option<Rc<dyn IBrush>>)

Source

pub fn render_transform(&self) -> Option<Rc<dyn ITransform>>

The render transform of the control.

Source

pub fn set_render_transform(&self, value: Option<Rc<dyn ITransform>>)

Source

pub fn render_transform_origin(&self) -> RelativePoint

The transform origin of the control.

Source

pub fn set_render_transform_origin(&self, value: RelativePoint)

Source

pub fn is_effectively_visible(&self) -> bool

Whether this control and all its parents are visible.

Source

pub fn is_visible(&self) -> bool

Whether this control is visible.

Source

pub fn set_is_visible(&self, value: bool)

Source

pub fn opacity(&self) -> f64

The opacity of the control.

Source

pub fn set_opacity(&self, value: f64)

Source

pub fn manipulation_transform(&self) -> Option<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.

Source

pub fn set_manipulation_transform(&self, value: Option<Matrix>)

Sets manipulation_transform; the identity is no transform.

Source

pub fn has_mirror_transform(&self) -> bool

Whether the control is mirrored relative to its parent because of its flow direction.

Source

pub fn set_has_mirror_transform(&self, value: bool)

Sets the mirror transform flag.

Source

pub fn flow_direction(&self) -> FlowDirection

The text flow direction.

Source

pub fn set_flow_direction(&self, value: FlowDirection)

Source

pub fn get_flow_direction(visual: &Visual) -> FlowDirection

Gets the value of the attached FlowDirection property on a visual.

Source

pub fn set_flow_direction_on(visual: &Visual, value: FlowDirection)

Sets the value of the attached FlowDirection property on a visual.

Source

pub fn z_index(&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.

Source

pub fn set_z_index(&self, value: i32)

Source

pub fn visual_children(&self) -> &FerroList<Ref<Visual>>

The control’s child visuals.

Source

pub fn visual_children_count(&self) -> usize

The number of visual children, without creating the collection.

Source

pub fn visual_children_snapshot(&self) -> Option<Rc<Vec<Ref<Visual>>>>

A snapshot of the visual children, without creating the collection.

Source

pub fn presentation_source(&self) -> Option<Rc<dyn IPresentationSource>>

The presentation source the visual is attached to.

Source

pub fn visual_root(&self) -> Option<Ref<Visual>>

The root of the visual tree, if the control is attached to one.

Source

pub fn composition_visual(&self) -> Option<CompositionDrawListVisual>

The composition visual of the visual, while it is attached to a visual tree rendered by a compositor.

Source

pub fn child_composition_visual(&self) -> Option<Rc<CompositionVisual>>

The composition visual shown as the last child of the composition visual of this visual (see ElementComposition).

Source

pub fn set_child_composition_visual(&self, value: Option<Rc<CompositionVisual>>)

Source

pub fn lights(&self) -> FerroList<Ref<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).

Source

pub fn has_lights(&self) -> bool

Whether the element holds a lights collection.

Source

pub fn light_target_ids(&self) -> Vec<String>

The ids of the XAML lights that target the element.

Source

pub fn translation(&self) -> 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.

Source

pub fn set_translation(&self, value: Vector3D)

Source

pub fn is_hidden_by_composition(&self) -> bool

Whether the composition visual of the visual is hidden by requests of the composition API (see add_composition_hide_request).

Source

pub fn add_composition_hide_request(&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).

Source

pub fn remove_composition_hide_request(&self)

Ends a request of add_composition_hide_request.

Source

pub fn is_render_suppressed(&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.

Source

pub fn add_render_suppression_request(&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.

Source

pub fn remove_render_suppression_request(&self)

Releases one request without changing another owner’s suppression or authored values. Removing a request when none is active is harmless.

Source

pub fn is_shown_by_composition(&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).

Source

pub fn add_composition_show_request(&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.

Source

pub fn remove_composition_show_request(&self)

Ends a request of add_composition_show_request.

Source

pub fn composition_layer_visual(&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).

Source

pub fn set_composition_layer_visual(&self, value: Option<Rc<CompositionVisual>>)

Sets the visual of composition_layer_visual.

Source

pub fn attach_to_compositor( &self, compositor: &Rc<Compositor>, ) -> CompositionDrawListVisual

Makes sure the visual has a composition visual on compositor and returns it.

Source

pub fn has_non_uniform_z_index_children(&self) -> bool

Whether any child has a non-default Z index.

Source

pub fn is_attached_to_visual_tree(&self) -> bool

Whether this control is attached to a visual root.

Source

pub fn visual_parent(&self) -> Option<Ref<Visual>>

The control’s parent visual.

Source

pub fn invalidate_visual(&self)

Invalidates the visual and queues a repaint.

Source

pub 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.

Source

pub fn set_presentation_source_for_root_visual( &self, presentation_source: Option<Rc<dyn IPresentationSource>>, )

Attaches or detaches the root visual of a presentation source.

Methods from Deref<Target = StyledElement>§

Source

pub fn get_logical_ancestors(&self) -> LogicalAncestors ⓘ

Enumerates the ancestors of the element in the logical tree, from its parent to the root.

Source

pub fn get_self_and_logical_ancestors(&self) -> LogicalAncestors ⓘ

Enumerates the element and its ancestors in the logical tree.

Source

pub fn find_logical_ancestor_of_type<T: ObjectType>( &self, include_self: bool, ) -> Option<Ref<T>>

Finds the first logical ancestor of class T, optionally starting with the element itself.

Source

pub fn get_logical_children(&self) -> Rc<Vec<Ref<StyledElement>>>

The logical children of the element.

Source

pub fn get_logical_descendants(&self) -> LogicalDescendants ⓘ

Enumerates the descendants of the element in the logical tree, in depth-first pre-order.

Source

pub fn get_self_and_logical_descendants(&self) -> LogicalDescendants ⓘ

Enumerates the element and its descendants in the logical tree, in depth-first pre-order.

Source

pub fn find_logical_descendant_of_type<T: ObjectType>( &self, include_self: bool, ) -> Option<Ref<T>>

Finds the first logical descendant of class T (depth first), optionally starting with the element itself.

Source

pub fn get_logical_parent(&self) -> Option<Ref<StyledElement>>

The logical parent of the element.

Source

pub fn get_logical_parent_of_type<T: ObjectType>(&self) -> Option<Ref<T>>

The logical parent of the element, if it is of class T.

Source

pub fn get_logical_siblings(&self) -> Rc<Vec<Ref<StyledElement>>>

The children of the logical parent of the element, including the element itself; empty when the element has no logical parent.

Source

pub fn is_logical_ancestor_of(&self, target: Option<&StyledElement>) -> bool

Whether the element is a logical ancestor of target.

Source

pub fn to_ref(&self) -> Ref<StyledElement>

Returns a strong reference to this object.

Source

pub fn begin_init(&self)

Signals the beginning of a batch of initialization: styling is deferred until the matching end_init.

Source

pub fn try_end_init(&self) -> Result<(), InitializationError>

Signals the end of a batch of initialization: the element is styled (if it is attached to a rooted logical tree) and initialized. A style or control theme that cannot be applied (two setters for the same property) is an error, the counterpart of the invalid operation EndInit raises in the managed original; what follows the failure is skipped. This is the overridable member; end_init is the form that panics on the error.

Source

pub fn logical_children_collection_changed( &self, e: &NotifyCollectionChangedEventArgs<'_, Ref<StyledElement>>, )

Called when the logical children collection changes.

Source

pub fn on_attached_to_logical_tree(&self, e: &LogicalTreeAttachmentEventArgs)

Called when the styled element is added to a rooted logical tree.

Source

pub fn on_detached_from_logical_tree(&self, e: &LogicalTreeAttachmentEventArgs)

Called when the styled element is removed from a rooted logical tree.

Source

pub fn on_data_context_changed(&self)

Called when the data context changes.

Source

pub fn on_data_context_begin_update(&self)

Called when the data context begins updating.

Source

pub fn on_data_context_end_update(&self)

Called when the data context finishes updating.

Source

pub fn on_initialized(&self)

Called when the control finishes initialization.

Source

pub fn style_key_override(&self) -> &'static TypeInfo

The type by which the element is styled. Defaults to the element’s own type; override to be styled as a base class.

Source

pub fn on_control_theme_changed(&self)

Called when the control theme changes.

Source

pub fn on_templated_parent_control_theme_changed(&self)

Called when the templated parent’s control theme changes.

Source

pub fn invalidate_styles(&self, recurse: bool)

Detaches all styles from the element (and optionally from its inheritance children) so that they are re-applied.

Source

pub fn is_logical_root(&self) -> bool

Whether the element is the root of a logical tree.

Source

pub fn styling_parent(&self) -> Option<StyleHostRef>

The parent style host of the element: by default the inheritance parent, when it is a styled element. The root of a tree overrides this to return the host of the global styles.

Source

pub fn notify_child_resources_changed(&self, e: ResourcesChangedEventArgs)

Notifies the children of the element that the resources visible to them have changed. The base method notifies the logical children.

Source

pub fn child_index_provider(&self) -> Option<Rc<dyn IChildIndexProvider>>

The child index provider implemented by the element, if any. Used to match the children of the element by their position.

Source

pub fn is_theme_variant_root(&self) -> bool

Whether the element is a root of theme variant resolution: at a root the default theme variant resolves to the variant of the platform instead of being inherited.

Source

pub fn attached_to_logical_tree( &self, handler: impl Fn(&LogicalTreeAttachmentEventArgs) + 'static, ) -> Rc<dyn IDisposable>

Raised when the styled element is attached to a rooted logical tree.

Source

pub fn detached_from_logical_tree( &self, handler: impl Fn(&LogicalTreeAttachmentEventArgs) + 'static, ) -> Rc<dyn IDisposable>

Raised when the styled element is detached from a rooted logical tree.

Source

pub fn data_context_changed( &self, handler: impl Fn() + 'static, ) -> Rc<dyn IDisposable>

Occurs when the data context property changes.

Source

pub fn initialized(&self, handler: impl Fn() + 'static) -> Rc<dyn IDisposable>

Occurs when the styled element has finished initialization.

Source

pub fn resources_changed( &self, handler: impl Fn(&ResourcesChangedEventArgs) + 'static, ) -> Rc<dyn IDisposable>

Raised when the resources change on the element or an ancestor of the element.

Source

pub fn actual_theme_variant_changed( &self, handler: impl Fn() + 'static, ) -> Rc<dyn IDisposable>

Raised when the theme variant in effect for the element changes.

Source

pub fn name(&self) -> Option<String>

The name of the styled element.

An element’s name is used to uniquely identify it within its name scope. Once the element has been styled its name may not be changed.

Source

pub fn has_name(&self, name: &str) -> bool

Whether the name of the styled element is name, without a copy of the name (the name selectors of styles test it for every element they are evaluated on).

Source

pub fn set_name(&self, value: Option<String>)

Source

pub fn classes(&self) -> Classes

The styled element’s classes.

The collection is returned by handle: clones refer to the same collection.

Source

pub fn pseudo_classes(&self) -> &dyn IPseudoClasses

The pseudoclasses of the element, settable by the control itself.

Source

pub fn data_context(&self) -> Option<BoxedValue>

The control’s data context.

The data context is an inherited property that specifies the default object that will be used for data binding.

Source

pub fn set_data_context(&self, value: Option<BoxedValue>)

Source

pub fn is_initialized(&self) -> bool

Whether the element has finished initialization.

For more information about when this happens, see the initialized event.

Source

pub fn styles(&self) -> Ref<Styles>

The styles for the styled element.

Styles for the entire application are added to the application’s styles collection.

Source

pub fn is_styles_initialized(&self) -> bool

Whether the styles collection of the element has been created.

Source

pub fn style_key(&self) -> &'static TypeInfo

The type by which the element is styled.

Source

pub fn resources(&self) -> Ref<ResourceDictionary>

The styled element’s resource dictionary.

Source

pub fn resources_if_created(&self) -> Option<Ref<ResourceDictionary>>

The resource dictionary of the element if it has been created; unlike resources, this does not create one.

Source

pub fn set_resources(&self, value: Ref<ResourceDictionary>)

Source

pub fn theme(&self) -> Option<Ref<ControlTheme>>

The theme to be applied to the element.

By default the theme is looked up as a resource keyed by the element’s style key; setting this property takes precedence over that lookup.

Source

pub fn set_theme(&self, value: impl Into<Nullable<ControlTheme>>)

Source

pub fn actual_theme_variant(&self) -> Option<ThemeVariant>

The UI theme variant that is currently used by the element, which might be different than the requested theme variant. None until a theme variant has been established for the element or an ancestor.

Source

pub fn has_resources(&self) -> bool

Whether the element or its styles have resources.

Source

pub fn try_get_resource( &self, key: &ResourceKey, theme: Option<&ThemeVariant>, ) -> Option<ResourceValue>

Tries to find a resource within the element: in its resource dictionary, then in its styles.

Source

pub fn try_find_resource( &self, key: &ResourceKey, theme: Option<&ThemeVariant>, ) -> Option<ResourceValue>

Tries to find a resource by searching up the logical tree and then the global styles.

Source

pub fn find_resource(&self, key: &ResourceKey) -> ResourceValue

Finds a resource by searching up the logical tree and then the global styles. Returns the unset value marker if it is not found.

Source

pub fn templated_parent(&self) -> Option<Ref<FerroObject>>

The styled element whose lookless template this element is part of.

Source

pub fn set_templated_parent(&self, value: impl Into<Nullable<FerroObject>>)

Sets the templated parent. Called by the template that creates the element.

Source

pub fn logical_children(&self) -> &FerroList<Ref<StyledElement>>

The styled element’s logical children.

Source

pub fn is_attached_to_logical_tree(&self) -> bool

Whether the element is attached to a rooted logical tree.

Source

pub fn parent(&self) -> Option<Ref<StyledElement>>

The styled element’s logical parent.

Source

pub fn apply_styling(&self) -> bool

Applies styling to the control if the control is initialized and styling is not already applied.

The styling system will automatically apply styling when required, so this method need only be called by tests or in rare special cases.

Returns true if styling is applied to the control, false if the control is still initializing.

Source

pub fn try_apply_styling(&self) -> Result<bool, DuplicateSetterError>

As apply_styling, reporting a style or control theme that cannot be applied (two setters for the same property: the invalid operation of the managed original) instead of panicking. After an error the styling pass is ended and the element is not marked as styled, as when the managed original throws.

Source

pub fn end_init(&self)

Signals the end of a batch of initialization (try_end_init). A style or control theme that cannot be applied panics with the message of the error.

Source

pub fn initialize_if_needed(&self)

Marks the element as initialized and raises the initialization notifications, if initialization is complete.

Source

pub fn set_parent(&self, parent: impl Into<Nullable<StyledElement>>)

Sets the element’s logical parent.

You should not usually need to call this method: it is called when an element is added to or removed from a logical children collection.

Source

pub fn notify_attached_to_logical_tree( &self, e: &LogicalTreeAttachmentEventArgs, )

Notifies the element that it has been attached to a rooted logical tree. Called by a parent for children that are part of its logical tree without being in its logical children collection (the template child of a templated control).

Source

pub fn notify_detached_from_logical_tree( &self, e: &LogicalTreeAttachmentEventArgs, )

Notifies the element that it has been detached from a rooted logical tree. See notify_attached_to_logical_tree.

Source

pub fn get_effective_theme(&self) -> Option<Ref<ControlTheme>>

The theme in effect for the element: the Theme property if set, otherwise the control theme resource keyed by the element’s style key that is visible to the element (a resource holding a Ref<ControlTheme>).

Source

pub fn styles_added(&self, styles: &[Rc<dyn IStyle>])

Called when styles are added to the styles collection of the element or a nested styles collection.

Source

pub fn styles_removed(&self, styles: &[Rc<dyn IStyle>])

Called when styles are removed from the styles collection of the element or a nested styles collection.

Source

pub fn notify_resources_changed( &self, e: ResourcesChangedEventArgs, propagate: bool, )

Notifies the element, and with propagate its children, that the resources visible to it have changed.

Source

pub fn set_data_context_with_priority( &self, value: Option<BoxedValue>, priority: BindingPriority, ) -> Option<Rc<dyn IDisposable>>

The priority-aware setter used by templates.

Source

pub fn bind_class( &self, class_name: &str, source: &dyn BindingBase, anchor: Option<&Ref<FerroObject>>, ) -> Rc<dyn BindingExpressionBase>

Binds the presence of the class class_name on this element to source. anchor provides the context the binding locates its source with when the element cannot.

Methods from Deref<Target = Animatable>§

Source

pub fn to_ref(&self) -> Ref<Animatable>

Returns a strong reference to this object.

Source

pub fn clock(&self) -> Option<Rc<dyn IClock>>

The clock which controls the animations and transitions on the object and, by inheritance, on its descendants. The global clock is used when there is none.

Source

pub fn set_clock(&self, value: Option<Rc<dyn IClock>>)

Source

pub fn transitions(&self) -> Option<Transitions>

The property transitions of the object.

Source

pub fn set_transitions(&self, value: Option<Transitions>)

Source

pub fn enable_transitions(&self)

Enables transitions for the object.

This is called when the object is attached to the visual tree, so that transitions do not run on its initial property values.

Source

pub fn disable_transitions(&self)

Disables transitions for the object.

This is called when the object is detached from the visual tree.

Source

pub fn try_get_transition_instance( &self, transition: &Rc<dyn ITransition>, ) -> Option<Rc<TransitionInstance>>

The progress of the transition that transition is currently running on this object: the instance created when the transition was last applied. None when the transition is not one of the object’s transitions or has not been applied.

Source

pub fn take_transition_interruption_state<T: Any>(&self) -> Option<Rc<T>>

Takes state left by the preceding application of the same transition on this object.

This is only available synchronously inside ITransition::apply. A spring transition can retain its last sampled velocity here, without storing mutable animation state in a transition definition that may be shared by several controls. Removal or visual-tree detachment discards the state. Normal duration-based transitions do not use this hook.

Source

pub fn report_transition_interruption_state<T: Any>(&self, state: Rc<T>)

Reports state to carry into the next application of this transition on this object.

Call only from ITransition::apply. The state may be updated by the running animation, but must not strongly own the target object. Outside a transition application this has no effect. Store zero velocity when an animation completes or is accessibility-canceled.

Methods from Deref<Target = FerroObject>§

Source

pub fn dispatcher(&self) -> &Arc<Dispatcher> ⓘ

Returns the Dispatcher that this object is associated with: the dispatcher of the thread that owns the object.

Source

pub fn check_access(&self) -> bool

Returns whether the calling thread is the thread that owns this object.

Source

pub fn verify_access(&self)

Checks that the calling thread is the thread that owns this object.

§Panics

Panics when it is not.

Source

pub fn to_ref(&self) -> Ref<FerroObject>

A strong reference to this object.

Source

pub fn to_weak(&self) -> WeakRef<FerroObject>

A weak reference to this object.

Source

pub fn get_type(&self) -> &'static TypeInfo

The runtime type of the object.

Source

pub fn is<T: ObjectType>(&self) -> bool

Whether the object is of class T or a class derived from it.

Source

pub fn downcast_ref<T: ObjectType>(&self) -> Option<&T>

Returns the object viewed as class T if it is one.

Source

pub fn on_property_changed(&self, change: &FerroPropertyChangedEventArgs<'_>)

Invokes the on_property_changed virtual member.

Source

pub fn inheritance_parent(&self) -> Option<Ref<FerroObject>>

The parent object that inherited property values are inherited from.

Source

pub fn set_inheritance_parent(&self, value: impl Into<Nullable<FerroObject>>)

Sets the parent object that inherited property values are inherited from.

Source

pub fn clear_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, )

Clears a property’s local value.

Source

pub fn get_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, ) -> T

Gets a property value.

Source

pub fn get_base_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, ) -> Option<T>

Gets a property’s base value: the value excluding animated values. Returns None if the value comes from inheritance or the default.

Source

pub fn is_animating(&self, property: &FerroProperty) -> bool

Checks whether a property is animating.

Source

pub fn is_set(&self, property: &FerroProperty) -> bool

Checks whether a styled property has a value assigned to it or a binding targeting it.

Source

pub fn has_local_value_binding(&self, property: &FerroProperty) -> bool

Whether a local-value binding targets this property, including direct properties and observable bindings. Unlike is_set, this does not rely on a styled property’s effective-value entry. It does not inspect bindings at style/template priorities.

Source

pub fn set_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, value: T, )

Sets a property value with local value priority.

Source

pub fn set_value_with_priority<T: PropertyValue>( &self, property: &'static StyledProperty<T>, value: T, priority: BindingPriority, ) -> Option<Rc<dyn IDisposable>>

Sets a property value with the given priority. For priorities other than local value, disposing the returned handle removes the value.

Source

pub fn set_current_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, value: T, )

Sets the value of a property without changing its value source.

This is used by a component that programmatically sets the value of one of its own properties without disabling an application’s declared use of the property: the effective value changes, but existing bindings and styles continue to work. The new value has the property’s current priority.

Source

pub fn bind_binding( &self, property: &'static FerroProperty, binding: &dyn BindingBase, ) -> Rc<dyn BindingExpressionBase>

Binds a property to a binding. Returns the binding expression which represents the binding instance on this object.

Source

pub fn bind_binding_with_anchor( &self, property: &'static FerroProperty, binding: &dyn BindingBase, anchor: Option<&Ref<FerroObject>>, ) -> Rc<dyn BindingExpressionBase>

Binds a property to a binding.

Some bindings need context to locate their source: a data context, named elements or resources. If this object is not an element, or is not yet attached to the tree, anchor provides that context.

Source

pub fn bind_binding_with_priority( &self, property: &'static FerroProperty, binding: &dyn BindingBase, priority: BindingPriority, anchor: Option<&Ref<FerroObject>>, ) -> Rc<dyn BindingExpressionBase>

Binds a property to a binding at the given priority, whatever the default priority of the binding is. Disposing the returned expression removes the binding.

An addition (no upstream counterpart): the values of WinUI’s visual states are bound at BindingPriority::Animation.

Source

pub fn indexer(&self, binding: &IndexerDescriptor) -> IndexerBinding

Gets a binding to a property of this object: the indexer taking an IndexerDescriptor (source[!Property] is source.indexer(&Property.bind())).

Source

pub fn bind_indexer( &self, binding: &IndexerDescriptor, value: &dyn BindingBase, ) -> Rc<dyn BindingExpressionBase>

Binds the property of an IndexerDescriptor to a binding: the setter of the indexer (target[!Property] = binding is target.bind_indexer(&Property.bind(), &binding)).

Source

pub fn bind<T: PropertyValue>( &self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<T>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable.

Source

pub fn bind_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<BindingValue<T>>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable of binding values.

Source

pub fn bind_untyped<T: PropertyValue>( &self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<BoxedValue>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable of untyped values.

Source

pub fn coerce_value(&self, property: &'static FerroProperty)

Coerces the specified property.

Source

pub fn get_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, ) -> T

Gets a direct property value.

Source

pub fn set_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, value: T, )

Sets a direct property value.

Source

pub fn clear_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, )

Resets a direct property to its unset value.

Source

pub fn bind_direct<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<T>>, ) -> Rc<dyn IDisposable>

Binds a direct property to an observable.

Source

pub fn bind_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<BindingValue<T>>>, ) -> Rc<dyn IDisposable>

Binds a direct property to an observable of binding values.

Source

pub fn bind_direct_untyped<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<BoxedValue>>, ) -> Rc<dyn IDisposable>

Binds a direct property to an observable of untyped values.

Source

pub fn set_and_raise<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, field: &RefCell<T>, value: T, ) -> bool

Sets the backing field of a direct property, raising a change notification if the value changed. Returns true if it changed.

Source

pub fn set_and_raise_cell<T: PropertyValue + Copy>( &self, property: &'static DirectPropertyBase<T>, field: &Cell<T>, value: T, ) -> bool

set_and_raise for Copy values stored in a Cell.

Source

pub fn get_value_untyped(&self, property: &'static FerroProperty) -> BoxedValue

Gets a property value as an untyped value.

Source

pub fn set_value_untyped( &self, property: &'static FerroProperty, value: &dyn Any, priority: BindingPriority, ) -> Option<Rc<dyn IDisposable>>

Sets a property from an untyped value, which must hold exactly the property’s value type or the unset marker.

Source

pub fn set_current_value_untyped( &self, property: &'static FerroProperty, value: &dyn Any, )

set_current_value with an untyped value.

Source

pub fn clear_value_untyped(&self, property: &'static FerroProperty)

Clears a property’s local value.

Source

pub fn bind_property_untyped( &self, property: &'static FerroProperty, source: Rc<dyn IObservable<BoxedValue>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable of untyped values.

Source

pub fn property_changed( &self, handler: impl Fn(&FerroPropertyChangedEventArgs<'_>) + 'static, ) -> Rc<dyn IDisposable>

Subscribes to property changes on this object. Disposing the returned handle unsubscribes.

Source

pub fn add_property_changed_handler( &self, handler: Rc<dyn Fn(&FerroPropertyChangedEventArgs<'_>)>, ) -> u64

Subscribes handler to property changes on this object and returns the token that remove_property_changed_handler takes: property_changed for a subscriber that keeps the object and the token itself, so that no handle is made.

Source

pub fn remove_property_changed_handler(&self, token: u64) -> bool

Ends a subscription of add_property_changed_handler.

Source

pub fn property_changed_subscriber_count(&self) -> usize

The number of subscribers to property changes on this object (a diagnostics member, used by tests to verify that subscriptions are released).

Source

pub fn raise_property_changed<T: PropertyValue>( &self, property: &'static FerroProperty, old_value: Option<&T>, new_value: &T, priority: BindingPriority, is_effective_value: bool, )

Raises a property changed notification.

Source

pub fn raise_direct_property_changed<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, old_value: &T, new_value: &T, )

Raises a property changed notification for a direct property.

Trait Implementations§

Source§

impl Deref for Visual

Source§

type Target = StyledElement

The resulting type after dereferencing.
Source§

fn deref(&self) -> &StyledElement

Dereferences the value.
Source§

impl Drop for Visual

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl FerroObjectImpl for Visual

Source§

fn constructed(this: &Self)

Called once, right after the object has been allocated. This is where constructor logic that needs a reference to the object runs. Overrides must call parent_constructed first.
Source§

fn on_property_changed(this: &Self, change: &FerroPropertyChangedEventArgs<'_>)

Called when the effective value of a property changes on the object.
Source§

fn on_property_changed_core( this: &Self, change: &FerroPropertyChangedEventArgs<'_>, )

Called for every property change on the object, including changes of non-effective (base) values. Overriding this is rarely needed; override on_property_changed instead.
Source§

fn update_data_validation( this: &Self, property: &'static FerroProperty, state: BindingValueType, error: Option<&BindingError>, )

Called to update the validation state for properties for which data validation is enabled.
Source§

impl ObjectType for Visual

Source§

type Parent = StyledElement

The base class. The root class is its own parent.
Source§

type VTable = VisualVTable

The virtual table of the class.
Source§

fn vtable() -> &'static Self::VTable

The virtual table used by instances whose most-derived class is Self.
Source§

fn register_class()

The static initialisation of the class. The first call on a thread, after doing the same for the base class: Read more
Source§

impl StaticType for Visual

Source§

const TYPE: &'static TypeInfo

The runtime type.
Source§

impl StyledElementImpl for Visual

Source§

fn logical_children_collection_changed( this: &Self, e: &NotifyCollectionChangedEventArgs<'_, Ref<StyledElement>>, )

Called when the logical children collection changes.
Source§

fn on_templated_parent_control_theme_changed(this: &Self)

Called when the templated parent’s control theme changes.
Source§

fn begin_init(this: &Self)

Signals the beginning of a batch of initialization: styling is deferred until the matching end_init.
Source§

fn try_end_init(this: &Self) -> Result<(), InitializationError>

Signals the end of a batch of initialization: the element is styled (if it is attached to a rooted logical tree) and initialized. A style or control theme that cannot be applied (two setters for the same property) is an error, the counterpart of the invalid operation EndInit raises in the managed original; what follows the failure is skipped. This is the overridable member; end_init is the form that panics on the error.
Source§

fn on_attached_to_logical_tree(this: &Self, e: &LogicalTreeAttachmentEventArgs)

Called when the styled element is added to a rooted logical tree.
Source§

fn on_detached_from_logical_tree( this: &Self, e: &LogicalTreeAttachmentEventArgs, )

Called when the styled element is removed from a rooted logical tree.
Source§

fn on_data_context_changed(this: &Self)

Called when the data context changes.
Source§

fn on_data_context_begin_update(this: &Self)

Called when the data context begins updating.
Source§

fn on_data_context_end_update(this: &Self)

Called when the data context finishes updating.
Source§

fn on_initialized(this: &Self)

Called when the control finishes initialization.
Source§

fn style_key_override(this: &Self) -> &'static TypeInfo

The type by which the element is styled. Defaults to the element’s own type; override to be styled as a base class.
Source§

fn on_control_theme_changed(this: &Self)

Called when the control theme changes.
Source§

fn invalidate_styles(this: &Self, recurse: bool)

Detaches all styles from the element (and optionally from its inheritance children) so that they are re-applied.
Source§

fn is_logical_root(this: &Self) -> bool

Whether the element is the root of a logical tree.
Source§

fn styling_parent(this: &Self) -> Option<StyleHostRef>

The parent style host of the element: by default the inheritance parent, when it is a styled element. The root of a tree overrides this to return the host of the global styles.
Source§

fn notify_child_resources_changed(this: &Self, e: ResourcesChangedEventArgs)

Notifies the children of the element that the resources visible to them have changed. The base method notifies the logical children.
Source§

fn child_index_provider(this: &Self) -> Option<Rc<dyn IChildIndexProvider>>

The child index provider implemented by the element, if any. Used to match the children of the element by their position.
Source§

fn is_theme_variant_root(this: &Self) -> bool

Whether the element is a root of theme variant resolution: at a root the default theme variant resolves to the variant of the platform instead of being inherited.
Source§

impl<T: VisualImpl> Subclassable<T> for Visual

Source§

impl<T: ?Sized> Upcast<T> for Visual

Source§

fn upcast(&self) -> &T

Source§

impl Upcast<Visual> for Visual

Source§

fn upcast(&self) -> &Visual

Source§

impl VisualImpl for Visual

Source§

fn render(_this: &Self, _context: &mut DrawingContext<'_>)

Renders the visual to a drawing context.
Source§

fn on_attached_to_visual_tree_core( this: &Self, e: &VisualTreeAttachmentEventArgs, )

Calls the on_attached_to_visual_tree method for this control and all of its visual descendants.
Source§

fn on_detached_from_visual_tree_core( this: &Self, e: &VisualTreeAttachmentEventArgs, )

Calls the on_detached_from_visual_tree method for this control and all of its visual descendants.
Source§

fn on_attached_to_visual_tree(_this: &Self, _e: &VisualTreeAttachmentEventArgs)

Called when the control is added to a rooted visual tree.
Source§

fn on_detached_from_visual_tree( _this: &Self, _e: &VisualTreeAttachmentEventArgs, )

Called when the control is removed from a rooted visual tree.
Source§

fn on_visual_parent_changed( this: &Self, old_parent: Option<&Ref<Visual>>, new_parent: Option<&Ref<Visual>>, )

Called when the control’s visual parent changes.
Source§

fn bypass_flow_direction_policies(_this: &Self) -> bool

Whether the control ignores the flow direction policies, i.e. is never mirrored.
Source§

fn clip_to_bounds_radius(_this: &Self) -> Option<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.)
Source§

fn custom_hit_test(_this: &Self, _point: 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.)
Source§

fn custom_hit_test_geometry( _this: &Self, _geometry: &Ref<Geometry>, ) -> Option<IntersectionResult>

The custom hit test of the visual against a geometry in its own coordinates; None when the visual has none.
Source§

fn ensure_initialized_for_visual_brush(_this: &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.)
Source§

fn create_composition_visual( this: &Self, compositor: &Rc<Compositor>, ) -> CompositionDrawListVisual

Creates the composition visual of the visual on compositor.
Source§

fn detach_from_compositor(this: &Self)

Releases the composition visual of the visual.
Source§

fn synchronize_composition_child_visuals(this: &Self)

Makes the children of the composition visual match the visual children (in Z order) and the child composition visual.
Source§

fn synchronize_composition_properties(this: &Self)

Copies the properties of the visual to its composition visual.
Source§

fn invalidate_mirror_transform(this: &Self)

Computes the has_mirror_transform value according to the flow direction of this visual and its parent.

Auto Trait Implementations§

§

impl !Freeze for Visual

§

impl !RefUnwindSafe for Visual

§

impl !Send for Visual

§

impl !Sync for Visual

§

impl !UnwindSafe for Visual

§

impl Unpin for Visual

§

impl UnsafeUnpin for Visual

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> FerroObjectImplExt for T
where T: FerroObjectImpl,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> StyledElementImplExt for T

Source§

fn parent_begin_init(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_try_end_init(this: &Self) -> Result<(), InitializationError>

Calls the base class implementation of the member.
Source§

fn parent_logical_children_collection_changed( this: &Self, e: &NotifyCollectionChangedEventArgs<'_, Ref<StyledElement>>, )

Calls the base class implementation of the member.
Source§

fn parent_on_attached_to_logical_tree( this: &Self, e: &LogicalTreeAttachmentEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_on_detached_from_logical_tree( this: &Self, e: &LogicalTreeAttachmentEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_on_data_context_changed(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_on_data_context_begin_update(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_on_data_context_end_update(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_on_initialized(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_style_key_override(this: &Self) -> &'static TypeInfo

Calls the base class implementation of the member.
Source§

fn parent_on_control_theme_changed(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_on_templated_parent_control_theme_changed(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_invalidate_styles(this: &Self, recurse: bool)

Calls the base class implementation of the member.
Source§

fn parent_is_logical_root(this: &Self) -> bool

Calls the base class implementation of the member.
Source§

fn parent_styling_parent(this: &Self) -> Option<StyleHostRef>

Calls the base class implementation of the member.
Source§

fn parent_notify_child_resources_changed( this: &Self, e: ResourcesChangedEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_child_index_provider( this: &Self, ) -> Option<Rc<dyn IChildIndexProvider>>

Calls the base class implementation of the member.
Source§

fn parent_is_theme_variant_root(this: &Self) -> bool

Calls the base class implementation of the member.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> VisualImplExt for T
where T: VisualImpl,

Source§

fn parent_render(this: &Self, context: &mut DrawingContext<'_>)

Calls the base class implementation of the member.
Source§

fn parent_on_attached_to_visual_tree_core( this: &Self, e: &VisualTreeAttachmentEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_on_detached_from_visual_tree_core( this: &Self, e: &VisualTreeAttachmentEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_on_attached_to_visual_tree( this: &Self, e: &VisualTreeAttachmentEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_on_detached_from_visual_tree( this: &Self, e: &VisualTreeAttachmentEventArgs, )

Calls the base class implementation of the member.
Source§

fn parent_on_visual_parent_changed( this: &Self, old_parent: Option<&Ref<Visual>>, new_parent: Option<&Ref<Visual>>, )

Calls the base class implementation of the member.
Source§

fn parent_bypass_flow_direction_policies(this: &Self) -> bool

Calls the base class implementation of the member.
Source§

fn parent_invalidate_mirror_transform(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_clip_to_bounds_radius(this: &Self) -> Option<CornerRadius>

Calls the base class implementation of the member.
Source§

fn parent_custom_hit_test(this: &Self, point: Point) -> Option<bool>

Calls the base class implementation of the member.
Source§

fn parent_custom_hit_test_geometry( this: &Self, geometry: &Ref<Geometry>, ) -> Option<IntersectionResult>

Calls the base class implementation of the member.
Source§

fn parent_ensure_initialized_for_visual_brush(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_create_composition_visual( this: &Self, compositor: &Rc<Compositor>, ) -> CompositionDrawListVisual

Calls the base class implementation of the member.
Source§

fn parent_detach_from_compositor(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_synchronize_composition_child_visuals(this: &Self)

Calls the base class implementation of the member.
Source§

fn parent_synchronize_composition_properties(this: &Self)

Calls the base class implementation of the member.