internal BoxLayout(BoxLayoutType layoutType, VirtualContainer layouted)
     : base(layouted)
 {
     _layoutType = layoutType;
 }
 protected LayoutManager(VirtualContainer layouted)
 {
     this._layouted = layouted;
 }
Esempio n. 3
0
 protected LayoutManager(VirtualContainer layouted)
 {
     this._layouted = layouted;
 }
Esempio n. 4
0
 internal BoxLayout(BoxLayoutType layoutType, VirtualContainer layouted)
     : base(layouted)
 {
     _layoutType = layoutType;
 }
Esempio n. 5
0
        private void Create(BoxLayoutType boxType, VirtualContainer parent, int nestingDepth, List <LayoutableGroup> userConfiguredLayoutableGroups)
        {
            parent.LayoutManager = new BoxLayout(boxType, parent);

            if (parent.Layoutables.Count == 1)
            {
                return;
            }

            List <AbstractLayoutable> layoutables      = parent.Layoutables.Cast <AbstractLayoutable>().ToList();
            List <LayoutableGroup>    layoutableGroups = new List <LayoutableGroup>();

            BuildInterimLayoutablesGroups(layoutables, boxType, layoutableGroups);
            MergeIntersectingLayoutableGroups(boxType, layoutableGroups);
            layoutableGroups.Sort();
            ConfigureLayoutableGroups(userConfiguredLayoutableGroups, layoutableGroups);

            List <VirtualContainer> vc = new List <VirtualContainer>(layoutableGroups.Count);
            int uSizeTmp = 0, vSizeTmp = 0;

            boxType.UV(parent.VirtualWidth, parent.VirtualHeight, ref uSizeTmp, ref vSizeTmp);
            for (int i = 0; i < layoutableGroups.Count; i++)
            {
                if (i == 0)
                {
                    vc.Add(new VirtualContainer(parent));
                    vc[i].Grouped             = layoutableGroups[i].Fixed;
                    vc[i].CustomLayoutControl = layoutableGroups[i].CustomLayoutControl;
                    vc[i].LayoutManager       = new BoxLayout(boxType, vc[i]);

                    //U und V müssen nicht gesetzt werden, da sie beim
                    //ersten Element immer 0 sind;

                    boxType.SetVirtualUSize(vc[i], layoutableGroups[i].Start + layoutableGroups[i].Size);
                    boxType.SetVirtualVSize(vc[i], vSizeTmp);

                    foreach (AbstractLayoutable asl in layoutableGroups[i].Controls)
                    {
                        asl.VirtualX = asl.AbsoluteX - vc[i].AbsoluteX;
                        asl.VirtualY = asl.AbsoluteY - vc[i].AbsoluteY;
                        //code für die aktuelle Breite und Höhe
                        asl.Parent = vc[i];
                        vc[i].Add(asl);
                    }
                }
                if (i < layoutableGroups.Count - 1)
                {
                    int tmp = layoutableGroups[i + 1].Start - (layoutableGroups[i].Start + layoutableGroups[i].Size);
                    int endExtend;
                    int start;

                    endExtend = tmp / 2;
                    start     = tmp / 2;
                    if (tmp % 2 != 0)
                    {
                        start++;
                    }

                    tmp = boxType.GetVirtualUSize(vc[i]) + endExtend;
                    boxType.SetVirtualUSize(vc[i], tmp);

                    vc.Add(new VirtualContainer(parent));
                    //"V" muss nicht gesetzt werden, da es immer 0 ist...
                    vc[i + 1].Grouped             = layoutableGroups[i + 1].Fixed;
                    vc[i + 1].CustomLayoutControl = layoutableGroups[i + 1].CustomLayoutControl;
                    vc[i + 1].LayoutManager       = new BoxLayout(boxType, vc[i + 1]);
                    boxType.SetVirtualU(vc[i + 1], layoutableGroups[i + 1].Start - start);
                    boxType.SetVirtualUSize(vc[i + 1], layoutableGroups[i + 1].Size + start);
                    boxType.SetVirtualVSize(vc[i + 1], vSizeTmp);

                    foreach (AbstractLayoutable asl in layoutableGroups[i + 1].Controls)
                    {
                        asl.VirtualX = asl.AbsoluteX - vc[i + 1].AbsoluteX;
                        asl.VirtualY = asl.AbsoluteY - vc[i + 1].AbsoluteY;
                        //code für die aktuelle Breite und Höhe
                        asl.Parent = vc[i + 1];
                        vc[i + 1].Add(asl);
                    }
                }
                if (i == layoutableGroups.Count - 1)
                {
                    int tmp = uSizeTmp - (layoutableGroups[i].Start + layoutableGroups[i].Size);
                    tmp = tmp + boxType.GetVirtualUSize(vc[i]);
                    boxType.SetVirtualUSize(vc[i], tmp);
                }
            }

            parent.Layoutables = vc.Cast <AbstractLayoutable>().ToList();

            foreach (VirtualContainer v in vc)
            {
                Create(boxType.SubBoxLayoutType(), v, nestingDepth + 1, userConfiguredLayoutableGroups);
            }

            return;
        }