feat!(widget): rewrite button & icon widget APIs
This commit is contained in:
parent
18debe546d
commit
4e4eeaac12
60 changed files with 2191 additions and 1113 deletions
|
|
@ -1,11 +1,10 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use iced::Color;
|
||||
use slotmap::{SecondaryMap, SparseSecondaryMap};
|
||||
|
||||
use super::{Entity, Model, Selectable};
|
||||
use crate::widget::IconSource;
|
||||
use crate::widget::icon::Icon;
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// A builder for a [`Model`].
|
||||
|
|
@ -104,18 +103,11 @@ where
|
|||
/// .build()
|
||||
/// ```
|
||||
#[allow(clippy::must_use_candidate, clippy::return_self_not_must_use)]
|
||||
pub fn icon(mut self, icon: impl Into<IconSource<'static>>) -> Self {
|
||||
pub fn icon(mut self, icon: Icon) -> Self {
|
||||
self.model.0.icon_set(self.id, icon);
|
||||
self
|
||||
}
|
||||
|
||||
/// Defines the color of an icon.
|
||||
#[allow(clippy::must_use_candidate, clippy::return_self_not_must_use)]
|
||||
pub fn icon_color(mut self, icon: Option<Color>) -> Self {
|
||||
self.model.0.icon_color_set(self.id, icon);
|
||||
self
|
||||
}
|
||||
|
||||
/// Define the position of the newly-inserted item.
|
||||
#[allow(clippy::must_use_candidate, clippy::return_self_not_must_use)]
|
||||
pub fn position(mut self, position: u16) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue