Пример #1
0
		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;
				}
				frame.UpdateRegionStyle (grp);
				ts.VisualStyle = grp.VisualStyle;
				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 ();
			}

			// Create and add the required splitters

			int reqSpliters = CountRequiredSplitters (layout);

			for (int n=0; n < splitters.Count; n++) {
				var s = splitters [n];
				if (s.Parent != null)
					Remove (s);
			}

			// Hide the splitters that are not required

			for (int n=reqSpliters; n < splitters.Count; n++)
				splitters[n].Hide ();

			// Add widgets to the container
			
			layout.LayoutWidgets ();

			// Create and add the required splitters

			for (int n=0; n < reqSpliters; n++) {
				if (n < splitters.Count) {
					var s = splitters [n];
					if (!s.Visible)
						s.Show ();
					Add (s);
				} else {
					var s = new SplitterWidget ();
					splitters.Add (s);
					s.Show ();
					Add (s);
				}
			}
		}
Пример #2
0
        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;

                    GtkWorkarounds.EmitAddSignal(this, ts);
                }
                frame.UpdateRegionStyle(grp);
                ts.VisualStyle = grp.VisualStyle;
                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();
            }

            // Create and add the required splitters

            int reqSpliters = CountRequiredSplitters(layout);

            for (int n = 0; n < splitters.Count; n++)
            {
                var s = splitters [n];
                if (s.Parent != null)
                {
                    Remove(s);
                }
            }

            // Hide the splitters that are not required

            for (int n = reqSpliters; n < splitters.Count; n++)
            {
                splitters[n].Hide();
            }

            // Add widgets to the container

            layout.LayoutWidgets();

            // Create and add the required splitters

            for (int n = 0; n < reqSpliters; n++)
            {
                if (n < splitters.Count)
                {
                    var s = splitters [n];
                    if (!s.Visible)
                    {
                        s.Show();
                    }
                    Add(s);
                }
                else
                {
                    var s = new SplitterWidget();
                    splitters.Add(s);
                    s.Show();
                    Add(s);
                }
            }
        }
        void LayoutWidgets()
        {
            if (!needsRelayout)
            {
                return;
            }
            needsRelayout = false;

            // RemoveNotebooks();

            // 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];
                ITabStrip ts  = null;
                if (n < notebooks.Count)
                {
                    ts = notebooks[n];
                }
                else
                {
                    switch (frame.TabType)
                    {
                    case DockFrame.TabAlgorithm.Proven:
                        ts = new TabStrip();
                        break;

                    case DockFrame.TabAlgorithm.Smooth:
                        ts = new TabSelector(false);
                        break;

                    case DockFrame.TabAlgorithm.Active:
                        ts = new TabSelector(true);
                        break;
                    }

                    ts.Show();
                    notebooks.Add(ts);
                    ts.Parent = this;
                }
                frame.UpdateRegionStyle(grp);
                ts.VisualStyle = grp.VisualStyle;
                grp.UpdateNotebook(ts);
            }

            // Remove spare tab strips
            for (int n = notebooks.Count - 1; n >= tabbedGroups.Count; n--)
            {
                ITabStrip ts = notebooks[n];
                notebooks.RemoveAt(n);
                ts.Clear();
                ts.Unparent();
                ts.Destroy();
            }

            // Create and add the required splitters

            int reqSpliters = CountRequiredSplitters(layout);

            for (int n = 0; n < splitters.Count; n++)
            {
                var s = splitters[n];
                if (s.Parent != null)
                {
                    Remove(s);
                }
            }

            // Hide the splitters that are not required

            for (int n = reqSpliters; n < splitters.Count; n++)
            {
                splitters[n].Hide();
            }

            // Add widgets to the container

            layout.LayoutWidgets();

            // Create and add the required splitters

            for (int n = 0; n < reqSpliters; n++)
            {
                if (n < splitters.Count)
                {
                    var s = splitters[n];
                    if (!s.Visible)
                    {
                        s.Show();
                    }
                    Add(s);
                }
                else
                {
                    var s = new SplitterWidget();
                    splitters.Add(s);
                    s.Show();
                    Add(s);
                }
            }
        }