Skip to main content

gpui_component/button/
mod.rs

1mod button;
2mod button_group;
3mod button_icon;
4mod dropdown_button;
5mod toggle;
6
7pub use button::*;
8pub use button_group::*;
9pub(crate) use button_icon::*;
10pub use dropdown_button::*;
11pub use toggle::*;
12
13/// Reads the start/end corners and edges a group assigns to its children as
14/// physical ones for the global layout direction: in RTL the group's first
15/// child sits on the right, so its "left" corners become the right ones.
16pub(crate) fn logical_corners_edges(
17    corners: gpui::Corners<bool>,
18    edges: gpui::Edges<bool>,
19    cx: &gpui::App,
20) -> (gpui::Corners<bool>, gpui::Edges<bool>) {
21    if !gpui_base::LayoutDirection::global(cx).is_rtl() {
22        return (corners, edges);
23    }
24    (
25        gpui::Corners {
26            top_left: corners.top_right,
27            top_right: corners.top_left,
28            bottom_left: corners.bottom_right,
29            bottom_right: corners.bottom_left,
30        },
31        gpui::Edges {
32            left: edges.right,
33            right: edges.left,
34            top: edges.top,
35            bottom: edges.bottom,
36        },
37    )
38}