Пример #1
0
        void DrawAsBrowser(Gdk.EventExpose evnt)
        {
            var alloc = Allocation;

            Gdk.GC bgc = new Gdk.GC(GdkWindow);
            var    c   = VisualStyle.PadBackgroundColor.Value;

            c.Light       *= 0.7;
            bgc.RgbFgColor = c.ToGdkColor();
            bool     first    = true;
            bool     last     = true;
            TabStrip tabStrip = null;

            if (Parent is TabStrip.TabStripBox)
            {
                var tsb = (TabStrip.TabStripBox)Parent;
                var cts = tsb.Children;
                first    = cts[0] == this;
                last     = cts[cts.Length - 1] == this;
                tabStrip = tsb.TabStrip;
            }

            if (Active || (first && last))
            {
                Gdk.GC gc = new Gdk.GC(GdkWindow);
                gc.RgbFgColor = VisualStyle.PadBackgroundColor.Value.ToGdkColor();
                evnt.Window.DrawRectangle(gc, true, alloc);
                if (!first)
                {
                    evnt.Window.DrawLine(bgc, alloc.X, alloc.Y, alloc.X, alloc.Y + alloc.Height - 1);
                }
                if (!(last && first) && !(tabStrip != null && tabStrip.VisualStyle.ExpandedTabs.Value && last))
                {
                    evnt.Window.DrawLine(bgc, alloc.X + alloc.Width - 1, alloc.Y, alloc.X + alloc.Width - 1, alloc.Y + alloc.Height - 1);
                }
                gc.Dispose();
            }
            else
            {
                Gdk.GC gc = new Gdk.GC(GdkWindow);
                gc.RgbFgColor = tabStrip != null?tabStrip.VisualStyle.InactivePadBackgroundColor.Value.ToGdkColor() : frame.DefaultVisualStyle.InactivePadBackgroundColor.Value.ToGdkColor();

                evnt.Window.DrawRectangle(gc, true, alloc);
                gc.Dispose();
                evnt.Window.DrawLine(bgc, alloc.X, alloc.Y + alloc.Height - 1, alloc.X + alloc.Width - 1, alloc.Y + alloc.Height - 1);
            }
            bgc.Dispose();
        }
Пример #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;
                }
                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();
        }
        public override void CopyFrom(DockObject other)
        {
            base.CopyFrom(other);
            DockGroup grp = (DockGroup)other;

            dockObjects = new List <DockObject> ();
            foreach (DockObject ob in grp.dockObjects)
            {
                DockObject cob = ob.Clone();
                cob.ParentGroup = this;
                dockObjects.Add(cob);
            }
            type = grp.type;
            ResetVisibleGroups();
            boundTabStrip = null;
            tabFocus      = null;
        }
Пример #4
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);
                }
            }
        }
 internal void ResetNotebook()
 {
     boundTabStrip = null;
 }
        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;
            }
        }
Пример #7
0
        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;
        }
Пример #8
0
 internal void ResetNotebook()
 {
     boundTabStrip = null;
 }
Пример #9
0
 public override void CopyFrom(DockObject other)
 {
     base.CopyFrom (other);
     DockGroup grp = (DockGroup) other;
     dockObjects = new List<DockObject> ();
     foreach (DockObject ob in grp.dockObjects) {
         DockObject cob = ob.Clone ();
         cob.ParentGroup = this;
         dockObjects.Add (cob);
     }
     type = grp.type;
     ResetVisibleGroups ();
     boundTabStrip = null;
     tabFocus = null;
 }
Пример #10
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;
				}
				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 ();
		}