2022-12-28 23:18:31 +01:00
|
|
|
// Copyright 2022 System76 <info@system76.com>
|
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2023-01-04 05:37:20 +01:00
|
|
|
use super::{HorizontalSegmentedButton, SegmentedButton, State, VerticalSegmentedButton};
|
2022-12-28 23:18:31 +01:00
|
|
|
|
|
|
|
|
/// Appears as a collection of tabs for developing a tabbed interface.
|
|
|
|
|
///
|
|
|
|
|
/// The data for the widget comes from a [`State`] that is maintained the application.
|
|
|
|
|
#[must_use]
|
2023-01-03 19:35:34 +01:00
|
|
|
pub fn horizontal_view_switcher<Message, Data>(
|
2022-12-28 23:18:31 +01:00
|
|
|
state: &State<Data>,
|
2023-01-03 19:35:34 +01:00
|
|
|
) -> HorizontalSegmentedButton<Message, crate::Renderer> {
|
2023-01-04 05:37:20 +01:00
|
|
|
SegmentedButton::new(&state.inner)
|
2022-12-30 17:39:35 +01:00
|
|
|
.button_padding([16, 0, 16, 0])
|
|
|
|
|
.button_height(48)
|
2022-12-28 23:18:31 +01:00
|
|
|
.style(crate::theme::SegmentedButton::ViewSwitcher)
|
2022-12-28 23:39:29 +01:00
|
|
|
.font_active(crate::font::FONT_SEMIBOLD)
|
2022-12-28 23:18:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Appears as a selection of choices for choosing between.
|
|
|
|
|
///
|
|
|
|
|
/// The data for the widget comes from a [`State`] that is maintained the application.
|
|
|
|
|
#[must_use]
|
2023-01-03 19:35:34 +01:00
|
|
|
pub fn horizontal_segmented_selection<Message, Data>(
|
2022-12-28 23:18:31 +01:00
|
|
|
state: &State<Data>,
|
2023-01-03 19:35:34 +01:00
|
|
|
) -> HorizontalSegmentedButton<Message, crate::Renderer> {
|
2023-01-04 05:37:20 +01:00
|
|
|
SegmentedButton::new(&state.inner)
|
2022-12-30 17:39:35 +01:00
|
|
|
.button_padding([16, 0, 16, 0])
|
|
|
|
|
.button_height(32)
|
2022-12-28 23:18:31 +01:00
|
|
|
.style(crate::theme::SegmentedButton::Selection)
|
2022-12-28 23:39:29 +01:00
|
|
|
.font_active(crate::font::FONT_SEMIBOLD)
|
2022-12-28 23:18:31 +01:00
|
|
|
}
|
2023-01-03 19:35:34 +01:00
|
|
|
|
|
|
|
|
/// Appears as a selection of choices for choosing between.
|
|
|
|
|
///
|
|
|
|
|
/// The data for the widget comes from a [`State`] that is maintained the application.
|
|
|
|
|
#[must_use]
|
|
|
|
|
pub fn vertical_segmented_selection<Message, Data>(
|
|
|
|
|
state: &State<Data>,
|
|
|
|
|
) -> VerticalSegmentedButton<Message, crate::Renderer> {
|
2023-01-04 05:37:20 +01:00
|
|
|
SegmentedButton::new(&state.inner)
|
2023-01-03 19:35:34 +01:00
|
|
|
.button_padding([16, 0, 16, 0])
|
|
|
|
|
.button_height(32)
|
|
|
|
|
.style(crate::theme::SegmentedButton::Selection)
|
|
|
|
|
.font_active(crate::font::FONT_SEMIBOLD)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Appears as a collection of tabs for developing a tabbed interface.
|
|
|
|
|
///
|
|
|
|
|
/// The data for the widget comes from a [`State`] that is maintained the application.
|
|
|
|
|
#[must_use]
|
|
|
|
|
pub fn vertical_view_switcher<Message, Data>(
|
|
|
|
|
state: &State<Data>,
|
|
|
|
|
) -> VerticalSegmentedButton<Message, crate::Renderer> {
|
2023-01-04 05:37:20 +01:00
|
|
|
SegmentedButton::new(&state.inner)
|
2023-01-03 19:35:34 +01:00
|
|
|
.button_padding([16, 0, 16, 0])
|
|
|
|
|
.button_height(48)
|
|
|
|
|
.style(crate::theme::SegmentedButton::ViewSwitcher)
|
|
|
|
|
.font_active(crate::font::FONT_SEMIBOLD)
|
|
|
|
|
}
|