From 442e6d1806cb0824cae30f6a8f1479b82ff95849 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Thu, 22 Feb 2024 09:46:36 -0800 Subject: [PATCH] backwards compatibility to Feathers UI 1.0 --- README.md | 4 ++ .../feathersui/themes/minimal/MinimalTheme.hx | 2 + .../MinimalActivityIndicatorStyles.hx | 2 + .../components/MinimalGridViewStyles.hx | 4 ++ .../minimal/components/MinimalLabelStyles.hx | 2 + .../components/MinimalTreeGridViewStyles.hx | 54 ++++++++++--------- .../minimal/skins/MinimalActivitySkin.hx | 2 + 7 files changed, 45 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 8fee679..a528f08 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ A theme for [Feathers UI](https://feathersui.com), based on the appearance of [MinimalComps](https://github.com/minimalcomps/minimalcomps) by Keith Peters. +## Minimum Requirements + +- Feathers UI 1.0 + ## Installation Run the following command in a terminal to install feathersui-minimal-theme from GitHub. diff --git a/src/com/feathersui/themes/minimal/MinimalTheme.hx b/src/com/feathersui/themes/minimal/MinimalTheme.hx index 9d236ae..6225c65 100644 --- a/src/com/feathersui/themes/minimal/MinimalTheme.hx +++ b/src/com/feathersui/themes/minimal/MinimalTheme.hx @@ -18,7 +18,9 @@ class MinimalTheme extends BaseMinimalTheme { **/ public function new(darkMode:Bool = false) { super(darkMode); + #if (feathersui >= "1.1.0") com.feathersui.themes.minimal.components.MinimalActivityIndicatorStyles.initialize(this); + #end com.feathersui.themes.minimal.components.MinimalAlertStyles.initialize(this); com.feathersui.themes.minimal.components.MinimalApplicationStyles.initialize(this); com.feathersui.themes.minimal.components.MinimalButtonStyles.initialize(this); diff --git a/src/com/feathersui/themes/minimal/components/MinimalActivityIndicatorStyles.hx b/src/com/feathersui/themes/minimal/components/MinimalActivityIndicatorStyles.hx index 1fc38a2..a4396e2 100644 --- a/src/com/feathersui/themes/minimal/components/MinimalActivityIndicatorStyles.hx +++ b/src/com/feathersui/themes/minimal/components/MinimalActivityIndicatorStyles.hx @@ -8,6 +8,7 @@ package com.feathersui.themes.minimal.components; +#if (feathersui >= "1.1.0") import com.feathersui.themes.minimal.skins.MinimalActivitySkin; import feathers.controls.ActivityIndicator; import feathers.style.Theme; @@ -38,3 +39,4 @@ class MinimalActivityIndicatorStyles { } } } +#end diff --git a/src/com/feathersui/themes/minimal/components/MinimalGridViewStyles.hx b/src/com/feathersui/themes/minimal/components/MinimalGridViewStyles.hx index 713ea2d..d31c998 100644 --- a/src/com/feathersui/themes/minimal/components/MinimalGridViewStyles.hx +++ b/src/com/feathersui/themes/minimal/components/MinimalGridViewStyles.hx @@ -41,6 +41,7 @@ class MinimalGridViewStyles { layout.requestedRowCount = 5.0; gridView.layout = layout; } + #if (feathersui >= "1.3.0") if (gridView.headerCornerSkin == null) { var headerCornerSkin = new MinimalRectangleSkin(); headerCornerSkin.border = None; @@ -49,6 +50,9 @@ class MinimalGridViewStyles { headerCornerSkin.height = 1.0; gridView.headerCornerSkin = headerCornerSkin; } + #else + gridView.extendedScrollBarY = true; + #end if (gridView.columnResizeSkin == null) { var columnResizeSkin = new MinimalRectangleSkin(); columnResizeSkin.fill = SolidColor(theme.labelTextColor); diff --git a/src/com/feathersui/themes/minimal/components/MinimalLabelStyles.hx b/src/com/feathersui/themes/minimal/components/MinimalLabelStyles.hx index 8b6b8ae..bf6403c 100644 --- a/src/com/feathersui/themes/minimal/components/MinimalLabelStyles.hx +++ b/src/com/feathersui/themes/minimal/components/MinimalLabelStyles.hx @@ -58,6 +58,7 @@ class MinimalLabelStyles { label.embedFonts = theme.embedFonts; }); } + #if (feathersui >= "1.1.0") if (styleProvider.getStyleFunction(Label, Label.VARIANT_DANGER) == null) { styleProvider.setStyleFunction(Label, Label.VARIANT_DANGER, function(label:Label):Void { if (label.textFormat == null) { @@ -69,5 +70,6 @@ class MinimalLabelStyles { label.embedFonts = theme.embedFonts; }); } + #end } } diff --git a/src/com/feathersui/themes/minimal/components/MinimalTreeGridViewStyles.hx b/src/com/feathersui/themes/minimal/components/MinimalTreeGridViewStyles.hx index 97aa8a5..1865a29 100644 --- a/src/com/feathersui/themes/minimal/components/MinimalTreeGridViewStyles.hx +++ b/src/com/feathersui/themes/minimal/components/MinimalTreeGridViewStyles.hx @@ -33,60 +33,64 @@ class MinimalTreeGridViewStyles { return; } var styleProvider = theme.styleProvider; - function setDefaultStyles(treeTreeGridView:TreeGridView):Void { + function setDefaultStyles(treeGridView:TreeGridView):Void { var isDesktop = DeviceUtil.isDesktop(); - treeTreeGridView.autoHideScrollBars = !isDesktop; - treeTreeGridView.fixedScrollBars = isDesktop; - if (treeTreeGridView.layout == null) { + treeGridView.autoHideScrollBars = !isDesktop; + treeGridView.fixedScrollBars = isDesktop; + if (treeGridView.layout == null) { var layout = new VerticalListLayout(); layout.requestedRowCount = 5.0; - treeTreeGridView.layout = layout; + treeGridView.layout = layout; } - if (treeTreeGridView.headerCornerSkin == null) { + #if (feathersui >= "1.3.0") + if (treeGridView.headerCornerSkin == null) { var headerCornerSkin = new MinimalRectangleSkin(); headerCornerSkin.border = None; headerCornerSkin.fill = SolidColor(theme.listHeadingColor); headerCornerSkin.width = 1.0; headerCornerSkin.height = 1.0; - treeTreeGridView.headerCornerSkin = headerCornerSkin; + treeGridView.headerCornerSkin = headerCornerSkin; } - if (treeTreeGridView.columnResizeSkin == null) { + #else + treeGridView.extendedScrollBarY = true; + #end + if (treeGridView.columnResizeSkin == null) { var columnResizeSkin = new MinimalRectangleSkin(); columnResizeSkin.fill = SolidColor(theme.labelTextColor); columnResizeSkin.border = None; columnResizeSkin.width = 1.0; columnResizeSkin.height = 1.0; - treeTreeGridView.columnResizeSkin = columnResizeSkin; + treeGridView.columnResizeSkin = columnResizeSkin; } - if (treeTreeGridView.focusRectSkin == null) { + if (treeGridView.focusRectSkin == null) { var focusRectSkin = theme.getFocusRectSkin(); - treeTreeGridView.focusRectSkin = focusRectSkin; + treeGridView.focusRectSkin = focusRectSkin; } - treeTreeGridView.setFocusPadding(2.0); - treeTreeGridView.filters = [theme.getShadow(2.0, true)]; + treeGridView.setFocusPadding(2.0); + treeGridView.filters = [theme.getShadow(2.0, true)]; } - function styleTreeGridViewWithBorderVariant(treeTreeGridView:TreeGridView):Void { - if (treeTreeGridView.backgroundSkin == null) { + function styleTreeGridViewWithBorderVariant(treeGridView:TreeGridView):Void { + if (treeGridView.backgroundSkin == null) { var backgroundSkin = new MinimalRectangleSkin(); backgroundSkin.border = SolidColor(1.0, 0x000000, 0.1); backgroundSkin.fill = SolidColor(theme.listDefaultColor); backgroundSkin.width = 100.0; backgroundSkin.height = 16.0; - treeTreeGridView.backgroundSkin = backgroundSkin; + treeGridView.backgroundSkin = backgroundSkin; } - treeTreeGridView.setPadding(1.0); - setDefaultStyles(treeTreeGridView); + treeGridView.setPadding(1.0); + setDefaultStyles(treeGridView); } - function styleTreeGridViewWithBorderlessVariant(treeTreeGridView:TreeGridView):Void { - if (treeTreeGridView.backgroundSkin == null) { + function styleTreeGridViewWithBorderlessVariant(treeGridView:TreeGridView):Void { + if (treeGridView.backgroundSkin == null) { var backgroundSkin = new MinimalRectangleSkin(); backgroundSkin.border = None; backgroundSkin.fill = SolidColor(theme.listDefaultColor); backgroundSkin.width = 100.0; backgroundSkin.height = 16.0; - treeTreeGridView.backgroundSkin = backgroundSkin; + treeGridView.backgroundSkin = backgroundSkin; } - setDefaultStyles(treeTreeGridView); + setDefaultStyles(treeGridView); } if (styleProvider.getStyleFunction(TreeGridView, TreeGridView.VARIANT_BORDER) == null) { styleProvider.setStyleFunction(TreeGridView, TreeGridView.VARIANT_BORDER, styleTreeGridViewWithBorderVariant); @@ -95,12 +99,12 @@ class MinimalTreeGridViewStyles { styleProvider.setStyleFunction(TreeGridView, TreeGridView.VARIANT_BORDERLESS, styleTreeGridViewWithBorderlessVariant); } if (styleProvider.getStyleFunction(TreeGridView, null) == null) { - styleProvider.setStyleFunction(TreeGridView, null, function(treeTreeGridView:TreeGridView):Void { + styleProvider.setStyleFunction(TreeGridView, null, function(treeGridView:TreeGridView):Void { var isDesktop = DeviceUtil.isDesktop(); if (isDesktop) { - styleTreeGridViewWithBorderVariant(treeTreeGridView); + styleTreeGridViewWithBorderVariant(treeGridView); } else { - styleTreeGridViewWithBorderlessVariant(treeTreeGridView); + styleTreeGridViewWithBorderlessVariant(treeGridView); } }); } diff --git a/src/com/feathersui/themes/minimal/skins/MinimalActivitySkin.hx b/src/com/feathersui/themes/minimal/skins/MinimalActivitySkin.hx index 440e1f8..d8b7c85 100644 --- a/src/com/feathersui/themes/minimal/skins/MinimalActivitySkin.hx +++ b/src/com/feathersui/themes/minimal/skins/MinimalActivitySkin.hx @@ -8,6 +8,7 @@ package com.feathersui.themes.minimal.skins; +#if (feathersui >= "1.1.0") import feathers.skins.IIndeterminateSkin; import feathers.skins.ProgrammaticSkin; import feathers.utils.MathUtil; @@ -107,3 +108,4 @@ class MinimalActivitySkin extends ProgrammaticSkin implements IIndeterminateSkin } } } +#end