예제 #1
0
파일: DockFrame.cs 프로젝트: rdafoe/Cage
        public void LoadLayouts(XmlReader reader)
        {
            layouts.Clear();
            container.Clear();
            currentLayout = null;

            reader.MoveToContent();
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }
            reader.ReadStartElement("layouts");
            reader.MoveToContent();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    DockLayout layout = DockLayout.Read(this, reader);
                    layouts.Add(layout.Name, layout);
                }
                else
                {
                    reader.Skip();
                }
                reader.MoveToContent();
            }
            reader.ReadEndElement();
            container.RelayoutWidgets();
        }
예제 #2
0
        public void LoadLayout(DockLayout dl)
        {
            // Sticky items currently selected in notebooks will remain
            // selected after switching the layout
            List<DockItem> sickyOnTop = new List<DockItem> ();
            foreach (DockItem it in items) {
                if ((it.Behavior & DockItemBehavior.Sticky) != 0) {
                    DockGroupItem gitem = FindDockGroupItem (it.Id);
                    if (gitem != null && gitem.ParentGroup.IsSelectedPage (it))
                        sickyOnTop.Add (it);
                }
            }

            if (layout != null)
                layout.StoreAllocation ();
            layout = dl;
            layout.RestoreAllocation ();

            // Make sure items not present in this layout are hidden
            foreach (DockItem it in items) {
                if ((it.Behavior & DockItemBehavior.Sticky) != 0)
                    it.Visible = it.StickyVisible;
                if (layout.FindDockGroupItem (it.Id) == null)
                    it.HideWidget ();
            }

            RelayoutWidgets ();

            foreach (DockItem it in sickyOnTop)
                it.Present (false);
        }
예제 #3
0
파일: DockLayout.cs 프로젝트: rdafoe/Cage
        public static DockLayout Read(DockFrame frame, XmlReader reader)
        {
            DockLayout layout = new DockLayout(frame);

            layout.Read(reader);
            return(layout);
        }
예제 #4
0
파일: DockFrame.cs 프로젝트: rdafoe/Cage
        DockLayout GetDefaultLayout()
        {
            DockLayout group = new DockLayout(this);

            // Add items which don't have relative defaut positions

            List <DockItem> todock = new List <DockItem> ();

            foreach (DockItem item in container.Items)
            {
                if (string.IsNullOrEmpty(item.DefaultLocation))
                {
                    DockGroupItem dgt = new DockGroupItem(this, item);
                    dgt.SetVisible(item.DefaultVisible);
                    group.AddObject(dgt);
                }
                else
                {
                    todock.Add(item);
                }
            }

            // Add items with relative positions.
            int lastCount = 0;

            while (lastCount != todock.Count)
            {
                lastCount = todock.Count;
                for (int n = 0; n < todock.Count; n++)
                {
                    DockItem it = todock [n];
                    if (AddDefaultItem(group, it) != null)
                    {
                        todock.RemoveAt(n);
                        n--;
                    }
                }
            }

            // Items which could not be docked because of an invalid default location
            foreach (DockItem item in todock)
            {
                DockGroupItem dgt = new DockGroupItem(this, item);
                dgt.SetVisible(false);
                group.AddObject(dgt);
            }
//			group.Dump ();
            return(group);
        }
예제 #5
0
        public void LoadLayout(DockLayout dl)
        {
            // Sticky items currently selected in notebooks will remain
            // selected after switching the layout
            List <DockItem> sickyOnTop = new List <DockItem> ();

            foreach (DockItem it in items)
            {
                if ((it.Behavior & DockItemBehavior.Sticky) != 0)
                {
                    DockGroupItem gitem = FindDockGroupItem(it.Id);
                    if (gitem != null && gitem.ParentGroup.IsSelectedPage(it))
                    {
                        sickyOnTop.Add(it);
                    }
                }
            }

            if (layout != null)
            {
                layout.StoreAllocation();
            }
            layout = dl;
            layout.RestoreAllocation();

            // Make sure items not present in this layout are hidden
            foreach (DockItem it in items)
            {
                if ((it.Behavior & DockItemBehavior.Sticky) != 0)
                {
                    it.Visible = it.StickyVisible;
                }
                if (layout.FindDockGroupItem(it.Id) == null)
                {
                    it.HideWidget();
                }
            }

            RelayoutWidgets();

            foreach (DockItem it in sickyOnTop)
            {
                it.Present(false);
            }
        }
예제 #6
0
 public void Clear()
 {
     layout = null;
 }
예제 #7
0
 public void Clear()
 {
     layout = null;
 }
예제 #8
0
파일: DockFrame.cs 프로젝트: rdafoe/Cage
        DockLayout GetDefaultLayout()
        {
            DockLayout group = new DockLayout (this);

            // Add items which don't have relative defaut positions

            List<DockItem> todock = new List<DockItem> ();
            foreach (DockItem item in container.Items) {
                if (string.IsNullOrEmpty (item.DefaultLocation)) {
                    DockGroupItem dgt = new DockGroupItem (this, item);
                    dgt.SetVisible (item.DefaultVisible);
                    group.AddObject (dgt);
                }
                else
                    todock.Add (item);
            }

            // Add items with relative positions.
            int lastCount = 0;
            while (lastCount != todock.Count) {
                lastCount = todock.Count;
                for (int n=0; n<todock.Count; n++) {
                    DockItem it = todock [n];
                    if (AddDefaultItem (group, it) != null) {
                        todock.RemoveAt (n);
                        n--;
                    }
                }
            }

            // Items which could not be docked because of an invalid default location
            foreach (DockItem item in todock) {
                DockGroupItem dgt = new DockGroupItem (this, item);
                dgt.SetVisible (false);
                group.AddObject (dgt);
            }
            //			group.Dump ();
            return group;
        }
예제 #9
0
파일: DockLayout.cs 프로젝트: rdafoe/Cage
 public static DockLayout Read(DockFrame frame, XmlReader reader)
 {
     DockLayout layout = new DockLayout (frame);
     layout.Read (reader);
     return layout;
 }