Struct Split

Source
pub struct Split<T> { /* private fields */ }
Expand description

A container containing two other widgets, splitting the area either horizontally or vertically.

Implementations§

Source§

impl<T> Split<T>

Source

pub fn columns( left_child: impl Widget<T> + 'static, right_child: impl Widget<T> + 'static, ) -> Self

Create a new split panel, with the horizontal axis split in two by a vertical bar.

Examples found in repository?
examples/invalidation.rs (line 55)
49fn build_widget() -> impl Widget<AppState> {
50    let mut col = Flex::column();
51    col.add_child(TextBox::new().lens(AppState::label).padding(3.0));
52    for i in 0..30 {
53        col.add_child(Button::new(format!("Button {i}")).padding(3.0));
54    }
55    Split::columns(Scroll::new(col), CircleView.lens(AppState::circles)).debug_invalidation()
56}
More examples
Hide additional examples
examples/markdown_preview.rs (line 134)
115fn build_root_widget() -> impl Widget<AppState> {
116    let label = Scroll::new(
117        RawLabel::new()
118            .with_text_color(Color::BLACK)
119            .with_line_break_mode(LineBreaking::WordWrap)
120            .lens(AppState::rendered)
121            .expand_width()
122            .padding((SPACER_SIZE * 4.0, SPACER_SIZE)),
123    )
124    .vertical()
125    .background(Color::grey8(222))
126    .expand();
127
128    let textbox = TextBox::multiline()
129        .lens(AppState::raw)
130        .controller(RichTextRebuilder)
131        .expand()
132        .padding(5.0);
133
134    Split::columns(label, textbox)
135}
examples/split_demo.rs (lines 28-31)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
examples/view_switcher.rs (lines 89-92)
41fn make_ui() -> impl Widget<AppState> {
42    let mut switcher_column = Flex::column();
43    switcher_column.add_child(
44        Label::new(|data: &u32, _env: &Env| format!("Current view: {data}"))
45            .lens(AppState::current_view),
46    );
47    for i in 0..6 {
48        switcher_column.add_spacer(80.);
49        switcher_column.add_child(
50            Button::new(format!("View {i}"))
51                .on_click(move |_event, data: &mut u32, _env| {
52                    *data = i;
53                })
54                .lens(AppState::current_view),
55        );
56    }
57
58    let view_switcher = ViewSwitcher::new(
59        |data: &AppState, _env| data.current_view,
60        |selector, _data, _env| match selector {
61            0 => Box::new(Label::new("Simple Label").center()),
62            1 => Box::new(
63                Button::new("Simple Button").on_click(|_event, _data, _env| {
64                    println!("Simple button clicked!");
65                }),
66            ),
67            2 => Box::new(
68                Button::new("Another Simple Button").on_click(|_event, _data, _env| {
69                    println!("Another simple button clicked!");
70                }),
71            ),
72            3 => Box::new(
73                Flex::column()
74                    .with_flex_child(Label::new("Here is a label").center(), 1.0)
75                    .with_flex_child(
76                        Button::new("Button").on_click(|_event, _data, _env| {
77                            println!("Complex button clicked!");
78                        }),
79                        1.0,
80                    )
81                    .with_flex_child(TextBox::new().lens(AppState::current_text), 1.0)
82                    .with_flex_child(
83                        Label::new(|data: &String, _env: &Env| format!("Value entered: {data}"))
84                            .lens(AppState::current_text),
85                        1.0,
86                    ),
87            ),
88            4 => Box::new(
89                Split::columns(
90                    Label::new("Left split").center(),
91                    Label::new("Right split").center(),
92                )
93                .draggable(true),
94            ),
95            _ => Box::new(Label::new("Unknown").center()),
96        },
97    );
98
99    Flex::row()
100        .with_child(switcher_column)
101        .with_flex_child(view_switcher, 1.0)
102}
Source

pub fn rows( upper_child: impl Widget<T> + 'static, lower_child: impl Widget<T> + 'static, ) -> Self

Create a new split panel, with the vertical axis split in two by a horizontal bar.

Examples found in repository?
examples/tabs.rs (line 244)
208fn build_tab_widget(tab_config: &TabConfig) -> impl Widget<AppState> {
209    let dyn_tabs = Tabs::for_policy(NumberedTabs)
210        .with_axis(tab_config.axis)
211        .with_edge(tab_config.edge)
212        .with_transition(tab_config.transition)
213        .lens(AppState::advanced);
214
215    let control_dynamic = Flex::column()
216        .cross_axis_alignment(CrossAxisAlignment::Start)
217        .with_child(Label::new("Control dynamic tabs"))
218        .with_child(Button::new("Add a tab").on_click(|_c, d: &mut DynamicTabData, _e| d.add_tab()))
219        .with_child(Label::new(|adv: &DynamicTabData, _e: &Env| {
220            format!("Highest tab number is {}", adv.highest_tab)
221        }))
222        .with_spacer(20.)
223        .lens(AppState::advanced);
224
225    let first_static_tab = Flex::row()
226        .with_child(Label::new("Rename tab:"))
227        .with_child(TextBox::new().lens(AppState::first_tab_name));
228
229    let main_tabs = Tabs::new()
230        .with_axis(tab_config.axis)
231        .with_edge(tab_config.edge)
232        .with_transition(tab_config.transition)
233        .with_tab(
234            |app_state: &AppState, _: &Env| app_state.first_tab_name.to_string(),
235            first_static_tab,
236        )
237        .with_tab("Dynamic", control_dynamic)
238        .with_tab("Page 3", Label::new("Page 3 content"))
239        .with_tab("Page 4", Label::new("Page 4 content"))
240        .with_tab("Page 5", Label::new("Page 5 content"))
241        .with_tab("Page 6", Label::new("Page 6 content"))
242        .with_tab_index(1);
243
244    Split::rows(main_tabs, dyn_tabs).draggable(true)
245}
More examples
Hide additional examples
examples/split_demo.rs (lines 39-42)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
Source

pub fn split_point(self, split_point: f64) -> Self

Builder-style method to set the split point as a fraction of the split axis.

The value must be between 0.0 and 1.0, inclusive. The default split point is 0.5.

Examples found in repository?
examples/split_demo.rs (line 32)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
Source

pub fn min_size(self, first: f64, second: f64) -> Self

Builder-style method to set the minimum size for both sides of the split axis.

The value must be greater than or equal to 0.0. The value will be rounded up to the nearest integer.

Examples found in repository?
examples/split_demo.rs (line 58)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
Source

pub fn bar_size(self, bar_size: f64) -> Self

Builder-style method to set the size of the splitter bar.

The value must be positive or zero. The value will be rounded up to the nearest integer. The default splitter bar size is 6.0.

Examples found in repository?
examples/split_demo.rs (line 44)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
Source

pub fn min_bar_area(self, min_bar_area: f64) -> Self

Builder-style method to set the minimum size of the splitter bar area.

The minimum splitter bar area defines the minimum size of the area where mouse hit detection is done for the splitter bar. The final area is either this or the splitter bar size, whichever is greater.

This can be useful when you want to use a very narrow visual splitter bar, but don’t want to sacrifice user experience by making it hard to click on.

The value must be positive or zero. The value will be rounded up to the nearest integer. The default minimum splitter bar area is 6.0.

Examples found in repository?
examples/split_demo.rs (line 69)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
Source

pub fn draggable(self, draggable: bool) -> Self

Builder-style method to set whether the split point can be changed by dragging.

Examples found in repository?
examples/tabs.rs (line 244)
208fn build_tab_widget(tab_config: &TabConfig) -> impl Widget<AppState> {
209    let dyn_tabs = Tabs::for_policy(NumberedTabs)
210        .with_axis(tab_config.axis)
211        .with_edge(tab_config.edge)
212        .with_transition(tab_config.transition)
213        .lens(AppState::advanced);
214
215    let control_dynamic = Flex::column()
216        .cross_axis_alignment(CrossAxisAlignment::Start)
217        .with_child(Label::new("Control dynamic tabs"))
218        .with_child(Button::new("Add a tab").on_click(|_c, d: &mut DynamicTabData, _e| d.add_tab()))
219        .with_child(Label::new(|adv: &DynamicTabData, _e: &Env| {
220            format!("Highest tab number is {}", adv.highest_tab)
221        }))
222        .with_spacer(20.)
223        .lens(AppState::advanced);
224
225    let first_static_tab = Flex::row()
226        .with_child(Label::new("Rename tab:"))
227        .with_child(TextBox::new().lens(AppState::first_tab_name));
228
229    let main_tabs = Tabs::new()
230        .with_axis(tab_config.axis)
231        .with_edge(tab_config.edge)
232        .with_transition(tab_config.transition)
233        .with_tab(
234            |app_state: &AppState, _: &Env| app_state.first_tab_name.to_string(),
235            first_static_tab,
236        )
237        .with_tab("Dynamic", control_dynamic)
238        .with_tab("Page 3", Label::new("Page 3 content"))
239        .with_tab("Page 4", Label::new("Page 4 content"))
240        .with_tab("Page 5", Label::new("Page 5 content"))
241        .with_tab("Page 6", Label::new("Page 6 content"))
242        .with_tab_index(1);
243
244    Split::rows(main_tabs, dyn_tabs).draggable(true)
245}
More examples
Hide additional examples
examples/split_demo.rs (line 56)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}
examples/view_switcher.rs (line 93)
41fn make_ui() -> impl Widget<AppState> {
42    let mut switcher_column = Flex::column();
43    switcher_column.add_child(
44        Label::new(|data: &u32, _env: &Env| format!("Current view: {data}"))
45            .lens(AppState::current_view),
46    );
47    for i in 0..6 {
48        switcher_column.add_spacer(80.);
49        switcher_column.add_child(
50            Button::new(format!("View {i}"))
51                .on_click(move |_event, data: &mut u32, _env| {
52                    *data = i;
53                })
54                .lens(AppState::current_view),
55        );
56    }
57
58    let view_switcher = ViewSwitcher::new(
59        |data: &AppState, _env| data.current_view,
60        |selector, _data, _env| match selector {
61            0 => Box::new(Label::new("Simple Label").center()),
62            1 => Box::new(
63                Button::new("Simple Button").on_click(|_event, _data, _env| {
64                    println!("Simple button clicked!");
65                }),
66            ),
67            2 => Box::new(
68                Button::new("Another Simple Button").on_click(|_event, _data, _env| {
69                    println!("Another simple button clicked!");
70                }),
71            ),
72            3 => Box::new(
73                Flex::column()
74                    .with_flex_child(Label::new("Here is a label").center(), 1.0)
75                    .with_flex_child(
76                        Button::new("Button").on_click(|_event, _data, _env| {
77                            println!("Complex button clicked!");
78                        }),
79                        1.0,
80                    )
81                    .with_flex_child(TextBox::new().lens(AppState::current_text), 1.0)
82                    .with_flex_child(
83                        Label::new(|data: &String, _env: &Env| format!("Value entered: {data}"))
84                            .lens(AppState::current_text),
85                        1.0,
86                    ),
87            ),
88            4 => Box::new(
89                Split::columns(
90                    Label::new("Left split").center(),
91                    Label::new("Right split").center(),
92                )
93                .draggable(true),
94            ),
95            _ => Box::new(Label::new("Unknown").center()),
96        },
97    );
98
99    Flex::row()
100        .with_child(switcher_column)
101        .with_flex_child(view_switcher, 1.0)
102}
Source

pub fn solid_bar(self, solid: bool) -> Self

Builder-style method to set whether the splitter bar is drawn as a solid rectangle.

If this is false (the default), the bar will be drawn as two parallel lines.

Examples found in repository?
examples/split_demo.rs (line 57)
24fn build_app() -> impl Widget<u32> {
25    let fixed_cols = Padding::new(
26        10.0,
27        Container::new(
28            Split::columns(
29                Align::centered(Label::new("Left Split")),
30                Align::centered(Label::new("Right Split")),
31            )
32            .split_point(0.5),
33        )
34        .border(Color::WHITE, 1.0),
35    );
36    let fixed_rows = Padding::new(
37        10.0,
38        Container::new(
39            Split::rows(
40                Align::centered(Label::new("Top Split")),
41                Align::centered(Label::new("Bottom Split")),
42            )
43            .split_point(0.4)
44            .bar_size(3.0),
45        )
46        .border(Color::WHITE, 1.0),
47    );
48    let draggable_cols = Padding::new(
49        10.0,
50        Container::new(
51            Split::columns(
52                Align::centered(Label::new("Split A")),
53                Align::centered(Label::new("Split B")),
54            )
55            .split_point(0.5)
56            .draggable(true)
57            .solid_bar(true)
58            .min_size(60.0, 60.0),
59        )
60        .border(Color::WHITE, 1.0),
61    );
62    Padding::new(
63        10.0,
64        Container::new(
65            Split::rows(
66                Split::rows(fixed_cols, fixed_rows)
67                    .split_point(0.33)
68                    .bar_size(3.0)
69                    .min_bar_area(3.0)
70                    .draggable(true),
71                draggable_cols,
72            )
73            .split_point(0.75)
74            .bar_size(5.0)
75            .min_bar_area(11.0)
76            .draggable(true),
77        )
78        .border(Color::WHITE, 1.0),
79    )
80}

Trait Implementations§

Source§

impl<T: Data> Widget<T> for Split<T>

Source§

fn event( &mut self, ctx: &mut EventCtx<'_, '_>, event: &Event, data: &mut T, env: &Env, )

Handle an event. Read more
Source§

fn lifecycle( &mut self, ctx: &mut LifeCycleCtx<'_, '_>, event: &LifeCycle, data: &T, env: &Env, )

Handle a life cycle notification. Read more
Source§

fn update( &mut self, ctx: &mut UpdateCtx<'_, '_>, _old_data: &T, data: &T, env: &Env, )

Update the widget’s appearance in response to a change in the app’s Data or Env. Read more
Source§

fn layout( &mut self, ctx: &mut LayoutCtx<'_, '_>, bc: &BoxConstraints, data: &T, env: &Env, ) -> Size

Compute layout. Read more
Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)

Paint the widget appearance. Read more
Source§

fn compute_max_intrinsic( &mut self, axis: Axis, ctx: &mut LayoutCtx<'_, '_>, bc: &BoxConstraints, data: &T, env: &Env, ) -> f64

Computes max intrinsic/preferred dimension of a widget on the provided axis. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for Split<T>

§

impl<T> !RefUnwindSafe for Split<T>

§

impl<T> !Send for Split<T>

§

impl<T> !Sync for Split<T>

§

impl<T> Unpin for Split<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Split<T>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> RoundFrom<T> for T

Source§

fn round_from(x: T) -> T

Performs the conversion.
Source§

impl<T, U> RoundInto<U> for T
where U: RoundFrom<T>,

Source§

fn round_into(self) -> U

Performs the conversion.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, W> TestWidgetExt<T> for W
where T: Data, W: Widget<T> + 'static,

Source§

fn record(self, recording: &Recording) -> Recorder<Self>

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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, W> WidgetExt<T> for W
where T: Data, W: Widget<T> + 'static,

Source§

fn padding(self, insets: impl Into<KeyOrValue<Insets>>) -> Padding<T, Self>

Wrap this widget in a Padding widget with the given Insets. Read more
Source§

fn center(self) -> Align<T>

Wrap this widget in an Align widget, configured to center it.
Source§

fn align_left(self) -> Align<T>

Wrap this widget in an Align widget, configured to align left.
Source§

fn align_right(self) -> Align<T>

Wrap this widget in an Align widget, configured to align right.
Source§

fn align_vertical(self, align: UnitPoint) -> Align<T>

Wrap this widget in an Align widget, configured to align vertically.
Source§

fn align_horizontal(self, align: UnitPoint) -> Align<T>

Wrap this widget in an Align widget, configured to align horizontally.
Source§

fn fix_width(self, width: impl Into<KeyOrValue<f64>>) -> SizedBox<T>

Wrap this widget in a SizedBox with an explicit width.
Source§

fn fix_height(self, height: impl Into<KeyOrValue<f64>>) -> SizedBox<T>

Wrap this widget in a SizedBox with an explicit height.
Source§

fn fix_size( self, width: impl Into<KeyOrValue<f64>>, height: impl Into<KeyOrValue<f64>>, ) -> SizedBox<T>

Wrap this widget in an SizedBox with an explicit width and height
Source§

fn expand(self) -> SizedBox<T>

Wrap this widget in a SizedBox with an infinite width and height. Read more
Source§

fn expand_width(self) -> SizedBox<T>

Wrap this widget in a SizedBox with an infinite width. Read more
Source§

fn expand_height(self) -> SizedBox<T>

Wrap this widget in a SizedBox with an infinite width. Read more
Source§

fn background(self, brush: impl Into<BackgroundBrush<T>>) -> Container<T>

Wrap this widget in a Container with the provided background brush. Read more
Source§

fn foreground(self, brush: impl Into<BackgroundBrush<T>>) -> Container<T>

Wrap this widget in a Container with the provided foreground brush. Read more
Source§

fn border( self, color: impl Into<KeyOrValue<Color>>, width: impl Into<KeyOrValue<f64>>, ) -> Container<T>

Wrap this widget in a Container with the given border. Read more
Source§

fn env_scope(self, f: impl Fn(&mut Env, &T) + 'static) -> EnvScope<T, Self>

Wrap this widget in a EnvScope widget, modifying the parent Env with the provided closure.
Source§

fn controller<C: Controller<T, Self>>( self, controller: C, ) -> ControllerHost<Self, C>

Wrap this widget with the provided Controller.
Source§

fn on_added( self, f: impl Fn(&mut Self, &mut LifeCycleCtx<'_, '_>, &T, &Env) + 'static, ) -> ControllerHost<Self, Added<T, Self>>

Provide a closure that will be called when this widget is added to the widget tree. Read more
Source§

fn on_click( self, f: impl Fn(&mut EventCtx<'_, '_>, &mut T, &Env) + 'static, ) -> ControllerHost<Self, Click<T>>

Control the events of this widget with a Click widget. The closure provided will be called when the widget is clicked with the left mouse button. Read more
Source§

fn debug_paint_layout(self) -> EnvScope<T, Self>

Draw the layout Rects of this widget and its children.
Source§

fn debug_widget_id(self) -> EnvScope<T, Self>

Display the WidgetIds for this widget and its children, when hot. Read more
Source§

fn debug_invalidation(self) -> DebugInvalidation<T, Self>

Draw a color-changing rectangle over this widget, allowing you to see the invalidation regions.
Source§

fn debug_widget(self) -> EnvScope<T, Self>

Set the DEBUG_WIDGET env variable for this widget (and its descendants). Read more
Source§

fn lens<S: Data, L: Lens<S, T>>(self, lens: L) -> LensWrap<S, T, L, Self>

Wrap this widget in a LensWrap widget for the provided Lens.
Source§

fn with_id(self, id: WidgetId) -> IdentityWrapper<Self>

Assign the widget a specific WidgetId. Read more
Source§

fn boxed(self) -> Box<dyn Widget<T>>

Wrap this widget in a Box.
Source§

fn scroll(self) -> Scroll<T, Self>

Wrap this widget in a Scroll widget.
Source§

fn disabled_if( self, disabled_if: impl Fn(&T, &Env) -> bool + 'static, ) -> DisabledIf<T, Self>

Wrap this widget in a DisabledIf widget. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more