Exemple #1
0
 public void StartOpenAnimation(DockNotebookTab tab)
 {
     tab.WidthModifier = 0;
     new Animation(f => tab.WidthModifier          = f)
     .AddConcurrent(new Animation(f => tab.Opacity = f), 0.0d, 0.2d)
     .Commit(tab, "Open", easing: Easing.CubicInOut);
 }
Exemple #2
0
        public void CloseTab(DockNotebookTab tab)
        {
            var notebook = tab.Notebook;
            var index    = notebook.Tabs.IndexOf(tab);

            notebook.RemoveTab(index, true);
        }
Exemple #3
0
 internal void ShowContent(DockNotebookTab tab)
 {
     if (tab == currentTab)
     {
         contentBox.Child = tab.Content;
     }
 }
Exemple #4
0
        public DockNotebookTab InsertTab(int index)
        {
            var tab = new DockNotebookTab(this, tabStrip);

            if (index == -1)
            {
                pages.Add(tab);
                tab.Index = pages.Count - 1;
            }
            else
            {
                pages.Insert(index, tab);
                tab.Index = index;
                UpdateIndexes(index + 1);
            }

            pagesHistory.Add(tab);

            if (pages.Count == 1)
            {
                CurrentTab = tab;
            }

            tabStrip.StartOpenAnimation((DockNotebookTab)tab);
            tabStrip.Update();
            tabStrip.DropDownButton.Sensitive = pages.Count > 0;

            if (PageAdded != null)
            {
                PageAdded(this, EventArgs.Empty);
            }

            return(tab);
        }
Exemple #5
0
        void SetHighlightedTab(DockNotebookTab tab)
        {
            if (highlightedTab == tab)
            {
                return;
            }

            if (highlightedTab != null)
            {
                var tmp = highlightedTab;
                tmp.Animate("Glow",
                            f => tmp.GlowStrength = f,
                            start: tmp.GlowStrength,
                            end: 0);
            }

            if (tab != null)
            {
                tab.Animate("Glow",
                            f => tab.GlowStrength = f,
                            start: tab.GlowStrength,
                            end: 1);
            }

            highlightedTab = tab;
            QueueDraw();
        }
Exemple #6
0
		public PlaceholderWindow (DockNotebookTab tab): base (Gtk.WindowType.Toplevel)
		{
			this.frame = tab;
			SkipTaskbarHint = true;
			Decorated = false;
			TypeHint = WindowTypeHint.Utility;
			titleWindow = new DocumentTitleWindow (this, tab);
            //IdeApp.Workbench.LockActiveWindowChangeEvent ();

			titleWindow.FocusInEvent += delegate {
				if (timeout != 0) {
					GLib.Source.Remove (timeout);
					timeout = 0;
				}
			};

			titleWindow.FocusOutEvent += delegate {
				timeout = GLib.Timeout.Add (100, () => {
					titleWindow.Close ();
					return false;
				});
			};

            //var windowStack = IdeApp.CommandService.TopLevelWindowStack.ToArray ();
            allNotebooks = DockNotebook.AllNotebooks.ToList ();
            //allNotebooks.Sort (delegate(DockNotebook x, DockNotebook y) {
            //    var ix = Array.IndexOf (windowStack, (Gtk.Window) x.Toplevel);
            //    var iy = Array.IndexOf (windowStack, (Gtk.Window) y.Toplevel);
            //    if (ix == -1) ix = int.MaxValue;
            //    if (iy == -1) iy = int.MaxValue;
            //    return ix.CompareTo (iy);
            //});
		}
Exemple #7
0
        public PlaceholderWindow(DockNotebookTab tab) : base(Gtk.WindowType.Toplevel)
        {
            this.frame      = tab;
            SkipTaskbarHint = true;
            Decorated       = false;
            TypeHint        = WindowTypeHint.Utility;
            titleWindow     = new DocumentTitleWindow(this, tab);
            //IdeApp.Workbench.LockActiveWindowChangeEvent ();

            titleWindow.FocusInEvent += delegate {
                if (timeout != 0)
                {
                    GLib.Source.Remove(timeout);
                    timeout = 0;
                }
            };

            titleWindow.FocusOutEvent += delegate {
                timeout = GLib.Timeout.Add(100, () => {
                    titleWindow.Close();
                    return(false);
                });
            };

            //var windowStack = IdeApp.CommandService.TopLevelWindowStack.ToArray ();
            allNotebooks = DockNotebook.AllNotebooks.ToList();
            //allNotebooks.Sort (delegate(DockNotebook x, DockNotebook y) {
            //    var ix = Array.IndexOf (windowStack, (Gtk.Window) x.Toplevel);
            //    var iy = Array.IndexOf (windowStack, (Gtk.Window) y.Toplevel);
            //    if (ix == -1) ix = int.MaxValue;
            //    if (iy == -1) iy = int.MaxValue;
            //    return ix.CompareTo (iy);
            //});
        }
Exemple #8
0
        void PlaceInHoverNotebook(DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
        {
            var window = (SdiWorkspaceWindow)tab.Content;
            var newTab = hoverNotebook.AddTab(window);

            window.SetDockNotebook(hoverNotebook, newTab);
            window.SelectWindow();
        }
Exemple #9
0
 internal void OnActivateTab(DockNotebookTab tab)
 {
     if (TabActivated != null)
     {
         TabActivated(this, new TabEventArgs()
         {
             Tab = tab
         });
     }
 }
Exemple #10
0
        // Returns true if the tab was successfully closed
        internal bool OnCloseTab(DockNotebookTab tab)
        {
            var e = new TabClosedEventArgs()
            {
                Tab = tab
            };

            DockNotebookManager.OnTabClosed(this, e);

            return(!e.Cancel);
        }
Exemple #11
0
 Pango.Layout CreateTabLayout(DockNotebookTab tab)
 {
     Pango.Layout la = CreateSizedLayout();
     if (!string.IsNullOrEmpty(tab.Markup))
     {
         la.SetMarkup(tab.Markup);
     }
     else if (!string.IsNullOrEmpty(tab.Text))
     {
         la.SetText(tab.Text);
     }
     return(la);
 }
Exemple #12
0
 Action <Context> DrawClosingTab(int index, Gdk.Rectangle region, out int width)
 {
     width = 0;
     if (closingTabs.ContainsKey(index))
     {
         DockNotebookTab closingTab = closingTabs [index];
         width = (int)(closingTab.WidthModifier * TabWidth);
         int tmp = width;
         return(c => DrawTab(c, closingTab, Allocation, new Gdk.Rectangle(region.X, region.Y, tmp, region.Height), false, false, false, CreateTabLayout(closingTab)));
     }
     return(c => {
     });
 }
Exemple #13
0
 public void StartCloseAnimation(DockNotebookTab tab)
 {
     closingTabs [tab.Index] = tab;
     new Animation(f => tab.WidthModifier          = f, tab.WidthModifier, 0)
     .AddConcurrent(new Animation(f => tab.Opacity = f, tab.Opacity, 0), 0.8d)
     .Commit(tab, "Closing",
             easing: Easing.CubicOut,
             finished: (f, a) => {
         if (!a)
         {
             closingTabs.Remove(tab.Index);
         }
     });
 }
Exemple #14
0
        static void PlaceInFloatingFrame(DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
        {
            var newWindow   = new DockWindow();
            var newNotebook = newWindow.Container.GetFirstNotebook();
            var newTab      = newNotebook.AddTab();

            var workspaceWindow = (SdiWorkspaceWindow)tab.Content;

            newTab.Content = workspaceWindow;
            // JONTODO
            //newWindow.Title = DefaultWorkbench.GetTitle (workspaceWindow);

            workspaceWindow.SetDockNotebook(newNotebook, newTab);
            newWindow.Move(ox - w / 2, oy - h / 2);
            newWindow.Resize(w, h);
            newWindow.ShowAll();
            DockNotebook.ActiveNotebook = newNotebook;
        }
Exemple #15
0
        public DocumentTitleWindow(PlaceholderWindow placeholder, DockNotebookTab draggedItem) : base(Gtk.WindowType.Toplevel)
        {
            this.placeholder = placeholder;

            SkipTaskbarHint = true;
            Decorated       = false;

            //TransientFor = parent;
            TypeHint = WindowTypeHint.Utility;

            VBox mainBox = new VBox();

            mainBox.Spacing = 3;

            titleBox = new HBox(false, 3);
            if (draggedItem.Icon != null)
            {
                var img = new ImageView(draggedItem.Icon);
                titleBox.PackStart(img, false, false, 0);
            }
            Gtk.Label la = new Label();
            la.Markup = draggedItem.Text;
            titleBox.PackStart(la, false, false, 0);

            mainBox.PackStart(titleBox, false, false, 0);

            var wi = RenderWidget(draggedItem.Content);

            if (wi != null)
            {
                wi = wi.WithBoxSize(200);
                mainBox.PackStart(new ImageView(wi), false, false, 0);
            }

            CustomFrame f = new CustomFrame();

            f.SetPadding(2, 2, 2, 2);
            f.SetMargins(1, 1, 1, 1);
            f.Add(mainBox);

            Add(f);
            mainBox.CanFocus = true;
            Child.ShowAll();
        }
Exemple #16
0
        internal void ReorderTab(DockNotebookTab tab, DockNotebookTab targetTab)
        {
            if (tab == targetTab)
            {
                return;
            }
            int targetPos = targetTab.Index;

            if (tab.Index > targetTab.Index)
            {
                pages.RemoveAt(tab.Index);
                pages.Insert(targetPos, tab);
            }
            else
            {
                pages.Insert(targetPos + 1, tab);
                pages.RemoveAt(tab.Index);
            }
            // JONTODO
            //IdeApp.Workbench.ReorderDocuments (tab.Index, targetPos);
            UpdateIndexes(Math.Min(tab.Index, targetPos));
            tabStrip.Update();
        }
Exemple #17
0
		public DockNotebookTab InsertTab (int index)
		{
			var tab = new DockNotebookTab (this, tabStrip);
			if (index == -1) {
				pages.Add (tab);
				tab.Index = pages.Count - 1;
			} else {
				pages.Insert (index, tab);
				tab.Index = index;
				UpdateIndexes (index + 1);
			}

			pagesHistory.Add (tab);

			if (pages.Count == 1)
				CurrentTab = tab;

			tabStrip.StartOpenAnimation ((DockNotebookTab)tab);
			tabStrip.Update ();
			tabStrip.DropDownButton.Sensitive = pages.Count > 0;

			if (PageAdded != null)
				PageAdded (this, EventArgs.Empty);

			return tab;
		}
Exemple #18
0
		internal void ReorderTab (DockNotebookTab tab, DockNotebookTab targetTab)
		{
			if (tab == targetTab)
				return;
			int targetPos = targetTab.Index;
			if (tab.Index > targetTab.Index) {
				pages.RemoveAt (tab.Index);
				pages.Insert (targetPos, tab);
			} else {
				pages.Insert (targetPos + 1, tab);
				pages.RemoveAt (tab.Index);
			}
            // JONTODO
			//IdeApp.Workbench.ReorderDocuments (tab.Index, targetPos);
			UpdateIndexes (Math.Min (tab.Index, targetPos));
			tabStrip.Update ();
		}
Exemple #19
0
		Pango.Layout CreateTabLayout (DockNotebookTab tab)
		{
			Pango.Layout la = CreateSizedLayout ();
			if (!string.IsNullOrEmpty (tab.Markup))
				la.SetMarkup (tab.Markup);
			else if (!string.IsNullOrEmpty (tab.Text))
				la.SetText (tab.Text);
			return la;
		}
Exemple #20
0
		void DrawTab (Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Rectangle tabBounds, bool highlight, bool active, bool dragging, Pango.Layout la)
		{
			// This logic is stupid to have here, should be in the caller!
			if (dragging) {
				tabBounds.X = (int)(tabBounds.X + (dragX - tabBounds.X) * dragXProgress);
				tabBounds.X = Clamp (tabBounds.X, tabStartX, tabEndX - tabBounds.Width);
			}
			int padding = LeftRightPadding;
			padding = (int)(padding * Math.Min (1.0, Math.Max (0.5, (tabBounds.Width - 30) / 70.0)));

			ctx.LineWidth = 1;
			LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 0, active);
			ctx.ClosePath ();
			using (var gr = new LinearGradient (tabBounds.X, TopBarPadding, tabBounds.X, allocation.Bottom)) {
				if (active) {
					gr.AddColorStop (0, Styles.BreadcrumbGradientStartColor.MultiplyAlpha (tab.Opacity));
					gr.AddColorStop (1, Styles.BreadcrumbBackgroundColor.MultiplyAlpha (tab.Opacity));
				} else {
					gr.AddColorStop (0, CairoExtensions.ParseColor ("f4f4f4").MultiplyAlpha (tab.Opacity));
					gr.AddColorStop (1, CairoExtensions.ParseColor ("cecece").MultiplyAlpha (tab.Opacity));
				}
				ctx.SetSource (gr);
			}
			ctx.Fill ();

			ctx.SetSourceColor (new Cairo.Color (1, 1, 1, .5).MultiplyAlpha (tab.Opacity));
			LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 1, active);
			ctx.Stroke ();

			ctx.SetSourceColor (Styles.BreadcrumbBorderColor.MultiplyAlpha (tab.Opacity));
			LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 0, active);
			ctx.StrokePreserve ();

			if (tab.GlowStrength > 0) {
				Gdk.Point mouse = tracker.MousePosition;
				using (var rg = new RadialGradient (mouse.X, tabBounds.Bottom, 0, mouse.X, tabBounds.Bottom, 100)) {
					rg.AddColorStop (0, new Cairo.Color (1, 1, 1, 0.4 * tab.Opacity * tab.GlowStrength));
					rg.AddColorStop (1, new Cairo.Color (1, 1, 1, 0));

					ctx.SetSource (rg);
					ctx.Fill ();
				}
			} else {
				ctx.NewPath ();
			}

			// Render Close Button (do this first so we can tell how much text to render)

			var ch = allocation.Height - TopBarPadding - BottomBarPadding + CloseImageTopOffset;
			var crect = new Gdk.Rectangle (tabBounds.Right - padding - CloseButtonSize + 3,
				            tabBounds.Y + TopBarPadding + (ch - CloseButtonSize) / 2,
				            CloseButtonSize, CloseButtonSize);
			tab.CloseButtonAllocation = crect;
			tab.CloseButtonAllocation.Inflate (2, 2);

			bool closeButtonHovered = tracker.Hovered && tab.CloseButtonAllocation.Contains (tracker.MousePosition) && tab.WidthModifier >= 1.0f;
			bool drawCloseButton = tabBounds.Width > 60 || highlight || closeButtonHovered;
			if (drawCloseButton) {
				DrawCloseButton (ctx, new Gdk.Point (crect.X + crect.Width / 2, crect.Y + crect.Height / 2), closeButtonHovered, tab.Opacity, tab.DirtyStrength);
			}

			// Render Text
			int w = tabBounds.Width - (padding * 2 + CloseButtonSize);
			if (!drawCloseButton)
				w += CloseButtonSize;

			int textStart = tabBounds.X + padding;

			ctx.MoveTo (textStart, tabBounds.Y + TopPadding + TextOffset + VerticalTextSize);
			if (!Platform.IsMac && !Platform.IsWindows) {
				// This is a work around for a linux specific problem.
				// A bug in the proprietary ATI driver caused TAB text not to draw.
				// If that bug get's fixed remove this HACK asap.
				la.Ellipsize = Pango.EllipsizeMode.End;
				la.Width = (int)(w * Pango.Scale.PangoScale);
				ctx.SetSourceColor (tab.Notify ? new Cairo.Color (0, 0, 1) : Styles.TabBarActiveTextColor);
				Pango.CairoHelper.ShowLayoutLine (ctx, la.GetLine (0));
			} else {
				// ellipses are for space wasting ..., we cant afford that
				using (var lg = new LinearGradient (textStart + w - 5, 0, textStart + w + 3, 0)) {
					var color = tab.Notify ? new Cairo.Color (0, 0, 1) : Styles.TabBarActiveTextColor;
					color = color.MultiplyAlpha (tab.Opacity);
					lg.AddColorStop (0, color);
					color.A = 0;
					lg.AddColorStop (1, color);
					ctx.SetSource (lg);
					Pango.CairoHelper.ShowLayoutLine (ctx, la.GetLine (0));
				}
			}
			la.Dispose ();
		}
Exemple #21
0
		internal void ShowContent (DockNotebookTab tab)
		{
			if (tab == currentTab)
				contentBox.Child = tab.Content;
		}
Exemple #22
0
		public DocumentTitleWindow (PlaceholderWindow placeholder, DockNotebookTab draggedItem): base (Gtk.WindowType.Toplevel)
		{
			this.placeholder = placeholder;

			SkipTaskbarHint = true;
			Decorated = false;

			//TransientFor = parent;
			TypeHint = WindowTypeHint.Utility;

			VBox mainBox = new VBox ();
			mainBox.Spacing = 3;

			titleBox = new HBox (false, 3);
			if (draggedItem.Icon != null) {
				var img = new ImageView (draggedItem.Icon);
				titleBox.PackStart (img, false, false, 0);
			}
			Gtk.Label la = new Label ();
			la.Markup = draggedItem.Text;
			titleBox.PackStart (la, false, false, 0);

			mainBox.PackStart (titleBox, false, false, 0);

            var wi = RenderWidget (draggedItem.Content);
            if (wi != null) {
                wi = wi.WithBoxSize (200);
                mainBox.PackStart (new ImageView (wi), false, false, 0);
            }

			CustomFrame f = new CustomFrame ();
			f.SetPadding (2, 2, 2, 2);
			f.SetMargins (1, 1, 1, 1);
			f.Add (mainBox);

			Add (f);
			mainBox.CanFocus = true;
			Child.ShowAll ();
		}
Exemple #23
0
		public void StartCloseAnimation (DockNotebookTab tab)
		{
			closingTabs [tab.Index] = tab;
			new Animation (f => tab.WidthModifier = f, tab.WidthModifier, 0)
				.AddConcurrent (new Animation (f => tab.Opacity = f, tab.Opacity, 0), 0.8d)
				.Commit (tab, "Closing",
				easing: Easing.CubicOut,
				finished: (f, a) => {
					if (!a)
						closingTabs.Remove (tab.Index);
				});
		}
Exemple #24
0
		public void StartOpenAnimation (DockNotebookTab tab)
		{
			tab.WidthModifier = 0;
			new Animation (f => tab.WidthModifier = f)
				.AddConcurrent (new Animation (f => tab.Opacity = f), 0.0d, 0.2d)
				.Commit (tab, "Open", easing: Easing.CubicInOut);
		}
Exemple #25
0
        // Returns true if the tab was successfully closed
		internal bool OnCloseTab (DockNotebookTab tab)
		{
            var e = new TabClosedEventArgs () { Tab = tab };

			DockNotebookManager.OnTabClosed (this, e);

            return !e.Cancel;
		}
Exemple #26
0
		void PlaceInHoverNotebook (DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
		{
			var window = (SdiWorkspaceWindow)tab.Content;
			var newTab = hoverNotebook.AddTab (window); 
			window.SetDockNotebook (hoverNotebook, newTab); 
			window.SelectWindow ();
		}
Exemple #27
0
 public void ActivateTab (DockNotebookTab tab)
 {
     DockNotebook.ActiveNotebook = tab.Notebook;
     tab.Notebook.CurrentTab = tab;
 }
Exemple #28
0
 public void ActivateTab(DockNotebookTab tab)
 {
     DockNotebook.ActiveNotebook = tab.Notebook;
     tab.Notebook.CurrentTab     = tab;
 }
Exemple #29
0
		void SetHighlightedTab (DockNotebookTab tab)
		{
			if (highlightedTab == tab)
				return;

			if (highlightedTab != null) {
				var tmp = highlightedTab;
				tmp.Animate ("Glow",
					f => tmp.GlowStrength = f,
					start: tmp.GlowStrength,
					end: 0);
			}

			if (tab != null) {
				tab.Animate ("Glow",
					f => tab.GlowStrength = f,
					start: tab.GlowStrength,
					end: 1);
			}

			highlightedTab = tab;
			QueueDraw ();
		}
Exemple #30
0
 static bool IsOverCloseButton(DockNotebookTab tab, int x, int y)
 {
     return(tab != null && tab.CloseButtonAllocation.Contains(x, y));
 }
Exemple #31
0
		static bool IsOverCloseButton (DockNotebookTab tab, int x, int y)
		{
			return tab != null && tab.CloseButtonAllocation.Contains (x, y);
		}
Exemple #32
0
        void DrawTab(Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Rectangle tabBounds, bool highlight, bool active, bool dragging, Pango.Layout la)
        {
            // This logic is stupid to have here, should be in the caller!
            if (dragging)
            {
                tabBounds.X = (int)(tabBounds.X + (dragX - tabBounds.X) * dragXProgress);
                tabBounds.X = Clamp(tabBounds.X, tabStartX, tabEndX - tabBounds.Width);
            }
            int padding = LeftRightPadding;

            padding = (int)(padding * Math.Min(1.0, Math.Max(0.5, (tabBounds.Width - 30) / 70.0)));

            ctx.LineWidth = 1;
            LayoutTabBorder(ctx, allocation, tabBounds.Width, tabBounds.X, 0, active);
            ctx.ClosePath();
            using (var gr = new LinearGradient(tabBounds.X, TopBarPadding, tabBounds.X, allocation.Bottom)) {
                if (active)
                {
                    gr.AddColorStop(0, Styles.BreadcrumbGradientStartColor.MultiplyAlpha(tab.Opacity));
                    gr.AddColorStop(1, Styles.BreadcrumbBackgroundColor.MultiplyAlpha(tab.Opacity));
                }
                else
                {
                    gr.AddColorStop(0, CairoExtensions.ParseColor("f4f4f4").MultiplyAlpha(tab.Opacity));
                    gr.AddColorStop(1, CairoExtensions.ParseColor("cecece").MultiplyAlpha(tab.Opacity));
                }
                ctx.SetSource(gr);
            }
            ctx.Fill();

            ctx.SetSourceColor(new Cairo.Color(1, 1, 1, .5).MultiplyAlpha(tab.Opacity));
            LayoutTabBorder(ctx, allocation, tabBounds.Width, tabBounds.X, 1, active);
            ctx.Stroke();

            ctx.SetSourceColor(Styles.BreadcrumbBorderColor.MultiplyAlpha(tab.Opacity));
            LayoutTabBorder(ctx, allocation, tabBounds.Width, tabBounds.X, 0, active);
            ctx.StrokePreserve();

            if (tab.GlowStrength > 0)
            {
                Gdk.Point mouse = tracker.MousePosition;
                using (var rg = new RadialGradient(mouse.X, tabBounds.Bottom, 0, mouse.X, tabBounds.Bottom, 100)) {
                    rg.AddColorStop(0, new Cairo.Color(1, 1, 1, 0.4 * tab.Opacity * tab.GlowStrength));
                    rg.AddColorStop(1, new Cairo.Color(1, 1, 1, 0));

                    ctx.SetSource(rg);
                    ctx.Fill();
                }
            }
            else
            {
                ctx.NewPath();
            }

            // Render Close Button (do this first so we can tell how much text to render)

            var ch    = allocation.Height - TopBarPadding - BottomBarPadding + CloseImageTopOffset;
            var crect = new Gdk.Rectangle(tabBounds.Right - padding - CloseButtonSize + 3,
                                          tabBounds.Y + TopBarPadding + (ch - CloseButtonSize) / 2,
                                          CloseButtonSize, CloseButtonSize);

            tab.CloseButtonAllocation = crect;
            tab.CloseButtonAllocation.Inflate(2, 2);

            bool closeButtonHovered = tracker.Hovered && tab.CloseButtonAllocation.Contains(tracker.MousePosition) && tab.WidthModifier >= 1.0f;
            bool drawCloseButton    = tabBounds.Width > 60 || highlight || closeButtonHovered;

            if (drawCloseButton)
            {
                DrawCloseButton(ctx, new Gdk.Point(crect.X + crect.Width / 2, crect.Y + crect.Height / 2), closeButtonHovered, tab.Opacity, tab.DirtyStrength);
            }

            // Render Text
            int w = tabBounds.Width - (padding * 2 + CloseButtonSize);

            if (!drawCloseButton)
            {
                w += CloseButtonSize;
            }

            int textStart = tabBounds.X + padding;

            ctx.MoveTo(textStart, tabBounds.Y + TopPadding + TextOffset + VerticalTextSize);
            if (!Platform.IsMac && !Platform.IsWindows)
            {
                // This is a work around for a linux specific problem.
                // A bug in the proprietary ATI driver caused TAB text not to draw.
                // If that bug get's fixed remove this HACK asap.
                la.Ellipsize = Pango.EllipsizeMode.End;
                la.Width     = (int)(w * Pango.Scale.PangoScale);
                ctx.SetSourceColor(tab.Notify ? new Cairo.Color(0, 0, 1) : Styles.TabBarActiveTextColor);
                Pango.CairoHelper.ShowLayoutLine(ctx, la.GetLine(0));
            }
            else
            {
                // ellipses are for space wasting ..., we cant afford that
                using (var lg = new LinearGradient(textStart + w - 5, 0, textStart + w + 3, 0)) {
                    var color = tab.Notify ? new Cairo.Color(0, 0, 1) : Styles.TabBarActiveTextColor;
                    color = color.MultiplyAlpha(tab.Opacity);
                    lg.AddColorStop(0, color);
                    color.A = 0;
                    lg.AddColorStop(1, color);
                    ctx.SetSource(lg);
                    Pango.CairoHelper.ShowLayoutLine(ctx, la.GetLine(0));
                }
            }
            la.Dispose();
        }
Exemple #33
0
		internal void OnActivateTab (DockNotebookTab tab)
		{
			if (TabActivated != null)
				TabActivated (this, new TabEventArgs () { Tab = tab });
		}
Exemple #34
0
        public void CloseTab (DockNotebookTab tab)
        {
            var notebook = tab.Notebook;
            var index = notebook.Tabs.IndexOf (tab);

            notebook.RemoveTab (index, true);
        }
Exemple #35
0
		static void PlaceInFloatingFrame (DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy)
		{
			var newWindow = new DockWindow ();
			var newNotebook = newWindow.Container.GetFirstNotebook ();
			var newTab = newNotebook.AddTab ();

			var workspaceWindow = (SdiWorkspaceWindow)tab.Content;
			newTab.Content = workspaceWindow;
			// JONTODO
            //newWindow.Title = DefaultWorkbench.GetTitle (workspaceWindow);

			workspaceWindow.SetDockNotebook (newNotebook, newTab);
			newWindow.Move (ox - w / 2, oy - h / 2);
			newWindow.Resize (w, h);
			newWindow.ShowAll ();
			DockNotebook.ActiveNotebook = newNotebook;
		}