Skip to content

Commit

Permalink
backwards compatibility to Feathers UI 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Feb 22, 2024
1 parent e6cd8d5 commit 442e6d1
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 25 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/com/feathersui/themes/minimal/MinimalTheme.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -38,3 +39,4 @@ class MinimalActivityIndicatorStyles {
}
}
}
#end
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -69,5 +70,6 @@ class MinimalLabelStyles {
label.embedFonts = theme.embedFonts;
});
}
#end
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -107,3 +108,4 @@ class MinimalActivitySkin extends ProgrammaticSkin implements IIndeterminateSkin
}
}
}
#end

0 comments on commit 442e6d1

Please sign in to comment.