void LayoutWidgets() { if (!needsRelayout) { return; } needsRelayout = false; // Create the needed notebooks and place the widgets in there List <DockGroup> tabbedGroups = new List <DockGroup> (); GetTabbedGroups(layout, tabbedGroups); for (int n = 0; n < tabbedGroups.Count; n++) { DockGroup grp = tabbedGroups [n]; TabStrip ts; if (n < notebooks.Count) { ts = notebooks [n]; } else { ts = new TabStrip(frame); ts.Show(); notebooks.Add(ts); ts.Parent = this; } grp.UpdateNotebook(ts); } // Remove spare tab strips for (int n = notebooks.Count - 1; n >= tabbedGroups.Count; n--) { TabStrip ts = notebooks [n]; notebooks.RemoveAt(n); ts.Clear(); ts.Unparent(); ts.Destroy(); } // Add widgets to the container layout.LayoutWidgets(); NotifySeparatorsChanged(); }
internal void UpdateNotebook(TabStrip ts) { Gtk.Widget oldpage = null; int oldtab = -1; if (tabFocus != null) { oldpage = tabFocus.Item.Widget; tabFocus = null; } else if (boundTabStrip != null) { oldpage = boundTabStrip.CurrentPage; oldtab = boundTabStrip.CurrentTab; } ts.Clear(); // Add missing pages foreach (DockObject ob in VisibleObjects) { DockGroupItem it = ob as DockGroupItem; ts.AddTab(it.Item.Widget, it.Item.Icon, it.Item.Label); } boundTabStrip = ts; if (currentTabPage != -1 && currentTabPage < boundTabStrip.TabCount) { boundTabStrip.CurrentTab = currentTabPage; // Discard the currentTabPage value. Current page is now tracked by the tab strip currentTabPage = -1; } else if (oldpage != null) { boundTabStrip.CurrentPage = oldpage; } if (boundTabStrip.CurrentTab == -1) { if (oldtab != -1) { if (oldtab < boundTabStrip.TabCount) { boundTabStrip.CurrentTab = oldtab; } else { boundTabStrip.CurrentTab = boundTabStrip.TabCount - 1; } } else { boundTabStrip.CurrentTab = 0; } } if (Frame.CompactGuiLevel == 3 && IsNextToMargin(PositionType.Bottom, true)) { boundTabStrip.BottomPadding = 3; } else { boundTabStrip.BottomPadding = 0; } }