From aeb02152b2f294a00f3e82fdb6f86d7c4ee57957 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Tue, 23 Jul 2024 11:20:11 +0200 Subject: [PATCH] move setLayout to compositebuilder --- haxe/ui/containers/Frame.hx | 21 +++++++++------------ haxe/ui/core/Component.hx | 7 +++++++ haxe/ui/core/CompositeBuilder.hx | 4 ++++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/haxe/ui/containers/Frame.hx b/haxe/ui/containers/Frame.hx index 23093b2a0..6e295cf9e 100644 --- a/haxe/ui/containers/Frame.hx +++ b/haxe/ui/containers/Frame.hx @@ -16,18 +16,6 @@ class Frame extends Box { @:clonable @:behaviour(CollapsibleBehaviour) public var collapsible:Bool; @:clonable @:behaviour(CollapsedBehaviour) public var collapsed:Bool; @:clonable @:value(text) public var value:Dynamic; - - #if !haxeui_hxwidgets - public override function set_layout(value:haxe.ui.layouts.Layout):haxe.ui.layouts.Layout { - if ((value is Layout)) { - super.set_layout(value); - } else { - var builder:Builder = cast(this._compositeBuilder, Builder); - @:privateAccess builder._contents.layout = value; - } - return value; - } - #end } //*********************************************************************************************************** @@ -226,6 +214,15 @@ private class Builder extends CompositeBuilder { //_frame.icon = null; } } + + public override function setLayout(value:haxe.ui.layouts.Layout):haxe.ui.layouts.Layout { + if ((value is Layout)) { + return null; + } else { + _contents.layout = value; + } + return value; + } } //*********************************************************************************************************** diff --git a/haxe/ui/core/Component.hx b/haxe/ui/core/Component.hx index e43a80e4a..36308a535 100644 --- a/haxe/ui/core/Component.hx +++ b/haxe/ui/core/Component.hx @@ -1599,6 +1599,13 @@ class Component extends ComponentImpl return value; } + if (_compositeBuilder != null) { + var r = _compositeBuilder.setLayout(value); + if (r != null) { + return r; + } + } + if (_layout != null && Type.getClassName(Type.getClass(value)) == Type.getClassName(Type.getClass(_layout))) { return value; } diff --git a/haxe/ui/core/CompositeBuilder.hx b/haxe/ui/core/CompositeBuilder.hx index 8d1a0696d..836145000 100644 --- a/haxe/ui/core/CompositeBuilder.hx +++ b/haxe/ui/core/CompositeBuilder.hx @@ -107,4 +107,8 @@ class CompositeBuilder { private function get_isComponentClipped():Bool { return (_component.componentClipRect != null); } + + public function setLayout(value:haxe.ui.layouts.Layout):haxe.ui.layouts.Layout { + return null; + } }