-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update header crates for iced-rs 0.12.1
- Loading branch information
1 parent
32857d2
commit b079297
Showing
27 changed files
with
1,244 additions
and
1,273 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use iced::Theme; | ||
use iced_core::{Background, Color}; | ||
|
||
/// The appearance of a header. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct Appearance { | ||
pub text_color: Option<Color>, | ||
pub background: Option<Background>, | ||
pub border_radius: f32, | ||
pub border_width: f32, | ||
pub border_color: Color, | ||
pub offset_left: f32, | ||
pub offset_right: f32, | ||
} | ||
|
||
/// A set of rules that dictate the style of a header. | ||
pub trait StyleSheet { | ||
type Style: std::default::Default + Copy; | ||
|
||
/// Produces the style of a header. | ||
fn appearance(&self, style: &Self::Style) -> Appearance; | ||
|
||
/// Produces the a hovered appearance for header. | ||
fn hovered(&self, style: &Self::Style) -> Appearance; | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] | ||
pub enum HeaderStyle { | ||
#[default] | ||
Default, | ||
} | ||
|
||
impl StyleSheet for Theme { | ||
type Style = HeaderStyle; | ||
|
||
fn appearance(&self, style: &Self::Style) -> Appearance { | ||
match style { | ||
HeaderStyle::Default => Appearance { | ||
//text_color: Some(self.palette.bright.surface), | ||
text_color: None, | ||
background: Some(Background::Color(self.palette().primary)), | ||
border_radius: 0.0, | ||
border_width: 0.0, | ||
border_color: Color::TRANSPARENT, | ||
offset_right: 0.0, | ||
offset_left: 0.0, | ||
}, | ||
} | ||
} | ||
|
||
fn hovered(&self, style: &Self::Style) -> Appearance { | ||
let appearance = self.appearance(style); | ||
Appearance { | ||
background: None, | ||
..appearance | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
use iced::Theme; | ||
use iced::{Background, Color}; | ||
|
||
/// The appearance of a table row. | ||
#[derive(Debug, Clone, Copy, Default)] | ||
pub struct Appearance { | ||
pub text_color: Option<Color>, | ||
pub background: Option<Background>, | ||
pub border_radius: f32, | ||
pub border_width: f32, | ||
pub border_color: Color, | ||
pub offset_left: f32, | ||
pub offset_right: f32, | ||
} | ||
|
||
/// A set of rules that dictate the style of a table row. | ||
pub trait StyleSheet { | ||
type Style: std::default::Default + Copy; | ||
|
||
/// Produces the default appearance of a table row. | ||
fn appearance(&self, style: &Self::Style) -> Appearance; | ||
|
||
/// Produces the hovered appearance table row. | ||
fn hovered(&self, style: &Self::Style) -> Appearance; | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] | ||
pub enum TableRowStyle { | ||
#[default] | ||
Default, | ||
TableRowAlternate, | ||
TableRowHighlife, | ||
TableRowLowlife, | ||
TableRowSelected, | ||
} | ||
|
||
impl StyleSheet for Theme { | ||
type Style = TableRowStyle; | ||
|
||
fn appearance(&self, style: &Self::Style) -> Appearance { | ||
match style { | ||
TableRowStyle::Default => Appearance { | ||
text_color: Some(self.palette().primary), | ||
background: Some(Background::Color(self.palette().primary)), | ||
border_radius: 0.0, | ||
border_width: 0.0, | ||
border_color: Color::TRANSPARENT, | ||
// offset_left: 10.0, | ||
// offset_right: 25.0, | ||
offset_left: 0.0, | ||
offset_right: 0.0, | ||
}, | ||
TableRowStyle::TableRowAlternate => Appearance { | ||
background: Some(Background::Color(Color { | ||
a: 0.50, | ||
..self.palette().primary | ||
})), | ||
..Appearance::default() | ||
}, | ||
TableRowStyle::TableRowHighlife => Appearance { | ||
text_color: Some(self.palette().primary), | ||
background: Some(Background::Color(Color { | ||
a: 0.30, | ||
..self.palette().primary | ||
})), | ||
border_radius: 0.0, | ||
border_width: 0.0, | ||
border_color: Color::TRANSPARENT, | ||
offset_left: 0.0, | ||
offset_right: 0.0, | ||
}, | ||
TableRowStyle::TableRowLowlife => Appearance { | ||
text_color: Some(self.palette().primary), | ||
background: Some(Background::Color(Color::TRANSPARENT)), | ||
border_radius: 0.0, | ||
border_width: 0.0, | ||
border_color: Color::TRANSPARENT, | ||
offset_left: 0.0, | ||
offset_right: 0.0, | ||
}, | ||
TableRowStyle::TableRowSelected => Appearance { | ||
text_color: Some(self.palette().primary), | ||
background: Some(Background::Color(self.palette().primary)), | ||
border_radius: 0.0, | ||
border_width: 0.0, | ||
border_color: Color::TRANSPARENT, | ||
offset_left: 0.0, | ||
offset_right: 0.0, | ||
}, | ||
} | ||
} | ||
|
||
fn hovered(&self, style: &Self::Style) -> Appearance { | ||
let appearance = self.appearance(style); | ||
|
||
match style { | ||
TableRowStyle::Default => Appearance { | ||
background: Some(Background::Color(Color { | ||
a: 0.60, | ||
..self.palette().primary | ||
})), | ||
..appearance | ||
}, | ||
TableRowStyle::TableRowAlternate => Appearance { | ||
background: Some(Background::Color(Color { | ||
a: 0.25, | ||
..self.palette().primary | ||
})), | ||
..appearance | ||
}, | ||
TableRowStyle::TableRowHighlife => Appearance { | ||
background: Some(Background::Color(Color { | ||
a: 0.60, | ||
..self.palette().primary | ||
})), | ||
..appearance | ||
}, | ||
TableRowStyle::TableRowLowlife => Appearance { | ||
background: Some(Background::Color(Color { | ||
a: 0.60, | ||
..self.palette().primary | ||
})), | ||
..appearance | ||
}, | ||
TableRowStyle::TableRowSelected => Appearance { | ||
background: Some(Background::Color(Color { | ||
a: 0.60, | ||
..self.palette().primary | ||
})), | ||
..appearance | ||
}, | ||
} | ||
} | ||
} |
Oops, something went wrong.