ferroui_base/rendering/composition/generated/mod.rs
1// @generated by scripts/generate_composition.py — do not edit
2
3//! The composition object model generated from the composition schema.
4//!
5//! Upstream generates C# partial classes and completes them by hand in the
6//! other half of each partial class. Here the generated half of a schema class
7//! `X` is a pair of *property blocks* that the hand-written class embeds, and a
8//! pair of *hook traits* through which the block calls back into that class:
9//!
10//! | Upstream (generated) | Here |
11//! |----------------------------------------------|----------------------------------------|
12//! | `enum XChangedFields` | `XChangedFields` (bit flags) |
13//! | fields, properties, `InitializeDefaults`, `SerializeChangesCore`, `StartAnimation` of `X` | `XProps` |
14//! | `partial void` methods of `X` | `XHooks` (default: do nothing) |
15//! | fields, properties, `DeserializeChangesCore`, `GetCompositionProperty`, `SerializeAllChanges` of `ServerX` | `ServerXProps` |
16//! | `partial void` methods of `ServerX` | `ServerXHooks` (default: do nothing) |
17//! | `static CompositionProperty<T> s_IdOfPProperty` | `ServerXProps::id_of_p_property()` |
18//!
19//! A `ServerOnly` class has no `XProps`; its UI-thread side is a media class
20//! that calls `ServerXProps::serialize_all_changes`.
21//!
22//! # Embedding the UI-thread block
23//!
24//! The class holds an `XProps` (created with `XProps::new()`), implements
25//! `ICompositionObjectHost` (registering for serialization, the id of its
26//! server object, pending and implicit animations) and `XHooks`, and
27//!
28//! * calls `props.initialize_defaults(self)` where the upstream constructor
29//! calls `InitializeDefaults()` (use `initialize_own_defaults` when the
30//! constructor chain is customised);
31//! * exposes the properties by forwarding to `props.p()` /
32//! `props.set_p(self, value)`; the setter raises the hooks, marks the field
33//! changed, registers the object and handles implicit animations exactly as
34//! the upstream setter does;
35//! * forwards `ICompositorSerializable::serialize_changes` to
36//! `props.serialize_changes_core(self, writer)` and `StartAnimation` to
37//! `props.start_animation(self, name, animation, final_value)` (a `false`
38//! result means the property is unknown to the generated classes).
39//!
40//! # Embedding the server block
41//!
42//! The class holds a `ServerXProps`, implements `IServerPropertyHost` (or
43//! `IServerAnimatedPropertyHost` when it derives from the animatable server
44//! object) and `ServerXHooks`, and
45//!
46//! * forwards `IServerObject::deserialize_changes_core` to
47//! `props.deserialize_changes_core(self, reader, committed_at)`;
48//! * returns `props.find_props(type_id)` from `IServerObject::get_props`, which
49//! is how composition properties reach the fields of the block;
50//! * exposes the properties by forwarding to `props.p()` /
51//! `props.set_p(self, value)`.
52//!
53//! `IServerPropertyHost::set_value` is upstream's `SetValue(prop, ref field,
54//! value)`: the block hands the class the assignment and the class decides what
55//! surrounds it (nothing, animation subscriptions, or the observer bookkeeping
56//! of a render resource).
57//!
58//! # Inheritance
59//!
60//! A class whose base class is generated embeds the block of the base
61//! (`props.base()`), its hook trait extends the hook trait of the base, and its
62//! `serialize_changes_core` / `deserialize_changes_core` run the base first, as
63//! `base.SerializeChangesCore` does upstream. A class whose base is written by
64//! hand (a `Manual` class of the schema, or a `ServerBase` that is not
65//! generated) has a required hook instead, `base_serialize_changes_core` /
66//! `base_deserialize_changes_core`, called at the same point.
67//!
68//! # Types
69//!
70//! Composition objects referenced by a property are held as
71//! `Rc<dyn ICompositionObject>` on the UI thread and cross as the id of their
72//! server object; the server block holds the resolved `Rc<dyn IServerObject>`.
73//! Brushes and transforms are `BatchResource` values on the UI thread (the
74//! value itself or the id of its server-side counterpart) and
75//! `ServerResourceRef` values on the server. Other reference types cross as
76//! payloads; plain values cross through `BatchValue`.
77//!
78//! The schema attributes `Internal`, `Private` and `InternalSet` are recorded
79//! in the documentation of the generated items; everything is `pub` so the
80//! hand-written classes, which live in other modules, can reach it.
81//!
82//! # The FerroUI overlay
83//!
84//! What `scripts/composition-schema-winui.xml` adds to the upstream schema
85//! (see the docstring of the generator for the merge rules):
86//!
87//! * classes: `CompositionClip`, `InsetClip`, `RectangleClip`, `DropShadow`, `CompositionSurfaceBrush`, `CompositionVisualSurface`, `SpriteVisual`, `CompositionGeometry`, `CompositionRectangleGeometry`, `CompositionRoundedRectangleGeometry`, `CompositionEllipseGeometry`, `CompositionLineGeometry`, `CompositionPathGeometry`, `CompositionViewBox`, `CompositionShape`, `CompositionShapeCollection`, `CompositionSpriteShape`, `CompositionContainerShape`, `ShapeVisual`, `GeometricClip`, `LayerVisual`, `RedirectVisual`, `CompositionNineGridBrush`, `CompositionMaskBrush`, `VisualUnorderedCollection`, `CompositionLight`, `AmbientLight`, `DistantLight`, `PointLight`, `SpotLight`;
88//! * properties of upstream classes: `CompositionVisual.CompositionClip`, `CompositionVisual.RotationAxis`, `CompositionVisual.RelativeOffsetAdjustment`, `CompositionVisual.RelativeSizeAdjustment`, `CompositionVisual.IsHitTestVisible`, `CompositionVisual.IsPixelSnappingEnabled`, `CompositionVisual.BorderMode`, `CompositionVisual.BackfaceVisibility`, `CompositionVisual.CompositeMode`, `CompositionVisual.ParentForTransform`, `CompositionConicGradientBrush.AnchorPoint`, `CompositionConicGradientBrush.CenterPoint`, `CompositionConicGradientBrush.Offset`, `CompositionConicGradientBrush.RotationAngle`, `CompositionConicGradientBrush.Scale`, `CompositionConicGradientBrush.TransformMatrix`, `CompositionRadialGradientBrush.AnchorPoint`, `CompositionRadialGradientBrush.CenterPoint`, `CompositionRadialGradientBrush.Offset`, `CompositionRadialGradientBrush.RotationAngle`, `CompositionRadialGradientBrush.Scale`, `CompositionRadialGradientBrush.TransformMatrix`, `CompositionLinearGradientBrush.AnchorPoint`, `CompositionLinearGradientBrush.CenterPoint`, `CompositionLinearGradientBrush.Offset`, `CompositionLinearGradientBrush.RotationAngle`, `CompositionLinearGradientBrush.Scale`, `CompositionLinearGradientBrush.TransformMatrix`.
89//!
90//! # Classes of the schema that are not generated
91//!
92//! Manual classes (written by hand): `CompositionSurface`, `CompositionDrawingSurface`, `CompositionDrawListVisual`, `CompositionSimpleGradientBrush`, `CompositionGradientBrush`.
93
94mod ambient_light;
95mod composition_animations;
96mod composition_bitmap_cache;
97mod composition_brush;
98mod composition_cache_mode;
99mod composition_clip;
100mod composition_conic_gradient_brush;
101mod composition_container_shape;
102mod composition_container_visual;
103mod composition_ellipse_geometry;
104mod composition_experimental_acrylic_visual;
105mod composition_geometry;
106mod composition_gradient_stop;
107mod composition_light;
108mod composition_line_geometry;
109mod composition_linear_gradient_brush;
110mod composition_mask_brush;
111mod composition_nine_grid_brush;
112mod composition_path_geometry;
113mod composition_radial_gradient_brush;
114mod composition_rectangle_geometry;
115mod composition_rounded_rectangle_geometry;
116mod composition_shape;
117mod composition_shape_collection;
118mod composition_simple_brush;
119mod composition_simple_conic_gradient_brush;
120mod composition_simple_geometry;
121mod composition_simple_linear_gradient_brush;
122mod composition_simple_pen;
123mod composition_simple_radial_gradient_brush;
124mod composition_simple_solid_color_brush;
125mod composition_simple_tile_brush;
126mod composition_simple_transform;
127mod composition_solid_color_brush;
128mod composition_solid_color_visual;
129mod composition_sprite_shape;
130mod composition_surface_brush;
131mod composition_surface_visual;
132mod composition_target;
133mod composition_tile_brush;
134mod composition_view_box;
135mod composition_visual;
136mod composition_visual_collection;
137mod composition_visual_surface;
138mod distant_light;
139mod drop_shadow;
140mod geometric_clip;
141mod inset_clip;
142mod layer_visual;
143mod point_light;
144mod rectangle_clip;
145mod redirect_visual;
146mod shape_visual;
147mod spot_light;
148mod sprite_visual;
149mod visual_unordered_collection;
150
151pub use ambient_light::*;
152pub use composition_animations::*;
153pub use composition_bitmap_cache::*;
154pub use composition_brush::*;
155pub use composition_cache_mode::*;
156pub use composition_clip::*;
157pub use composition_conic_gradient_brush::*;
158pub use composition_container_shape::*;
159pub use composition_container_visual::*;
160pub use composition_ellipse_geometry::*;
161pub use composition_experimental_acrylic_visual::*;
162pub use composition_geometry::*;
163pub use composition_gradient_stop::*;
164pub use composition_light::*;
165pub use composition_line_geometry::*;
166pub use composition_linear_gradient_brush::*;
167pub use composition_mask_brush::*;
168pub use composition_nine_grid_brush::*;
169pub use composition_path_geometry::*;
170pub use composition_radial_gradient_brush::*;
171pub use composition_rectangle_geometry::*;
172pub use composition_rounded_rectangle_geometry::*;
173pub use composition_shape::*;
174pub use composition_shape_collection::*;
175pub use composition_simple_brush::*;
176pub use composition_simple_conic_gradient_brush::*;
177pub use composition_simple_geometry::*;
178pub use composition_simple_linear_gradient_brush::*;
179pub use composition_simple_pen::*;
180pub use composition_simple_radial_gradient_brush::*;
181pub use composition_simple_solid_color_brush::*;
182pub use composition_simple_tile_brush::*;
183pub use composition_simple_transform::*;
184pub use composition_solid_color_brush::*;
185pub use composition_solid_color_visual::*;
186pub use composition_sprite_shape::*;
187pub use composition_surface_brush::*;
188pub use composition_surface_visual::*;
189pub use composition_target::*;
190pub use composition_tile_brush::*;
191pub use composition_view_box::*;
192pub use composition_visual::*;
193pub use composition_visual_collection::*;
194pub use composition_visual_surface::*;
195pub use distant_light::*;
196pub use drop_shadow::*;
197pub use geometric_clip::*;
198pub use inset_clip::*;
199pub use layer_visual::*;
200pub use point_light::*;
201pub use rectangle_clip::*;
202pub use redirect_visual::*;
203pub use shape_visual::*;
204pub use spot_light::*;
205pub use sprite_visual::*;
206pub use visual_unordered_collection::*;
207
208#[cfg(test)]
209mod tests;