Skip to content

Commit

Permalink
move setLayout to compositebuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jul 23, 2024
1 parent 3f0f1a1 commit aeb0215
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
21 changes: 9 additions & 12 deletions haxe/ui/containers/Frame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

//***********************************************************************************************************
Expand Down Expand Up @@ -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;
}
}

//***********************************************************************************************************
Expand Down
7 changes: 7 additions & 0 deletions haxe/ui/core/Component.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions haxe/ui/core/CompositeBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit aeb0215

Please sign in to comment.