rendering
Structs
BaseInstance
Shared storage carried by every concrete InstanceNode.
Properties
handler_registry
Type: Option<Rc<RefCell<HandlerRegistry>>>
instance_prototypical_properties
Type: PropertiesInit
instance_prototypical_common_properties
Type: CommonPropertiesInit
component_settings
Type: Option<Vec<SettingsBlockElement>>
template_node_identifier
Type: Option<UniqueTemplateNodeIdentifier>
template_node_type_id
Type: Option<TypeId>
template_node_selector_info
Type: Option<TemplateNodeSelectorInfo>
transition_config
Type: ComponentTransitionConfig
properties_scope
Type: PropertiesScopeInit
Implementations
flags
pub fn flags(&self) -> &InstanceFlags
Static behavior flags for this instance.
get_handler_registry
pub fn get_handler_registry(&self) -> Option<Rc<RefCell<HandlerRegistry>>>
Returns a handle to a node-managed HandlerRegistry, a mapping between event types and handlers.
Each node that can handle events is responsible for implementing this; Component instances generate
the necessary code to wire up userland events like <SomeNode @click=self.handler>. Primitives must handle
this explicitly, see e.g. [pax_std::drawing::rectangle::RectangleInstance#get_handler_registry].
get_instance_children
pub fn get_instance_children(&self) -> &InstanceNodePtrList
Return the list of instance nodes that are children of this one. Intuitively, this returns the nodes owned directly by this instance's definition.
For Components, this returns the root(s) of the component template, not the
projected children supplied by the containing component.
new
pub fn new(args: InstantiationArgs, flags: InstanceFlags) -> Self
Build shared instance state from compiler-generated instantiation args.
InstanceFlags
Static traversal/rendering flags for a concrete instance node.
Properties
invisible_to_slot
Type: bool
Used for exotic tree traversals for Slot, e.g. for Stacker > Repeat > Rectangle
where the repeated Rectangles need to be be considered direct children of Stacker.
Repeat and Conditional set this true so their active children can be
considered direct projected children by slot-driven containers.
invisible_to_raycasting
Type: bool
Certain elements, such as Groups and Components, are invisible to ray-casting. Since these container elements are on top of the elements they contain, this is needed otherwise the containers would intercept rays that should hit their contents.
layer
Type: Layer
The layer type (Layer::Native, Layer::NativeNonOccluding, or Layer::Canvas)
for this RenderNode.
Default is Layer::Canvas, and must be overwritten for InstanceNodes that manage native
content.
is_component
Type: bool
Only true for ComponentInstance
is_slot
Type: bool
Is this node a Slot?
InstantiationArgs
Construction payload used when compiler-generated code instantiates an InstanceNode.
Properties
prototypical_common_properties
Type: CommonPropertiesInit
prototypical_properties
Type: PropertiesInit
handler_registry
Type: Option<Rc<RefCell<HandlerRegistry>>>
children
Type: Option<InstanceNodePtrList>
component_template
Type: Option<InstanceNodePtrList>
component_settings
Type: Option<Vec<SettingsBlockElement>>
template_node_identifier
Type: Option<UniqueTemplateNodeIdentifier>
template_node_type_id
Type: Option<TypeId>
template_node_selector_info
Type: Option<TemplateNodeSelectorInfo>
transition_config
Type: ComponentTransitionConfig
properties_scope
Type: PropertiesScopeInit
ReusableInstanceNodeArgs
Lightweight clone of reusable base-node data for helper constructors.
Properties
handler_registry
Type: Option<Rc<RefCell<HandlerRegistry>>>
children
Type: InstanceNodePtrList
template_node_identifier
Type: Option<UniqueTemplateNodeIdentifier>
template_node_type_id
Type: Option<TypeId>
template_node_selector_info
Type: Option<TemplateNodeSelectorInfo>
Implementations
new
pub fn new(base: &BaseInstance) -> Self
Capture the reusable portions of a BaseInstance.
StrokeInstance
Resolved stroke style used by canvas drawing primitives.
Properties
color
Type: Color
width
Type: f64
style
Type: StrokeStyle
Enums
CommonPropertiesInit
Structured initialization for node-local common properties.
Variants
Default
Inline { defined_properties: BTreeMap<String, ValueDefinition> }
Template(Rc<TemplatePropertyPlan>)
Factory(CommonPropertiesFactory)
NodeType
Coarse runtime category for an instance node.
Variants
Component
Primitive
PropertiesInit
Structured initialization for node-local typed properties.
Variants
DescriptorDefault(&'static ErasedComponentDescriptor)
DescriptorInline { descriptor: &'static ErasedComponentDescriptor, defined_properties: BTreeMap<String, ValueDefinition> }
Template { descriptor: &'static ErasedComponentDescriptor, plan: Rc<TemplatePropertyPlan> }
Factory(PropertiesFactory)
PropertiesScopeInit
How an expanded node should expose component-local symbols into scope.
Variants
None
Descriptor(&'static ErasedComponentDescriptor)
Factory(PropertiesScopeFactory)
Traits
InstanceNode
Central runtime representation of a properties-computable and renderable node.
InstanceNodes are conceptually stateless, and rely on [ExpandedNode]s for stateful representations.
An InstanceNode sits in between a pax_compiler::TemplateNodeDefinition, the
compile-time definition analogue to this instance, and [ExpandedNode].
There is a 1:1 relationship between pax_compiler::TemplateNodeDefinitions and InstanceNodes.
There is a one-to-many relationship between one InstanceNode and possibly many variant [ExpandedNode]s,
due to duplication via for.
InstanceNodes are architecturally "type-aware" — they can perform type-specific operations e.g. on the state stored in [ExpandedNode], while
[ExpandedNode]s are "type-blind". The latter store polymorphic data but cannot operate on it without the type-aware assistance of their linked InstanceNode.
(See RepeatInstance::expand_node where we visit a singular InstanceNode several times, producing multiple [ExpandedNode]s.)
Type Aliases
InstanceNodePtr
Type aliases to make it easier to work with nested Rcs and RefCells for instance nodes.