Inheritance: MonoDevelop.Components.PopoverWindow
		protected override Window CreateTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return null;

			var titem = item.Item as TTI;

			if (titem == null)
				return null;

			var result = new TooltipInformationWindow ();
			result.ShowArrow = true;

			foreach(var i in AmbiguousType.TryDissolve(titem.t))
			{
				if (i == null)
					continue;
				var tooltipInformation = TooltipInfoGen.Create(i, editor.ColorStyle);
				if (tooltipInformation != null && !string.IsNullOrEmpty(tooltipInformation.SignatureMarkup))
					result.AddOverload(tooltipInformation);
			}

			if (result.Overloads < 1) {
				result.Dispose ();
				return null;
			}

			result.RepositionWindow ();
			return result;
		}
Exemple #2
0
        protected override void OnDestroyed()
        {
            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }

            if (mutableList != null)
            {
                mutableList.Changing -= OnCompletionDataChanging;
                mutableList.Changed  -= OnCompletionDataChanged;
                mutableList           = null;
            }

            if (completionDataList != null)
            {
                if (completionDataList is IDisposable)
                {
                    ((IDisposable)completionDataList).Dispose();
                }
                CloseCompletionList();
                completionDataList = null;
            }

            HideDeclarationView();

            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }
            ReleaseObjects();
            base.OnDestroyed();
        }
		//TooltipItem lastResult;
		#endregion

		#region Lowlevel
		static void DestroyLastTooltipWindow ()
		{
			if (lastWindow != null) {
				lastWindow.Destroy ();
				lastWindow = null;
			}
		}
 void EnsureDeclarationViewWindow()
 {
     if (declarationviewwindow == null)
     {
         declarationviewwindow = new TooltipInformationWindow();
     }
     else
     {
         declarationviewwindow.SetDefaultScheme();
     }
 }
 void EnsureDeclarationViewWindow()
 {
     if (declarationviewwindow == null)
     {
         declarationviewwindow = new TooltipInformationWindow();
     }
     else
     {
         declarationviewwindow.SetDefaultScheme();
     }
     declarationviewwindow.Theme.SetBackgroundColor(Gui.Styles.CodeCompletion.BackgroundColor);
 }
        void EnsureDeclarationViewWindow()
        {
            if (declarationviewwindow == null)
            {
                declarationviewwindow = new TooltipInformationWindow();
            }
            else
            {
                declarationviewwindow.SetDefaultScheme();
            }
            var style = Editor.Highlighting.SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme);

            declarationviewwindow.Theme.SetFlatColor(style.CompletionTooltipWindow.Color);
            if (style.CompletionWindow.HasBorderColor)
            {
                declarationviewwindow.Theme.BorderColor = style.CompletionTooltipWindow.BorderColor;
            }
        }
Exemple #7
0
        void ShowTooltipInfo()
        {
            ClearDescriptions();
            headlabel.Markup  = currentTooltipInformation.SignatureMarkup;
            headlabel.Visible = true;
            if (Theme.DrawPager)
            {
                headlabel.WidthRequest = headlabel.RealWidth + 70;
            }

            foreach (var cat in currentTooltipInformation.Categories)
            {
                descriptionBox.PackStart(CreateCategory(TooltipInformationWindow.GetHeaderMarkup(cat.Item1), cat.Item2), true, true, 4);
            }

            if (!string.IsNullOrEmpty(currentTooltipInformation.SummaryMarkup))
            {
                descriptionBox.PackStart(CreateCategory(TooltipInformationWindow.GetHeaderMarkup(GettextCatalog.GetString("Summary")), currentTooltipInformation.SummaryMarkup), true, true, 4);
            }
            descriptionBox.ShowAll();
            Content.QueueForReallocate();
            Show();
        }
Exemple #8
0
 VBox CreateCategory(string categoryName, string categoryContentMarkup)
 {
     return(TooltipInformationWindow.CreateCategory(categoryName, categoryContentMarkup, foreColor, Theme.Font.ToPangoFont()));
 }
 VBox CreateCategory(string categoryName, string categoryContentMarkup)
 {
     return(TooltipInformationWindow.CreateCategory(categoryName, categoryContentMarkup, foreColor));
 }
		public override Gtk.Window ShowTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
		{
			var titem = (ToolTipData)item.Item;
			if (lastNode != null && lastWindow != null && lastWindow.IsRealized && titem.Node != null && lastNode == titem.Node)
				return lastWindow;
			
			DestroyLastTooltipWindow ();

			var tipWindow = CreateTooltipWindow (editor, offset, modifierState, item) as TooltipInformationWindow;
			if (tipWindow == null)
				return null;

			var hoverNode = titem.Node.GetNodeAt (editor.OffsetToLocation (offset)) ?? titem.Node;
			var p1 = editor.LocationToPoint (hoverNode.StartLocation);
			var p2 = editor.LocationToPoint (hoverNode.EndLocation);
			var positionWidget = editor.TextArea;
			var caret = new Gdk.Rectangle ((int)p1.X - positionWidget.Allocation.X, (int)p2.Y - positionWidget.Allocation.Y, (int)(p2.X - p1.X), (int)editor.LineHeight);

			tipWindow.ShowPopup (positionWidget, caret, PopupPosition.Top);
			tipWindow.EnterNotifyEvent += delegate {
				editor.HideTooltip (false);
			};
			lastWindow = tipWindow;
			lastNode = titem.Node;
			return tipWindow;
		}
		protected override Gtk.Window CreateTooltipWindow (Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return null;

			var titem = (ToolTipData)item.Item;

			var tooltipInformation = CreateTooltip (titem, offset, null);
			if (tooltipInformation == null || string.IsNullOrEmpty (tooltipInformation.SignatureMarkup))
				return null;

			var result = new TooltipInformationWindow ();
			result.ShowArrow = true;
			result.AddOverload (tooltipInformation);
			result.RepositionWindow ();
			return result;
		}
		public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
		{
			var doc = ctx;
			if (doc == null)
				return null;

			var titem = (ToolTipData)item.Item;

			var tooltipInformation = CreateTooltip (titem, editor, ctx, offset, modifierState);
			if (tooltipInformation == null || string.IsNullOrEmpty (tooltipInformation.SignatureMarkup))
				return null;
			var result = new TooltipInformationWindow ();
			result.ShowArrow = true;
			result.AddOverload (tooltipInformation);
			result.RepositionWindow ();
			return result;
		}
		void ShowTipInfoWindow (TextEditor editor, TooltipInformationWindow tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
		{
			Gtk.Widget editorWidget = editor;

			var startLoc = editor.OffsetToLocation (item.Offset);
			var endLoc = editor.OffsetToLocation (item.EndOffset);
			var p1 = editor.LocationToPoint (startLoc);
			var p2 = editor.LocationToPoint (endLoc);

			int w = (int)(p2.X - p1.X);

			var caret = new Gdk.Rectangle (
				(int)p1.X,
				(int)p1.Y,
				(int)w,
				(int)editor.LineHeight
			);

			tipWindow.ShowPopup (editorWidget, caret, PopupPosition.Top);
		}
		public override Window ShowTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
		{
			var titem = (item.Item as TTI).sr;
			DestroyLastTooltipWindow ();

			var tipWindow = CreateTooltipWindow (editor, offset, modifierState, item) as TooltipInformationWindow;
			if (tipWindow == null)
				return null;

			var positionWidget = editor.TextArea;

			Cairo.Point p1, p2;

			var dn = titem as INode;
			if (dn != null)
			{
				if (dn.NameLocation.IsEmpty)
					p1 = p2 = editor.LocationToPoint(dn.Location.Line, dn.Location.Column);
				else
				{
					p1 = editor.LocationToPoint(dn.NameLocation.Line, dn.NameLocation.Column);
					p2 = editor.LocationToPoint(dn.NameLocation.Line, dn.NameLocation.Column + (dn.Name ?? "").Length);
				}
			}
			else {
				p1 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.Offset));
				p2 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.EndOffset));
			}

			var caret = new Gdk.Rectangle (p1.X - positionWidget.Allocation.X, p2.Y - positionWidget.Allocation.Y, (p2.X - p1.X), (int)editor.LineHeight);
			tipWindow.ShowPopup (positionWidget, caret, PopupPosition.Top);
			

			lastWindow = tipWindow;

			tipWindow.EnterNotifyEvent += delegate {
				editor.HideTooltip (false);
			};

			//lastNode = titem.Result;
			return tipWindow;
		}
		public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
		{
			var doc = ctx;
			if (doc == null)
				return null;

			var result = new TooltipInformationWindow ();
			result.ShowArrow = true;
			result.AddOverload ((TooltipInformation)item.Item);
			result.RepositionWindow ();
			return result;
		}
Exemple #16
0
        public override Window ShowTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
        {
            var titems = item.Item as AbstractType;/*
            if (lastNode != null && lastWindow != null && lastWindow.IsRealized && titem.Result != null && lastNode == titem.Result)
                return lastWindow;*/

            DestroyLastTooltipWindow ();

            var tipWindow = CreateTooltipWindow (editor, offset, modifierState, item) as TooltipInformationWindow;
            if (tipWindow == null)
                return null;

            var titem = titems.DeclarationOrExpressionBase;
            var positionWidget = editor.TextArea;

            Cairo.Point p1, p2;

            if (titem != null) {
                p1 = editor.LocationToPoint (titem.Location.Line, titem.Location.Column);
                p2 = editor.LocationToPoint (titem.EndLocation.Line, titem.EndLocation.Column);
            } else {
                p1 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.Offset));
                p2 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.EndOffset));
            }

            var caret = new Gdk.Rectangle (p1.X - positionWidget.Allocation.X, p2.Y - positionWidget.Allocation.Y, (p2.X - p1.X), (int)editor.LineHeight);
            tipWindow.ShowPopup (positionWidget, caret, PopupPosition.Top);

            lastWindow = tipWindow;

            tipWindow.EnterNotifyEvent += delegate {
                editor.HideTooltip (false);
            };

            //lastNode = titem.Result;
            return tipWindow;
        }