diff --git a/src/feathers/controls/AssetLoader.hx b/src/feathers/controls/AssetLoader.hx index 086bd6ec..853952f0 100644 --- a/src/feathers/controls/AssetLoader.hx +++ b/src/feathers/controls/AssetLoader.hx @@ -71,6 +71,7 @@ class AssetLoader extends FeathersControl { @since 1.0.0 **/ public function new(?source:String, ?completeListener:(Event) -> Void) { + initializeAssetLoaderTheme(); super(); this.source = source; @@ -317,6 +318,12 @@ class AssetLoader extends FeathersControl { return this._scaleMode; } + private function initializeAssetLoaderTheme():Void { + #if !feathersui_disable_default_theme + feathers.themes.steel.components.SteelAssetLoaderStyles.initialize(); + #end + } + override public function dispose():Void { this.source = null; super.dispose(); diff --git a/src/feathers/themes/steel/SteelTheme.hx b/src/feathers/themes/steel/SteelTheme.hx index 75a0e916..d7c8a1d3 100644 --- a/src/feathers/themes/steel/SteelTheme.hx +++ b/src/feathers/themes/steel/SteelTheme.hx @@ -11,6 +11,7 @@ package feathers.themes.steel; import feathers.themes.steel.components.SteelActivityIndicatorStyles; import feathers.themes.steel.components.SteelAlertStyles; import feathers.themes.steel.components.SteelApplicationStyles; +import feathers.themes.steel.components.SteelAssetLoaderStyles; import feathers.themes.steel.components.SteelButtonBarStyles; import feathers.themes.steel.components.SteelButtonStyles; import feathers.themes.steel.components.SteelCalloutStyles; @@ -79,6 +80,7 @@ class SteelTheme extends BaseSteelTheme { SteelActivityIndicatorStyles.initialize(this); SteelAlertStyles.initialize(this); SteelApplicationStyles.initialize(this); + SteelAssetLoaderStyles.initialize(this); SteelButtonStyles.initialize(this); SteelButtonBarStyles.initialize(this); SteelCalloutStyles.initialize(this); diff --git a/src/feathers/themes/steel/components/SteelAssetLoaderStyles.hx b/src/feathers/themes/steel/components/SteelAssetLoaderStyles.hx new file mode 100644 index 00000000..b0a8d1bf --- /dev/null +++ b/src/feathers/themes/steel/components/SteelAssetLoaderStyles.hx @@ -0,0 +1,36 @@ +/* + Feathers UI + Copyright 2024 Bowler Hat LLC. All Rights Reserved. + + This program is free software. You can redistribute and/or modify it in + accordance with the terms of the accompanying license agreement. + */ + +package feathers.themes.steel.components; + +import feathers.controls.AssetLoader; +import feathers.style.Theme; +import feathers.themes.steel.BaseSteelTheme; + +/** + Initialize "steel" styles for the `AssetLoader` component. + + @since 1.0.0 +**/ +@:dox(hide) +@:access(feathers.themes.steel.BaseSteelTheme) +class SteelAssetLoaderStyles { + public static function initialize(?theme:BaseSteelTheme):Void { + if (theme == null) { + theme = Std.downcast(Theme.fallbackTheme, BaseSteelTheme); + } + if (theme == null) { + return; + } + + var styleProvider = theme.styleProvider; + if (styleProvider.getStyleFunction(AssetLoader, null) == null) { + styleProvider.setStyleFunction(AssetLoader, null, function(loader:AssetLoader):Void {}); + } + } +}