1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// @generated by scripts/generate_composition.py — do not edit
//! `CompositionContainerVisual`.
use crate::rendering::composition::animations::ICompositionAnimation;
use crate::rendering::composition::expressions::ExpressionVariant;
use crate::rendering::composition::server::CompositionProperty;
use crate::rendering::composition::transport::BatchStreamReader;
use crate::rendering::composition::transport::BatchStreamWriter;
use std::any::Any;
use std::any::TypeId;
use std::time::Duration;
use super::CompositionVisualHooks;
use super::CompositionVisualProps;
use super::ServerCompositionVisualHooks;
use super::ServerCompositionVisualProps;
/// The partial methods of `CompositionContainerVisual`: implemented by the class that embeds
/// [`CompositionContainerVisualProps`]. Every hook defaults to doing nothing.
pub trait CompositionContainerVisualHooks: CompositionVisualHooks {
fn initialize_defaults_extra(&self) {}
}
/// The UI-thread properties of `CompositionContainerVisual`.
pub struct CompositionContainerVisualProps {
base: CompositionVisualProps,
}
impl Default for CompositionContainerVisualProps {
fn default() -> Self {
Self::new()
}
}
impl CompositionContainerVisualProps {
/// Creates the properties with every field at the default of its type.
/// The defaults of the schema are applied by
/// [`initialize_defaults`](Self::initialize_defaults).
pub fn new() -> Self {
Self {
base: CompositionVisualProps::new(),
}
}
/// The properties of the base class.
pub fn base(&self) -> &CompositionVisualProps {
&self.base
}
/// The `InitializeDefaults` calls of the constructor chain: the base
/// classes first, then this class.
pub fn initialize_defaults(&self, host: &dyn CompositionContainerVisualHooks) {
self.base.initialize_defaults(host);
self.initialize_own_defaults(host);
}
/// `InitializeDefaults` of this class alone.
pub fn initialize_own_defaults(&self, host: &dyn CompositionContainerVisualHooks) {
CompositionContainerVisualHooks::initialize_defaults_extra(host);
}
/// Connects an animation with the named property. Returns `false` when
/// neither this class nor its generated bases have an animated property
/// of that name: the caller continues with its hand-written base.
pub fn start_animation(
&self,
host: &dyn CompositionContainerVisualHooks,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
) -> bool {
self.base.start_animation(host, property_name, animation, final_value)
}
/// Writes the changes of the object: the base class first, then the
/// changed-fields mask and the changed members of this class.
pub fn serialize_changes_core(&self, host: &dyn CompositionContainerVisualHooks, writer: &mut BatchStreamWriter<'_>) {
self.base.serialize_changes_core(host, writer);
}
}
/// The partial methods of `ServerCompositionContainerVisual`: implemented by the class that embeds
/// [`ServerCompositionContainerVisualProps`]. Every hook defaults to doing nothing.
pub trait ServerCompositionContainerVisualHooks: ServerCompositionVisualHooks {
}
/// The server-side properties of `ServerCompositionContainerVisual`.
pub struct ServerCompositionContainerVisualProps {
base: ServerCompositionVisualProps,
}
impl Default for ServerCompositionContainerVisualProps {
fn default() -> Self {
Self::new()
}
}
impl ServerCompositionContainerVisualProps {
/// Creates the properties with every field at the default of its type; the
/// values of the UI thread arrive with the first batch.
pub fn new() -> Self {
Self {
base: ServerCompositionVisualProps::new(),
}
}
/// The properties of the base class.
pub fn base(&self) -> &ServerCompositionVisualProps {
&self.base
}
/// This block or the block of a base class, by type: what
/// `IServerObject::get_props` of the embedding class returns.
pub fn find_props(&self, type_id: TypeId) -> Option<&dyn Any> {
if type_id == TypeId::of::<Self>() {
return Some(self);
}
self.base.find_props(type_id)
}
/// Reads the changes of the object: the base class first, then the
/// changed-fields mask and the changed members of this class.
pub fn deserialize_changes_core(
&self,
host: &dyn ServerCompositionContainerVisualHooks,
reader: &mut BatchStreamReader<'_>,
committed_at: Duration,
) {
self.base.deserialize_changes_core(host, reader, committed_at);
}
/// The composition property with the given name, among the properties
/// of this class and of its generated bases that have a variant form.
pub fn get_composition_property(name: &str) -> Option<&'static CompositionProperty> {
ServerCompositionVisualProps::get_composition_property(name)
}
}