예제 #1
0
        private void CreateWidgetForPlacement(Splitter container, Placement placement, float stretch = 1, bool isMainWindow = false)
        {
            if (placement == null || !placement.AnyVisiblePanel())
            {
                return;
            }
            bool requestTitle = placement is WindowPlacement windowPlacement &&
                                windowPlacement.GetVisiblePanelPlacements().Count() > 1 &&
                                !isMainWindow;

            placement.SwitchType(
                panel => CreatePanelWidget(container, panel, stretch),
                panelGroup => {
                if (panelGroup.GetPanelPlacements().Count(p => !p.Hidden) == 1)
                {
                    CreatePanelWidget(container, panelGroup.GetPanelPlacements().First(p => !p.Hidden), stretch);
                }
                else
                {
                    CreateTabBarWidget(container, panelGroup, stretch, !requestTitle);
                }
            },
                group => CreateLinearWidget(container, group, stretch, requestTitle)
                );
        }
예제 #2
0
        private void CreateWidgetForPlacement(Splitter container, Placement placement, float stretch = 1, bool isFirst = true)
        {
            var insertAt = isFirst ? 0 : 1;

            if (container.Nodes.Count == 0)
            {
                insertAt = 0;
            }
            if (placement == null || !placement.AnyVisiblePanel())
            {
                return;
            }
            placement.SwitchType(
                panel => CreatePanelWidget(container, panel, stretch, insertAt),
                panelGroup => {
                if (panelGroup.GetDescendantPanels().Count(p => !p.Hidden) == 1)
                {
                    CreatePanelWidget(container, panelGroup.GetDescendantPanels().First(p => !p.Hidden), stretch, insertAt);
                }
                else
                {
                    CreateTabBarWidget(container, panelGroup, stretch, insertAt);
                }
            },
                group => CreateSplitWidget(container, group, stretch, insertAt)
                );
        }