Skip to content

Commit d835b47

Browse files
QuinntyxAdanos020
andcommitted
Added #[derive(Serialize, Deserialize)] to the Style structs under the serde feature (#227)
* 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 <[email protected]>
1 parent 9cd7bad commit d835b47

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/style.rs

+11
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub enum TabAddAlign {
4646
/// #
4747
/// ```
4848
#[derive(Clone, Debug)]
49+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
4950
#[allow(missing_docs)]
5051
pub struct Style {
5152
/// Sets padding to indent from the edges of the window. By `Default` it's `None`.
@@ -63,6 +64,7 @@ pub struct Style {
6364

6465
/// Specifies the look and feel of buttons.
6566
#[derive(Clone, Debug)]
67+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
6668
pub struct ButtonsStyle {
6769
/// Color of the close tab button.
6870
pub close_tab_color: Color32,
@@ -91,6 +93,7 @@ pub struct ButtonsStyle {
9193

9294
/// Specifies the look and feel of node separators.
9395
#[derive(Clone, Debug)]
96+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
9497
pub struct SeparatorStyle {
9598
/// Width of the rectangle separator between nodes. By `Default` it's `1.0`.
9699
pub width: f32,
@@ -115,6 +118,7 @@ pub struct SeparatorStyle {
115118

116119
/// Specifies the look and feel of tab bars.
117120
#[derive(Clone, Debug)]
121+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
118122
pub struct TabBarStyle {
119123
/// Background color of tab bar. By `Default` it's [`Color32::WHITE`].
120124
pub bg_fill: Color32,
@@ -138,6 +142,7 @@ pub struct TabBarStyle {
138142

139143
/// Specifies the look and feel of an individual tab.
140144
#[derive(Clone, Debug)]
145+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
141146
pub struct TabStyle {
142147
/// Style of the tab when it is active.
143148
pub active: TabInteractionStyle,
@@ -177,6 +182,7 @@ pub struct TabStyle {
177182

178183
/// Specifies the look and feel of individual tabs while they are being interacted with.
179184
#[derive(Clone, Debug)]
185+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
180186
pub struct TabInteractionStyle {
181187
/// Color of the outline around tabs. By `Default` it's [`Color32::BLACK`].
182188
pub outline_color: Color32,
@@ -193,6 +199,7 @@ pub struct TabInteractionStyle {
193199

194200
/// Specifies the look and feel of the tab body.
195201
#[derive(Clone, Debug)]
202+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
196203
pub struct TabBodyStyle {
197204
/// Inner margin of tab body. By `Default` it's `Margin::same(4.0)`.
198205
pub inner_margin: Margin,
@@ -209,6 +216,7 @@ pub struct TabBodyStyle {
209216

210217
/// Specifies the look and feel of the tab drop overlay.
211218
#[derive(Clone, Debug)]
219+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
212220
pub struct OverlayStyle {
213221
/// Sets selection color for the placing area of the tab where this tab targeted on it.
214222
/// By `Default` it's `(0, 191, 255)` (light blue) with `0.5` capacity.
@@ -246,6 +254,7 @@ pub struct OverlayStyle {
246254

247255
/// Specifies the feel of the tab drop overlay, i.e anything non visual about the overlay.
248256
#[derive(Clone, Debug)]
257+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
249258
pub struct OverlayFeel {
250259
/// range is `0.0..=1.0`.
251260
pub window_drop_coverage: f32,
@@ -265,6 +274,7 @@ pub struct OverlayFeel {
265274

266275
/// Specifies the type of overlay used.
267276
#[derive(Clone, Debug, PartialEq)]
277+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
268278
pub enum OverlayType {
269279
/// Shows highlighted areas predicting where a dropped tab would land were it to be dropped this frame.
270280
///
@@ -279,6 +289,7 @@ pub enum OverlayType {
279289

280290
/// Highlighting on the currently hovered leaf.
281291
#[derive(Clone, Debug)]
292+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
282293
pub struct LeafHighlighting {
283294
/// Fill color.
284295
pub color: Color32,

0 commit comments

Comments
 (0)