ltn/components/
left_panel.rs1use widgetry::{
2 CornerRounding, EventCtx, HorizontalAlignment, Panel, PanelBuilder, PanelDims,
3 VerticalAlignment, Widget,
4};
5
6use super::AppwidePanel;
7
8pub struct LeftPanel;
9
10impl LeftPanel {
11 pub fn builder(ctx: &EventCtx, top_panel: &Panel, contents: Widget) -> PanelBuilder {
13 let top_height = top_panel.panel_dims().height;
14 Panel::new_builder(contents.corner_rounding(CornerRounding::NoRounding))
15 .aligned(
16 HorizontalAlignment::Left,
17 VerticalAlignment::Below(top_height),
18 )
19 .dims_height(PanelDims::ExactPixels(
20 ctx.canvas.window_height - top_height,
21 ))
22 }
23
24 pub fn right_of_proposals(
25 ctx: &EventCtx,
26 appwide_panel: &AppwidePanel,
27 contents: Widget,
28 ) -> PanelBuilder {
29 let buffer = 5.0;
30 let top_height = appwide_panel.top_panel.panel_dims().height;
31 Panel::new_builder(contents)
32 .aligned(
33 HorizontalAlignment::RightOf(appwide_panel.left_panel.panel_dims().width + buffer),
34 VerticalAlignment::Below(top_height),
35 )
36 .dims_height(PanelDims::ExactPixels(
37 ctx.canvas.window_height - top_height,
38 ))
39 }
40}
41
42pub struct BottomPanel;
43
44impl BottomPanel {
45 pub fn new(ctx: &mut EventCtx, appwide_panel: &AppwidePanel, contents: Widget) -> Panel {
46 let left_panel_width = appwide_panel.left_panel.panel_dims().width;
47 Panel::new_builder(contents.corner_rounding(CornerRounding::NoRounding))
48 .aligned(
49 HorizontalAlignment::RightOf(left_panel_width),
50 VerticalAlignment::Bottom,
51 )
52 .dims_width(PanelDims::ExactPixels(
53 ctx.canvas.window_width - left_panel_width,
54 ))
55 .build(ctx)
56 }
57}