private void Insert(int index, Tab tab, Transform content, RegionSplitType splitType = RegionSplitType.None)
        {
            if (m_childrenPanel.childCount > 0)
            {
                throw new InvalidOperationException("Unable to Add content. Region has children and is not a \"leaf\" region.");
            }

            switch (splitType)
            {
            case RegionSplitType.None:
                Insert(index, tab, content);
                break;

            case RegionSplitType.Left:
                SplitLeft(tab, content);
                break;

            case RegionSplitType.Top:
                SplitTop(tab, content);
                break;

            case RegionSplitType.Right:
                SplitRight(tab, content);
                break;

            case RegionSplitType.Bottom:
                SplitBottom(tab, content);
                break;
            }
        }
        public void Move(int index, int targetIndex, Region targetRegion, RegionSplitType targetSplitType = RegionSplitType.None)
        {
            if (m_childrenPanel.childCount > 0)
            {
                throw new InvalidOperationException("Unable to Remove content. Region has children and is not a \"leaf\" region.");
            }

            if (index < 0 || m_tabPanel.transform.childCount <= index)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            Tab tab = m_tabPanel.transform.GetChild(index).GetComponent <Tab>();

            Unsubscribe(tab, this);

            Transform content = m_contentPanel.transform.GetChild(index);

            targetRegion.Insert(targetIndex, tab, content, targetSplitType);

            if (m_tabPanel.transform.childCount == 0)
            {
                Destroy(gameObject);
            }
        }
        public void Add(Sprite icon, string header, Transform content, RegionSplitType splitType = RegionSplitType.None)
        {
            if (m_childrenPanel.childCount > 0)
            {
                throw new InvalidOperationException("Unable to Add content. Region has children and is not a \"leaf\" region.");
            }

            Tab tab = Instantiate(m_tabPrefab);

            tab.Icon = icon;
            tab.Text = header;
            Insert(m_tabPanel.transform.childCount, tab, content, splitType);
        }
Exemple #4
0
 public void AddRegion(Tab tab, Transform content, bool isFree = false, RegionSplitType splitType = RegionSplitType.None, float flexibleSize = 0.3f)
 {
     m_rootRegion.Add(tab, content, isFree, splitType, flexibleSize);
 }
Exemple #5
0
 public void AddRegion(Sprite icon, string header, Transform content, bool isFree = false, RegionSplitType splitType = RegionSplitType.None, float flexibleSize = 0.3f, bool canDrag = true, bool canClose = true)
 {
     m_rootRegion.Add(icon, header, content, isFree, splitType, flexibleSize, canDrag, canClose);
 }
Exemple #6
0
 public Transform CreateWindow(string windowTypeName, bool isFree = true, RegionSplitType splitType = RegionSplitType.None, float flexibleSize = 0.3f, Transform parentWindow = null)
 {
     return(ActiveWorkspace.CreateWindow(windowTypeName, isFree, splitType, flexibleSize, parentWindow));
 }
Exemple #7
0
        private Transform CreateWindow(string windowTypeName, out Dialog dialog, bool isFree = true, RegionSplitType splitType = RegionSplitType.None, float flexibleSize = 0.3f, Transform parentWindow = null)
        {
            WindowDescriptor wd;
            GameObject       content;
            bool             isDialog;

            Transform window = CreateWindow(windowTypeName, out wd, out content, out isDialog);

            if (!window)
            {
                dialog = null;
                return(window);
            }

            if (isDialog && isFree)
            {
                dialog = m_dialogManager.ShowDialog(wd.Icon, wd.Header, content.transform);
                dialog.IsCancelVisible = false;
                dialog.IsOkVisible     = false;
            }
            else
            {
                dialog = null;

                Region targetRegion = null;
                if (parentWindow != null)
                {
                    targetRegion = parentWindow.GetComponentInParent <Region>();
                }

                if (targetRegion == null)
                {
                    targetRegion = DockPanel.RootRegion;
                }

                Tab tab = Instantiate(DockPanel.TabPrefab);
                tab.Text = wd.Header;
                tab.Icon = wd.Icon;

                targetRegion.Add(tab, content.transform, isFree, splitType, flexibleSize);

                if (!isFree)
                {
                    ForceLayoutUpdate();
                }

                RuntimeWindow region = window.GetComponentInParent <RuntimeWindow>();
                if (region != null)
                {
                    region.HandleResize();
                }

                targetRegion.RaiseDepthChanged();
            }

            ActivateContent(wd, content);

            if (WindowCreated != null)
            {
                WindowCreated(window);
            }

            return(window);
        }
Exemple #8
0
        public Transform CreateWindow(string windowTypeName, bool isFree = true, RegionSplitType splitType = RegionSplitType.None, float flexibleSize = 0.3f, Transform parentWindow = null)
        {
            Dialog dialog;

            return(CreateWindow(windowTypeName, out dialog, isFree, splitType, flexibleSize, parentWindow));
        }