Exemple #1
0
        protected override void OnEnable()
        {
            base.OnEnable();

            EditorApplication.modifierKeysChanged += Repaint;
            positionChanged += PositionChanged;

            get = this;

            if (m_MainToolbar == null)
            {
                m_MainToolbar = CreateInstance <UnityMainToolbar>();
            }

            if (m_MainToolbar.rootVisualElement != null)
            {
                visualTree.Add(m_MainToolbar.rootVisualElement);
            }

            PositionChanged(this);
        }
Exemple #2
0
        protected override void OnEnable()
        {
            base.OnEnable();

            EditorApplication.modifierKeysChanged += Repaint;
            positionChanged += PositionChanged;

            get = this;

            if (m_MainToolbar == null)
            {
                m_MainToolbar = (EditorToolbar)CreateInstance(EditorUIService.instance.GetDefaultToolbarType());
            }

            if (m_MainToolbar.rootVisualElement != null)
            {
                var visualTree = windowBackend.visualTree as UnityEngine.UIElements.VisualElement;
                visualTree?.Add(m_MainToolbar.rootVisualElement);
            }

            PositionChanged(this);

            m_EventInterests.wantsLessLayoutEvents = true;
        }
        protected override VisualElement CreateRoot()
        {
            var visualTree = EditorToolbarUtility.LoadUxml("MainToolbar");

            VisualElement root = new VisualElement();

            root.style.flexGrow = 1;
            visualTree.CloneTree(root);

            var left = new EditorToolbar(leftToolbar);

            left.LoadToolbarElements(root.Q("ToolbarZoneLeftAlign"));

            var middle = new EditorToolbar(middleToolbar);

            middle.LoadToolbarElements(root.Q("ToolbarZonePlayMode"));

            var right = new EditorToolbar(rightToolbar);

            right.LoadToolbarElements(root.Q("ToolbarZoneRightAlign"));

            EditorToolbarUtility.LoadStyleSheets("MainToolbar", root);
            return(root);
        }
Exemple #4
0
 public OverlayToolbar CreateHorizontalToolbarContent()
 {
     return(EditorToolbar.CreateOverlay(toolbarElements, containerWindow));
 }