Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public static DockLayout Read(DockFrame frame, XmlReader reader)
        {
            DockLayout layout = new DockLayout(frame);

            layout.Read(reader);
            return(layout);
        }
Exemplo n.º 3
0
        public void LoadLayout(DockLayout dl)
        {
            HidePlaceholder();

            // Sticky items currently selected in notebooks will remain
            // selected after switching the layout
            List <DockItem> stickyOnTop = 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))
                    {
                        stickyOnTop.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();
                    // note: visible first & hide next is important
                    // to add existing objects in this layout as a hidden object
                    // this is a workaround to add such objects correctly, otherwise title frame is wrong
                    it.Visible = true;
                    it.Visible = false;
                }
            }

            RelayoutWidgets();

            foreach (DockItem it in stickyOnTop)
            {
                it.Present(false);
            }
        }
Exemplo n.º 4
0
        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); // may should reactivated
                    dgt.SetVisible(false);
                    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);
        }
Exemplo n.º 5
0
 public void Clear()
 {
     layout = null;
 }
Exemplo n.º 6
0
        public void LoadLayout(DockLayout dl)
        {
            HidePlaceholder();

             // Sticky items currently selected in notebooks will remain
             // selected after switching the layout
             List<DockItem> stickyOnTop = 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))
                  stickyOnTop.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();
               // note: visible first & hide next is important
               // to add existing objects in this layout as a hidden object
               // this is a workaround to add such objects correctly, otherwise title frame is wrong
               it.Visible = true;
               it.Visible = false;
            }
             }

             RelayoutWidgets();

             foreach (DockItem it in stickyOnTop)
            it.Present(false);
        }
Exemplo n.º 7
0
 public void Clear()
 {
     layout = null;
 }
Exemplo n.º 8
0
 public static DockLayout Read(DockFrame frame, XmlReader reader)
 {
     DockLayout layout = new DockLayout (frame);
     layout.Read (reader);
     return layout;
 }
Exemplo n.º 9
0
        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); // may should reactivated
                    dgt.SetVisible(false);
                    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;
        }