You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/08/16 00:53:58 UTC
[royale-asjs] 03/05: use ILayoutView so BoxLayout can layout
Panel's chrome as well as content
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 8ce742aa3ed3c5c4a55e11a7c252c66e38fb7b82
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Aug 15 16:00:53 2018 -0700
use ILayoutView so BoxLayout can layout Panel's chrome as well as content
---
.../main/royale/mx/containers/beads/BoxLayout.as | 22 ++++++++--------
.../royale/mx/containers/utilityClasses/Flex.as | 30 +++++++++++-----------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
index 2ae8fca..3fc8b87 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
@@ -133,11 +133,11 @@ package mx.containers.beads
var preferredWidth:Number = 0;
var preferredHeight:Number = 0;
- var n:int = target.numChildren;
+ var n:int = layoutView.numElements;
var numChildrenWithOwnSpace:int = n;
for (var i:int = 0; i < n; i++)
{
- var child:IUIComponent = target.getLayoutChildAt(i);
+ var child:IUIComponent = layoutView.getElementAt(i) as IUIComponent;
if (!child.includeInLayout)
{
@@ -194,7 +194,7 @@ package mx.containers.beads
override public function layout():Boolean
{
- var n:int = target.numChildren;
+ var n:int = layoutView.numElements;
if (n == 0)
return false;
@@ -220,7 +220,7 @@ package mx.containers.beads
public function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
- var n:int = target.numChildren;
+ var n:int = layoutView.numElements;
if (n == 0) return;
var vm:EdgeMetrics = target.viewMetricsAndPadding;
@@ -266,7 +266,7 @@ package mx.containers.beads
// a GridItem. This code path works for both horizontal and
// vertical layout.
- var child:IUIComponent = target.getLayoutChildAt(0);
+ var child:IUIComponent = layoutView.getElementAt(0) as IUIComponent;
var percentWidth:Number = child.percentWidth;
var percentHeight:Number = child.percentHeight;
@@ -331,13 +331,13 @@ package mx.containers.beads
numChildrenWithOwnSpace = n;
for (i = 0; i < n; i++)
{
- if (!IUIComponent(target.getChildAt(i)).includeInLayout)
+ if (!IUIComponent(layoutView.getElementAt(i)).includeInLayout)
numChildrenWithOwnSpace--;
}
// Stretch everything as needed, including widths.
excessSpace = Flex.flexChildHeightsProportionally(
- target, h - (numChildrenWithOwnSpace - 1) * gap, w);
+ layoutView, h - (numChildrenWithOwnSpace - 1) * gap, w);
// Ignore scrollbar sizes for child alignment purpose.
// if (horizontalScrollBar != null &&
@@ -355,7 +355,7 @@ package mx.containers.beads
for (i = 0; i < n; i++)
{
- obj = target.getLayoutChildAt(i);
+ obj = layoutView.getElementAt(i) as IUIComponent;
left = (w - obj.width) * horizontalAlign + paddingLeft;
COMPILE::JS {
obj.positioner.style.position = 'absolute';
@@ -373,13 +373,13 @@ package mx.containers.beads
numChildrenWithOwnSpace = n;
for (i = 0; i < n; i++)
{
- if (!IUIComponent(target.getChildAt(i)).includeInLayout)
+ if (!IUIComponent(layoutView.getElementAt(i)).includeInLayout)
numChildrenWithOwnSpace--;
}
// stretch everything as needed including heights
excessSpace = Flex.flexChildWidthsProportionally(
- target, w - (numChildrenWithOwnSpace - 1) * gap, h);
+ layoutView, w - (numChildrenWithOwnSpace - 1) * gap, h);
// Ignore scrollbar sizes for child alignment purpose.
// if (horizontalScrollBar != null &&
@@ -397,7 +397,7 @@ package mx.containers.beads
for (i = 0; i < n; i++)
{
- obj = target.getLayoutChildAt(i);
+ obj = layoutView.getElementAt(i) as IUIComponent;
top = (h - obj.height) * verticalAlign + paddingTop;
COMPILE::JS {
obj.positioner.style.position = 'absolute';
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as
index 90af44e..48258f4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as
@@ -20,8 +20,8 @@
package mx.containers.utilityClasses
{
-import mx.core.IChildList;
import mx.core.IUIComponent;
+import org.apache.royale.core.ILayoutView;
[ExcludeClass]
@@ -64,7 +64,7 @@ public class Flex
* @productversion Flex 3
*/
public static function flexChildWidthsProportionally(
- parent:IChildList,
+ parent:ILayoutView,
spaceForChildren:Number,
h:Number):Number
{
@@ -81,10 +81,10 @@ public class Flex
//
// Also calculate the sum of all widthFlexes, and calculate the
// sum of the width of all non-flexible children.
- var n:int = parent.numChildren;
+ var n:int = parent.numElements;
for (i = 0; i < n; i++)
{
- child = IUIComponent(parent.getChildAt(i));
+ child = IUIComponent(parent.getElementAt(i));
var percentWidth:Number = child.percentWidth;
var percentHeight:Number = child.percentHeight;
@@ -195,7 +195,7 @@ public class Flex
* @productversion Flex 3
*/
public static function flexChildHeightsProportionally(
- parent:IChildList,
+ parent:ILayoutView,
spaceForChildren:Number,
w:Number):Number
{
@@ -212,10 +212,10 @@ public class Flex
//
// Also calculate the sum of all percentHeights, and calculate the
// sum of the height of all non-flexible children.
- var n:int = parent.numChildren;
+ var n:int = parent.numElements;
for (i = 0; i < n; i++)
{
- child = IUIComponent(parent.getChildAt(i));
+ child = IUIComponent(parent.getElementAt(i));
var percentWidth:Number = child.percentWidth;
var percentHeight:Number = child.percentHeight;
@@ -465,7 +465,7 @@ public class Flex
* @productversion Flex 3
*/
public static function distributeExtraHeight(
- parent:IChildList,
+ parent:ILayoutView,
spaceForChildren:Number):void
{
// We should only get here after distributing the majority of the
@@ -485,7 +485,7 @@ public class Flex
// First check if we should distribute any extra space. To do
// this, we check to see if someone suffers from rounding error.
- var n:int = parent.numChildren;
+ var n:int = parent.numElements;
var wantToGrow:Boolean = false;
var i:int;
var percentHeight:Number;
@@ -497,7 +497,7 @@ public class Flex
for (i = 0; i < n; i++)
{
- child = IUIComponent(parent.getChildAt(i));
+ child = IUIComponent(parent.getElementAt(i));
if (!child.includeInLayout)
continue;
@@ -534,7 +534,7 @@ public class Flex
for (i = 0; i < n; i++)
{
- child = IUIComponent(parent.getChildAt(i));
+ child = IUIComponent(parent.getElementAt(i));
childHeight = child.height;
percentHeight = child.percentHeight
@@ -578,7 +578,7 @@ public class Flex
* @productversion Flex 3
*/
public static function distributeExtraWidth(
- parent:IChildList,
+ parent:ILayoutView,
spaceForChildren:Number):void
{
// We should only get here after distributing the majority of the
@@ -598,7 +598,7 @@ public class Flex
// First check if we should distribute any extra space. To do
// this, we check to see if someone suffers from rounding error.
- var n:int = parent.numChildren;
+ var n:int = parent.numElements;
var wantToGrow:Boolean = false;
var i:int;
var percentWidth:Number;
@@ -610,7 +610,7 @@ public class Flex
for (i = 0; i < n; i++)
{
- child = IUIComponent(parent.getChildAt(i));
+ child = IUIComponent(parent.getElementAt(i));
if (!child.includeInLayout)
continue;
@@ -647,7 +647,7 @@ public class Flex
for (i = 0; i < n; i++)
{
- child = IUIComponent(parent.getChildAt(i));
+ child = IUIComponent(parent.getElementAt(i));
childWidth = child.width;
percentWidth = child.percentWidth