Skip to main content

aetna_core/tree/
defaults.rs

1//! Default values for [`El`].
2//!
3//! Keeping this separate from the field list makes it easier to review
4//! default-policy changes without scanning the whole node surface.
5
6use crate::image::ImageFit;
7use crate::style::StyleProfile;
8
9use super::geometry::{Corners, Sides};
10use super::layout_types::{Align, Axis, Justify, Size};
11use super::node::El;
12use super::semantics::{Kind, Source, SurfaceRole};
13use super::text_types::{FontFamily, FontWeight, TextAlign, TextOverflow, TextRole, TextWrap};
14
15impl Default for El {
16    fn default() -> Self {
17        Self {
18            kind: Kind::Group,
19            style_profile: StyleProfile::TextOnly,
20            key: None,
21            block_pointer: false,
22            focusable: false,
23            always_show_focus_ring: false,
24            selectable: false,
25            capture_keys: false,
26            alpha_follows_focused_ancestor: false,
27            blink_when_focused: false,
28            state_follows_interactive_ancestor: false,
29            hover_alpha: None,
30            source: Source::default(),
31            axis: Axis::Overlay,
32            gap: 0.0,
33            padding: Sides::zero(),
34            align: Align::Stretch,
35            justify: Justify::Start,
36            width: Size::Hug,
37            height: Size::Hug,
38            component_size: None,
39            metrics_role: None,
40            explicit_width: false,
41            explicit_height: false,
42            explicit_padding: false,
43            explicit_gap: false,
44            explicit_radius: false,
45            explicit_font_family: false,
46            explicit_mono_font_family: false,
47            explicit_mono: false,
48            fill: None,
49            dim_fill: None,
50            stroke: None,
51            stroke_width: 0.0,
52            radius: Corners::ZERO,
53            shadow: 0.0,
54            surface_role: SurfaceRole::None,
55            paint_overflow: Sides::zero(),
56            clip: false,
57            scrollable: false,
58            pin_end: false,
59            arrow_nav_siblings: false,
60            tooltip: None,
61            cursor: None,
62            cursor_pressed: None,
63            shader_override: None,
64            layout_override: None,
65            virtual_items: None,
66            scrollbar: false,
67            text: None,
68            text_color: None,
69            text_align: TextAlign::Start,
70            text_wrap: TextWrap::NoWrap,
71            text_overflow: TextOverflow::Clip,
72            text_role: TextRole::Body,
73            text_max_lines: None,
74            font_size: crate::tokens::TEXT_SM.size,
75            line_height: crate::tokens::TEXT_SM.line_height,
76            font_family: FontFamily::default(),
77            mono_font_family: FontFamily::JetBrainsMono,
78            font_weight: FontWeight::Regular,
79            font_mono: false,
80            text_italic: false,
81            text_bg: None,
82            text_underline: false,
83            text_strikethrough: false,
84            text_link: None,
85            icon: None,
86            icon_stroke_width: 2.0,
87            image: None,
88            image_tint: None,
89            image_fit: ImageFit::Contain,
90            surface_source: None,
91            surface_alpha: crate::surface::SurfaceAlpha::Premultiplied,
92            surface_fit: ImageFit::Fill,
93            surface_transform: crate::affine::Affine2::IDENTITY,
94            vector_source: None,
95            vector_render_mode: crate::vector::VectorRenderMode::Painted,
96            children: Vec::new(),
97            opacity: 1.0,
98            translate: (0.0, 0.0),
99            scale: 1.0,
100            animate: None,
101            redraw_within: None,
102            computed_id: String::new(),
103        }
104    }
105}