refactor!: separate horizontal and vertical segmented button widgets

- Removes the orientation enum in favor of two separate widgets
- Implements the spacing attribute for both widgets
- Demo is updated to display spaced variants of the widgets
This commit is contained in:
Michael Aaron Murphy 2023-01-03 19:35:34 +01:00 committed by Michael Murphy
parent 3af1da6332
commit 444e389496
12 changed files with 969 additions and 547 deletions

View file

@ -1,7 +1,6 @@
// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
use crate::widget::Orientation;
use iced_core::{Background, BorderRadius, Color};
/// The appearance of a segmented button.
@ -32,6 +31,9 @@ pub trait StyleSheet {
/// The supported style of the [`StyleSheet`].
type Style: Default;
/// The [`Appearance`] of the segmented button.
fn appearance(&self, style: &Self::Style, orientation: Orientation) -> Appearance;
/// The horizontal [`Appearance`] of the segmented button.
fn horizontal(&self, style: &Self::Style) -> Appearance;
/// The vertical [`Appearance`] of the segmented button.
fn vertical(&self, style: &Self::Style) -> Appearance;
}