Skip to content

Commit

Permalink
allow for button to disabled when menu is
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jan 17, 2024
1 parent 7efc3c0 commit d02b6fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions haxe/ui/_module/styles/default/menus.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
border: 1px solid $normal-border-color;
}

.menubar-button:disabled {
color: $disabled-text-color;
}

/************************************************************************
** MENU
*************************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions haxe/ui/containers/menus/MenuBar.hx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ private class Builder extends CompositeBuilder {
button.tooltip = menu.tooltip;
button.hidden = child.hidden;
button.allowFocus = false;
button.disabled = child.disabled;
LocaleManager.instance.cloneForComponent(child, button);
_buttons.push(button);
_menubar.addComponent(button);
Expand Down Expand Up @@ -338,6 +339,11 @@ private class Builder extends CompositeBuilder {
var index = _menus.indexOf(menu);
var button = _buttons[index];
button.hidden = event.target.hidden;
} else if (event.data == "disabled") {
var menu = cast(event.target, Menu);
var index = _menus.indexOf(menu);
var button = _buttons[index];
button.disabled = event.target.disabled;
} else if (event.data == "icon") {
var menu = cast(event.target, Menu);
var index = _menus.indexOf(menu);
Expand Down

0 comments on commit d02b6fa

Please sign in to comment.