From d835b47e98131dc93b9c75c6b934dddbd835db92 Mon Sep 17 00:00:00 2001 From: Quinntyx <70780971+Quinntyx@users.noreply.github.com> Date: Wed, 28 Feb 2024 03:29:05 -0600 Subject: [PATCH] Added #[derive(Serialize, Deserialize)] to the Style structs under the serde feature (#227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix docking on empty main surface. (#222) * Fix docking on empty main surface. * Update changelog and bump patch number. * Bugfixes (#225) * Fix visual bug happening while a tab is being dragged. * Fix crash on retaining tabs. * Fix `filter_map_tabs` leaving leaf nodes empty. * Update changelog * Revert simple.rs * Bump patch version number. * added the derives --------- Co-authored-by: Adam Gąsior --- src/style.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/style.rs b/src/style.rs index 93042ad3..a40f3613 100644 --- a/src/style.rs +++ b/src/style.rs @@ -46,6 +46,7 @@ pub enum TabAddAlign { /// # /// ``` #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[allow(missing_docs)] pub struct Style { /// Sets padding to indent from the edges of the window. By `Default` it's `None`. @@ -63,6 +64,7 @@ pub struct Style { /// Specifies the look and feel of buttons. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct ButtonsStyle { /// Color of the close tab button. pub close_tab_color: Color32, @@ -91,6 +93,7 @@ pub struct ButtonsStyle { /// Specifies the look and feel of node separators. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct SeparatorStyle { /// Width of the rectangle separator between nodes. By `Default` it's `1.0`. pub width: f32, @@ -115,6 +118,7 @@ pub struct SeparatorStyle { /// Specifies the look and feel of tab bars. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct TabBarStyle { /// Background color of tab bar. By `Default` it's [`Color32::WHITE`]. pub bg_fill: Color32, @@ -138,6 +142,7 @@ pub struct TabBarStyle { /// Specifies the look and feel of an individual tab. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct TabStyle { /// Style of the tab when it is active. pub active: TabInteractionStyle, @@ -177,6 +182,7 @@ pub struct TabStyle { /// Specifies the look and feel of individual tabs while they are being interacted with. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct TabInteractionStyle { /// Color of the outline around tabs. By `Default` it's [`Color32::BLACK`]. pub outline_color: Color32, @@ -193,6 +199,7 @@ pub struct TabInteractionStyle { /// Specifies the look and feel of the tab body. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct TabBodyStyle { /// Inner margin of tab body. By `Default` it's `Margin::same(4.0)`. pub inner_margin: Margin, @@ -209,6 +216,7 @@ pub struct TabBodyStyle { /// Specifies the look and feel of the tab drop overlay. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct OverlayStyle { /// Sets selection color for the placing area of the tab where this tab targeted on it. /// By `Default` it's `(0, 191, 255)` (light blue) with `0.5` capacity. @@ -246,6 +254,7 @@ pub struct OverlayStyle { /// Specifies the feel of the tab drop overlay, i.e anything non visual about the overlay. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct OverlayFeel { /// range is `0.0..=1.0`. pub window_drop_coverage: f32, @@ -265,6 +274,7 @@ pub struct OverlayFeel { /// Specifies the type of overlay used. #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum OverlayType { /// Shows highlighted areas predicting where a dropped tab would land were it to be dropped this frame. /// @@ -279,6 +289,7 @@ pub enum OverlayType { /// Highlighting on the currently hovered leaf. #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct LeafHighlighting { /// Fill color. pub color: Color32,