Struct druid::widget::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)
49
50
51
52
53
54
55
56
fn build_widget() -> impl Widget<AppState> {
    let mut col = Flex::column();
    col.add_child(TextBox::new().lens(AppState::label).padding(3.0));
    for i in 0..30 {
        col.add_child(Button::new(format!("Button {i}")).padding(3.0));
    }
    Split::columns(Scroll::new(col), CircleView.lens(AppState::circles)).debug_invalidation()
}
More examples
Hide additional examples
examples/markdown_preview.rs (line 134)
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
fn build_root_widget() -> impl Widget<AppState> {
    let label = Scroll::new(
        RawLabel::new()
            .with_text_color(Color::BLACK)
            .with_line_break_mode(LineBreaking::WordWrap)
            .lens(AppState::rendered)
            .expand_width()
            .padding((SPACER_SIZE * 4.0, SPACER_SIZE)),
    )
    .vertical()
    .background(Color::grey8(222))
    .expand();

    let textbox = TextBox::multiline()
        .lens(AppState::raw)
        .controller(RichTextRebuilder)
        .expand()
        .padding(5.0);

    Split::columns(label, textbox)
}
examples/split_demo.rs (lines 28-31)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
examples/view_switcher.rs (lines 89-92)
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
fn make_ui() -> impl Widget<AppState> {
    let mut switcher_column = Flex::column();
    switcher_column.add_child(
        Label::new(|data: &u32, _env: &Env| format!("Current view: {data}"))
            .lens(AppState::current_view),
    );
    for i in 0..6 {
        switcher_column.add_spacer(80.);
        switcher_column.add_child(
            Button::new(format!("View {i}"))
                .on_click(move |_event, data: &mut u32, _env| {
                    *data = i;
                })
                .lens(AppState::current_view),
        );
    }

    let view_switcher = ViewSwitcher::new(
        |data: &AppState, _env| data.current_view,
        |selector, _data, _env| match selector {
            0 => Box::new(Label::new("Simple Label").center()),
            1 => Box::new(
                Button::new("Simple Button").on_click(|_event, _data, _env| {
                    println!("Simple button clicked!");
                }),
            ),
            2 => Box::new(
                Button::new("Another Simple Button").on_click(|_event, _data, _env| {
                    println!("Another simple button clicked!");
                }),
            ),
            3 => Box::new(
                Flex::column()
                    .with_flex_child(Label::new("Here is a label").center(), 1.0)
                    .with_flex_child(
                        Button::new("Button").on_click(|_event, _data, _env| {
                            println!("Complex button clicked!");
                        }),
                        1.0,
                    )
                    .with_flex_child(TextBox::new().lens(AppState::current_text), 1.0)
                    .with_flex_child(
                        Label::new(|data: &String, _env: &Env| format!("Value entered: {data}"))
                            .lens(AppState::current_text),
                        1.0,
                    ),
            ),
            4 => Box::new(
                Split::columns(
                    Label::new("Left split").center(),
                    Label::new("Right split").center(),
                )
                .draggable(true),
            ),
            _ => Box::new(Label::new("Unknown").center()),
        },
    );

    Flex::row()
        .with_child(switcher_column)
        .with_flex_child(view_switcher, 1.0)
}
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)
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
fn build_tab_widget(tab_config: &TabConfig) -> impl Widget<AppState> {
    let dyn_tabs = Tabs::for_policy(NumberedTabs)
        .with_axis(tab_config.axis)
        .with_edge(tab_config.edge)
        .with_transition(tab_config.transition)
        .lens(AppState::advanced);

    let control_dynamic = Flex::column()
        .cross_axis_alignment(CrossAxisAlignment::Start)
        .with_child(Label::new("Control dynamic tabs"))
        .with_child(Button::new("Add a tab").on_click(|_c, d: &mut DynamicTabData, _e| d.add_tab()))
        .with_child(Label::new(|adv: &DynamicTabData, _e: &Env| {
            format!("Highest tab number is {}", adv.highest_tab)
        }))
        .with_spacer(20.)
        .lens(AppState::advanced);

    let first_static_tab = Flex::row()
        .with_child(Label::new("Rename tab:"))
        .with_child(TextBox::new().lens(AppState::first_tab_name));

    let main_tabs = Tabs::new()
        .with_axis(tab_config.axis)
        .with_edge(tab_config.edge)
        .with_transition(tab_config.transition)
        .with_tab(
            |app_state: &AppState, _: &Env| app_state.first_tab_name.to_string(),
            first_static_tab,
        )
        .with_tab("Dynamic", control_dynamic)
        .with_tab("Page 3", Label::new("Page 3 content"))
        .with_tab("Page 4", Label::new("Page 4 content"))
        .with_tab("Page 5", Label::new("Page 5 content"))
        .with_tab("Page 6", Label::new("Page 6 content"))
        .with_tab_index(1);

    Split::rows(main_tabs, dyn_tabs).draggable(true)
}
More examples
Hide additional examples
examples/split_demo.rs (lines 39-42)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
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)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
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)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
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)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
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)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
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)
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
fn build_tab_widget(tab_config: &TabConfig) -> impl Widget<AppState> {
    let dyn_tabs = Tabs::for_policy(NumberedTabs)
        .with_axis(tab_config.axis)
        .with_edge(tab_config.edge)
        .with_transition(tab_config.transition)
        .lens(AppState::advanced);

    let control_dynamic = Flex::column()
        .cross_axis_alignment(CrossAxisAlignment::Start)
        .with_child(Label::new("Control dynamic tabs"))
        .with_child(Button::new("Add a tab").on_click(|_c, d: &mut DynamicTabData, _e| d.add_tab()))
        .with_child(Label::new(|adv: &DynamicTabData, _e: &Env| {
            format!("Highest tab number is {}", adv.highest_tab)
        }))
        .with_spacer(20.)
        .lens(AppState::advanced);

    let first_static_tab = Flex::row()
        .with_child(Label::new("Rename tab:"))
        .with_child(TextBox::new().lens(AppState::first_tab_name));

    let main_tabs = Tabs::new()
        .with_axis(tab_config.axis)
        .with_edge(tab_config.edge)
        .with_transition(tab_config.transition)
        .with_tab(
            |app_state: &AppState, _: &Env| app_state.first_tab_name.to_string(),
            first_static_tab,
        )
        .with_tab("Dynamic", control_dynamic)
        .with_tab("Page 3", Label::new("Page 3 content"))
        .with_tab("Page 4", Label::new("Page 4 content"))
        .with_tab("Page 5", Label::new("Page 5 content"))
        .with_tab("Page 6", Label::new("Page 6 content"))
        .with_tab_index(1);

    Split::rows(main_tabs, dyn_tabs).draggable(true)
}
More examples
Hide additional examples
examples/split_demo.rs (line 56)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}
examples/view_switcher.rs (line 93)
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
fn make_ui() -> impl Widget<AppState> {
    let mut switcher_column = Flex::column();
    switcher_column.add_child(
        Label::new(|data: &u32, _env: &Env| format!("Current view: {data}"))
            .lens(AppState::current_view),
    );
    for i in 0..6 {
        switcher_column.add_spacer(80.);
        switcher_column.add_child(
            Button::new(format!("View {i}"))
                .on_click(move |_event, data: &mut u32, _env| {
                    *data = i;
                })
                .lens(AppState::current_view),
        );
    }

    let view_switcher = ViewSwitcher::new(
        |data: &AppState, _env| data.current_view,
        |selector, _data, _env| match selector {
            0 => Box::new(Label::new("Simple Label").center()),
            1 => Box::new(
                Button::new("Simple Button").on_click(|_event, _data, _env| {
                    println!("Simple button clicked!");
                }),
            ),
            2 => Box::new(
                Button::new("Another Simple Button").on_click(|_event, _data, _env| {
                    println!("Another simple button clicked!");
                }),
            ),
            3 => Box::new(
                Flex::column()
                    .with_flex_child(Label::new("Here is a label").center(), 1.0)
                    .with_flex_child(
                        Button::new("Button").on_click(|_event, _data, _env| {
                            println!("Complex button clicked!");
                        }),
                        1.0,
                    )
                    .with_flex_child(TextBox::new().lens(AppState::current_text), 1.0)
                    .with_flex_child(
                        Label::new(|data: &String, _env: &Env| format!("Value entered: {data}"))
                            .lens(AppState::current_text),
                        1.0,
                    ),
            ),
            4 => Box::new(
                Split::columns(
                    Label::new("Left split").center(),
                    Label::new("Right split").center(),
                )
                .draggable(true),
            ),
            _ => Box::new(Label::new("Unknown").center()),
        },
    );

    Flex::row()
        .with_child(switcher_column)
        .with_flex_child(view_switcher, 1.0)
}
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)
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
fn build_app() -> impl Widget<u32> {
    let fixed_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Left Split")),
                Align::centered(Label::new("Right Split")),
            )
            .split_point(0.5),
        )
        .border(Color::WHITE, 1.0),
    );
    let fixed_rows = Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Align::centered(Label::new("Top Split")),
                Align::centered(Label::new("Bottom Split")),
            )
            .split_point(0.4)
            .bar_size(3.0),
        )
        .border(Color::WHITE, 1.0),
    );
    let draggable_cols = Padding::new(
        10.0,
        Container::new(
            Split::columns(
                Align::centered(Label::new("Split A")),
                Align::centered(Label::new("Split B")),
            )
            .split_point(0.5)
            .draggable(true)
            .solid_bar(true)
            .min_size(60.0, 60.0),
        )
        .border(Color::WHITE, 1.0),
    );
    Padding::new(
        10.0,
        Container::new(
            Split::rows(
                Split::rows(fixed_cols, fixed_rows)
                    .split_point(0.33)
                    .bar_size(3.0)
                    .min_bar_area(3.0)
                    .draggable(true),
                draggable_cols,
            )
            .split_point(0.75)
            .bar_size(5.0)
            .min_bar_area(11.0)
            .draggable(true),
        )
        .border(Color::WHITE, 1.0),
    )
}

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> !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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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.

§

impl<T> RoundFrom<T> for T

§

fn round_from(x: T) -> T

Performs the conversion.
§

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

§

fn round_into(self) -> U

Performs the conversion.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

source§

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

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
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