Esempio n. 1
0
 DockGroupItem AddItemAtLocation(DockGroup grp, DockItem it, string location, bool visible, DockItemStatus status)
 {
     string[] positions = location.Split(';');
     foreach (string pos in positions)
     {
         int i = pos.IndexOf('/');
         if (i == -1)
         {
             continue;
         }
         string    id = pos.Substring(0, i).Trim();
         DockGroup g  = grp.FindGroupContaining(id);
         if (g != null)
         {
             DockPosition dpos;
             try {
                 dpos = (DockPosition)Enum.Parse(typeof(DockPosition), pos.Substring(i + 1).Trim(), true);
             }
             catch {
                 continue;
             }
             DockGroupItem dgt = g.AddObject(it, dpos, id);
             dgt.SetVisible(visible);
             dgt.Status = status;
             return(dgt);
         }
     }
     return(null);
 }
Esempio n. 2
0
        DockGroupItem Split(DockGroupType newType, bool addFirst, DockItem obj, int npos)
        {
            DockGroupItem item = new DockGroupItem(Frame, obj);

            if (npos == -1 || type == DockGroupType.Tabbed)
            {
                if (ParentGroup != null && ParentGroup.Type == newType)
                {
                    // No need to split. Just add the new item as a sibling of this one.
                    int i = ParentGroup.Objects.IndexOf(this);
                    if (addFirst)
                    {
                        ParentGroup.Objects.Insert(i, item);
                    }
                    else
                    {
                        ParentGroup.Objects.Insert(i + 1, item);
                    }
                    item.ParentGroup = ParentGroup;
                    item.ResetDefaultSize();
                }
                else
                {
                    DockGroup grp = Copy();
                    dockObjects.Clear();
                    if (addFirst)
                    {
                        dockObjects.Add(item);
                        dockObjects.Add(grp);
                    }
                    else
                    {
                        dockObjects.Add(grp);
                        dockObjects.Add(item);
                    }
                    item.ParentGroup = this;
                    item.ResetDefaultSize();
                    grp.ParentGroup = this;
                    grp.ResetDefaultSize();
                    Type = newType;
                }
            }
            else
            {
                DockGroup  grp      = new DockGroup(Frame, newType);
                DockObject replaced = dockObjects[npos];
                if (addFirst)
                {
                    grp.AddObject(item);
                    grp.AddObject(replaced);
                }
                else
                {
                    grp.AddObject(replaced);
                    grp.AddObject(item);
                }
                grp.CopySizeFrom(replaced);
                dockObjects [npos] = grp;
                grp.ParentGroup    = this;
            }
            return(item);
        }