-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Move context menu options to the toolbar
- Loading branch information
Showing
6 changed files
with
112 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using UnityEditor.UIElements; | ||
using UnityEngine.UIElements; | ||
|
||
namespace GBG.PlayableGraphMonitor.Editor | ||
{ | ||
public class ToolbarDropdownToggle : VisualElement, INotifyValueChanged<bool> | ||
{ | ||
private readonly ToolbarToggle _toggle; | ||
private readonly ToolbarMenu _menu; | ||
|
||
public string text | ||
{ | ||
get => _toggle.text; | ||
set => _toggle.text = value; | ||
} | ||
public string label | ||
{ | ||
get => _toggle.label; | ||
set => _toggle.label = value; | ||
} | ||
public Label labelElement => _toggle.labelElement; | ||
public new string tooltip | ||
{ | ||
get => _toggle.tooltip; | ||
set => _toggle.tooltip = value; | ||
} | ||
public bool value | ||
{ | ||
get => _toggle.value; | ||
set => _toggle.value = value; | ||
} | ||
public string menuTooltip | ||
{ | ||
get => _menu.tooltip; | ||
set => _menu.tooltip = value; | ||
} | ||
public DropdownMenu menu => _menu.menu; | ||
public ToolbarMenu.Variant menuVariant | ||
{ | ||
get => _menu.variant; | ||
set => _menu.variant = value; | ||
} | ||
|
||
|
||
public ToolbarDropdownToggle() | ||
{ | ||
style.flexDirection = FlexDirection.Row; | ||
style.flexShrink = 0; | ||
|
||
_toggle = new ToolbarToggle(); | ||
_toggle.style.borderRightWidth = 0; | ||
_toggle.style.minWidth = 0; | ||
Add(_toggle); | ||
|
||
_menu = new ToolbarMenu(); | ||
_menu.style.borderLeftWidth = 0; | ||
Add(_menu); | ||
} | ||
|
||
public void SetValueWithoutNotify(bool newValue) | ||
{ | ||
_toggle.SetValueWithoutNotify(newValue); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters