Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/haxeui/haxeui-core
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Feb 3, 2025
2 parents 1a1c573 + 9302f0a commit 17a4135
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions haxe/ui/containers/ButtonBar.hx
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,32 @@ class ButtonBarBuilder extends CompositeBuilder {
}

public override function addComponent(child:Component):Component {
if ((child is Button)) {
if (!child.hasClass("button-bar-divider")) {
if (_bar.numComponents > 0) {
var divider = new Component();
divider.addClass("button-bar-divider");
_bar.addComponent(divider);

}
child.registerEvent(UIEvent.SHOWN, onButtonShown);
child.registerEvent(UIEvent.HIDDEN, onButtonHidden);
}
if ((child is Button)) {
if (_bar.selectedIndex == _bar.numComponents) {
cast(child, Button).selected = true;
}
cast(child, Button).toggle = _bar.toggle;
child.registerEvent(UIEvent.SHOWN, onButtonShown);
child.registerEvent(UIEvent.HIDDEN, onButtonHidden);
}

return null;
}

public override function removeComponent(child:Component, dispose:Bool = true, invalidate:Bool = true):Component {
if (!child.hasClass("button-bar-divider")) {
var childIndex = _bar.getComponentIndex(child);
var followingChild = _bar.getComponentAt(childIndex + 1);
if (followingChild != null && followingChild.hasClass("button-bar-divider")) {
_bar.removeComponent(followingChild, true, invalidate);
}
}

return null;
Expand Down

0 comments on commit 17a4135

Please sign in to comment.