This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new aaec85a576 Skinning support
aaec85a576 is described below
commit aaec85a5761bbcffe5d60f5105b5c15de331b166
Author: Harbs <[email protected]>
AuthorDate: Wed Mar 4 13:55:37 2026 +0200
Skinning support
---
.../Style/src/main/resources/basic-manifest.xml | 2 +
.../style/{IStyleUIBase.as => IStyleSkin.as} | 15 ++----
.../royale/org/apache/royale/style/IStyleUIBase.as | 2 +
.../royale/org/apache/royale/style/StyleSkin.as | 63 ++++++++++++++++++++++
.../royale/org/apache/royale/style/StyleUIBase.as | 35 +++++++++++-
5 files changed, 103 insertions(+), 14 deletions(-)
diff --git a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
index 3d3d5bf8ef..676007ed8e 100644
--- a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
@@ -20,6 +20,8 @@
<componentPackage>
+ <component id="StyleSkin" class="org.apache.royale.style.StyleSkin"/>
+
<component id="Group" class="org.apache.royale.style.Group"/>
<component id="DataContainer" class="org.apache.royale.style.DataContainer"/>
<component id="List" class="org.apache.royale.style.List"/>
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleSkin.as
similarity index 65%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleSkin.as
index 15a39d35a4..acb2bdb400 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleSkin.as
@@ -18,19 +18,10 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style
{
- import org.apache.royale.core.IUIBase;
+ import org.apache.royale.core.IBead;
- /**
- * The IStyleUIBase interface defines the contract for all UI
components that support styles.
- * It provides a common set of methods and properties for
handling style classes and applying them to the component.
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.13
- */
- public interface IStyleUIBase extends IUIBase
+ public interface IStyleSkin extends IBead
{
- function toggleClass(classNameVal:String,add:Boolean):void;
- function get theme():String;
+
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
index 15a39d35a4..7e35bd1ebd 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IStyleUIBase.as
@@ -19,6 +19,7 @@
package org.apache.royale.style
{
import org.apache.royale.core.IUIBase;
+ import org.apache.royale.style.stylebeads.IStyleBead;
/**
* The IStyleUIBase interface defines the contract for all UI
components that support styles.
@@ -31,6 +32,7 @@ package org.apache.royale.style
public interface IStyleUIBase extends IUIBase
{
function toggleClass(classNameVal:String,add:Boolean):void;
+ function addStyleBead(bead:IStyleBead):void;
function get theme():String;
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleSkin.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleSkin.as
new file mode 100644
index 0000000000..ca4db191b2
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleSkin.as
@@ -0,0 +1,63 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.style
+{
+ import org.apache.royale.core.Bead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.IStyleUIBase;
+ import org.apache.royale.style.stylebeads.IStyleBead;
+ [DefaultProperty("styles")]
+ /**
+ * The StyleSkin class is a bead that can be added to a component to
provide styling capabilities.
+ * All style skins have an array of style beads that they use to apply
styles to the component.
+ * When the strand is set, the StyleSkin will apply all of its style
beads to the component.
+ *
+ * StyleSkins can have more complex styling where it applies style
beads to specific elements within the component.
+ * Each skin must know the composition of the component it is styling
and how to apply styles to the various elements
+ * within that component.
+ *
+ * The component must have all its parts when added to parent for the
styling to be correctly applied.
+ */
+ public class StyleSkin extends Bead implements IStyleSkin
+ {
+ public function StyleSkin()
+ {
+ super();
+ }
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ assert(value is IStyleUIBase, "StyleSkin can only be
added to components that implement IStyleUIBase");
+ var styleUIBase:IStyleUIBase = value as IStyleUIBase;
+ for each(var styleBead:IStyleBead in styles)
+ {
+ styleUIBase.addStyleBead(styleBead);
+ }
+ }
+ /**
+ * The array of style beads that this StyleSkin will apply to
the component.
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ *
+ * @royalesuppresspublicvarwarning
+ */
+ public var styles:Array;
+ }
+}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
index 74d2e84968..e39c3fcf52 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
@@ -20,11 +20,13 @@ package org.apache.royale.style
{
import org.apache.royale.core.UIBase;
import org.apache.royale.core.CSSClassList;
+ import org.apache.royale.debugging.assert;
+ import org.apache.royale.style.IStyleSkin;
+ import org.apache.royale.style.stylebeads.ILeafStyleBead;
import org.apache.royale.style.stylebeads.IStyleBead;
import org.apache.royale.style.util.StyleManager;
import org.apache.royale.style.util.ThemeManager;
- import org.apache.royale.style.stylebeads.ILeafStyleBead;
- import org.apache.royale.debugging.assert;
+ import org.apache.royale.utils.loadBeadFromValuesManager;
COMPILE::JS
{
@@ -107,6 +109,7 @@ package org.apache.royale.style
}
COMPILE::JS
private var styleTypes:Set;
+ private var _stylesLoaded:Boolean;
override protected function loadBeads():void
{
super.loadBeads();
@@ -116,6 +119,8 @@ package org.apache.royale.style
addStyleBead(bead);
}
styleBeads = null;
+ applySkin();
+ _stylesLoaded = true;
refreshStyles();
}
public function getStyleBeadsByType(type:Class):Array
@@ -128,6 +133,32 @@ package org.apache.royale.style
}
return retVal;
}
+ private var _skin:IStyleSkin;
+
+ public function get skin():IStyleSkin
+ {
+ return _skin;
+ }
+
+ public function set skin(value:IStyleSkin):void
+ {
+ _skin = value;
+ if(_stylesLoaded)
+ {
+ addBead(value);
+ }
+ }
+ private function applySkin():void
+ {
+ if(skin)
+ {
+ addBead(skin);
+ }
+ else
+ {
+ _skin = loadBeadFromValuesManager(IStyleSkin,
"iStyleSkin", this) as IStyleSkin;
+ }
+ }
protected function refreshStyles():void
{