コード例 #1
0
ファイル: XwtBoxTooltip.cs プロジェクト: noah1510/dotdevelop
        public XwtBoxTooltip(Widget child)
        {
            if (child == null)
            {
                throw new ArgumentNullException(nameof(child));
            }

            Content = child;
            // FIXME: WPF blocks the main Gtk loop and makes TooltipPopoverWindow unusable.
            //        We use the Xwt.Popover as a workaround for now.
            if (Surface.ToolkitEngine.Type == ToolkitType.Wpf)
            {
                xwtPopover = new Popover();
                xwtPopover.BackgroundColor = Styles.PopoverWindow.DefaultBackgroundColor;
                xwtPopover.Content         = new Label {
                    Wrap = WrapMode.Word
                };
                xwtPopover.Padding = 3;
            }
            else
            {
                tooltipWindow           = TooltipPopoverWindow.Create();
                tooltipWindow.ShowArrow = true;
            }
            Position = PopupPosition.Top;
            Severity = TaskSeverity.Information;
        }
コード例 #2
0
 void DestroyPopover()
 {
     if (popover != null)
     {
         popover.Destroy();
         popover = null;
     }
 }
コード例 #3
0
 void HideTooltip()
 {
     if (tooltipWindow != null)
     {
         tooltipWindow.Destroy();
         tooltipWindow = null;
     }
 }
コード例 #4
0
 protected override void OnMouseExited(EventArgs args)
 {
     base.OnMouseExited(args);
     if (popover != null)
     {
         popover.Destroy();
         popover = null;
     }
 }
コード例 #5
0
        public static TooltipPopoverWindow Create(bool tryNative = true)
        {
            TooltipPopoverWindow popover = null;

            (tryNative ? preferredEngine : Toolkit.CurrentEngine).Invoke(() => {
                popover = new TooltipPopoverWindow();
            });
            return(popover);
        }
コード例 #6
0
 void ShowPopover()
 {
     if (popover != null)
     {
         popover.Destroy();
     }
     popover           = TooltipPopoverWindow.Create();
     popover.ShowArrow = true;
     popover.Text      = message;
     popover.Severity  = severity;
     popover.ShowPopup(this, popupPosition);
 }
コード例 #7
0
 void ShowPopover()
 {
     if (popover != null)
     {
         popover.Destroy();
     }
     popover           = TooltipPopoverWindow.Create(!WorkaroundNestedDialogFlickering());
     popover.ShowArrow = true;
     popover.Text      = message;
     popover.Severity  = severity;
     popover.ShowPopup(this, popupPosition);
 }
コード例 #8
0
 void ShowPopover()
 {
     if (popover != null)
     {
         popover.Destroy();
     }
     popover = new TooltipPopoverWindow {
         ShowArrow = true,
         Text      = message,
         Severity  = severity
     };
     popover.ShowPopup((Gtk.Widget) this.Surface.NativeWidget, popupPosition);
 }
コード例 #9
0
		bool ShowTooltip ()
		{
			if (!string.IsNullOrEmpty (tip)) {
				HideTooltip ();
				tooltipWindow = new TooltipPopoverWindow ();
				tooltipWindow.ShowArrow = true;
				tooltipWindow.Text = tip;
				tooltipWindow.Severity = Severity;
				var rect = new Gdk.Rectangle (0, 0, eventBox.Allocation.Width, eventBox.Allocation.Height + 5);
				tooltipWindow.ShowPopup (eventBox, rect, Position);
			}
			return false;
		}
コード例 #10
0
 bool ShowTooltip()
 {
     if (!string.IsNullOrEmpty(tip))
     {
         HideTooltip();
         tooltipWindow           = TooltipPopoverWindow.Create();
         tooltipWindow.ShowArrow = true;
         tooltipWindow.Text      = tip;
         tooltipWindow.Severity  = Severity;
         var rect = new Gdk.Rectangle(0, 0, eventBox.Allocation.Width, eventBox.Allocation.Height + 5);
         tooltipWindow.ShowPopup(eventBox, rect, Position);
     }
     return(false);
 }
コード例 #11
0
ファイル: XwtBoxTooltip.cs プロジェクト: noah1510/dotdevelop
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         HideTooltip();
         hideTooltipTimer?.Dispose();
         tooltipWindow?.Dispose();
         xwtPopover?.Dispose();
     }
     hideTooltipTimer = null;
     tooltipWindow    = null;
     xwtPopover       = null;
     base.Dispose(disposing);
 }
コード例 #12
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         hideTooltipTimer?.Dispose();
         if (popover?.Visible == true)
         {
             popover.Hide();
         }
         popover?.Dispose();
     }
     hideTooltipTimer = null;
     popover          = null;
     base.Dispose(disposing);
 }
コード例 #13
0
 void ShowPopover()
 {
     if (hideTooltipTimer?.Enabled == true)
     {
         hideTooltipTimer.Stop();
     }
     if (popover == null)
     {
         popover = TooltipPopoverWindow.Create(!WorkaroundNestedDialogFlickering());
     }
     popover.ShowArrow = true;
     if (markup)
     {
         popover.Markup = message;
     }
     else
     {
         popover.Text = message;
     }
     popover.Severity = severity;
     popover.ShowPopup(this, popupPosition);
 }
コード例 #14
0
			void HandleKeyTreeMotion (double mouseX, double mouseY)
			{
				if (keyBindingsPanel.duplicates?.Count <= 0)
					return;

				var hit = HitTest (mouseX, mouseY);
				if (hit.ButtonBounds.IsEmpty) {
					HideConflictTooltip ();
					return;
				}

				if (hit.AllKeys.Count == 0)
					return;

				HashSet<Command> keyDuplicates = null;
				if (keyBindingsPanel.duplicates.TryGetValue (hit.AllKeys [hit.SelectedKey], out keyDuplicates)) {

					var cmdDuplicates = keyDuplicates.Where (cmd => cmd != hit.Command);
					if (tooltipWindow == null) {
						tooltipWindow = new TooltipPopoverWindow ();
						tooltipWindow.ShowArrow = true;
						tooltipWindow.LeaveNotifyEvent += delegate { HideConflictTooltip (); };
					}

					var text = string.Empty;
					HashSet<Command> cmdConflicts = null;
					bool hasConflict = false;
					if (keyBindingsPanel.conflicts != null && keyBindingsPanel.conflicts.TryGetValue (hit.AllKeys [hit.SelectedKey], out cmdConflicts))
						hasConflict = cmdConflicts.Contains (hit.Command);

					if (hasConflict) {
						var acmdConflicts = cmdConflicts.Where (cmd => cmd != hit.Command).ToArray ();
						text += GettextCatalog.GetPluralString (
							"This shortcut is assigned to another command that is available\nin the same context. Please set a different shortcut.",
							"This shortcut is assigned to other commands that are available\nin the same context. Please set a different shortcut.",
							acmdConflicts.Length) + "\n\n";
						text += GettextCatalog.GetString ("Conflicts:");
						foreach (var conflict in acmdConflicts)
							text += "\n\u2022 " + conflict.Category + " \u2013 " + conflict.DisplayName;
						cmdDuplicates = cmdDuplicates.Except (acmdConflicts);
					}
					if (cmdDuplicates.Count () > 0) {
						if (hasConflict)
							text += "\n\n";
						text += GettextCatalog.GetString ("Duplicates:");

						foreach (var cmd in cmdDuplicates)
							text += "\n\u2022 " + cmd.Category + " \u2013 " + cmd.DisplayName;
					}

					tooltipWindow.Text = text;
					tooltipWindow.Severity = hasConflict ? Tasks.TaskSeverity.Error : Tasks.TaskSeverity.Warning;

					tooltipWindow.ShowPopup (keyBindingsTree, hit.ButtonBounds, PopupPosition.Top);
				} else
					HideConflictTooltip ();
			}
コード例 #15
0
			void HideConflictTooltip ()
			{
				if (tooltipWindow != null) {
					tooltipWindow.Destroy ();
					tooltipWindow = null;
				}
			}
コード例 #16
0
ファイル: XwtBoxTooltip.cs プロジェクト: kdubau/monodevelop
		public XwtBoxTooltip (Widget child)
		{
			if (child == null)
				throw new ArgumentNullException (nameof (child));
			
			Content = child;
			// FIXME: WPF blocks the main Gtk loop and makes TooltipPopoverWindow unusable.
			//        We use the Xwt.Popover as a workaround for now.
			if (Surface.ToolkitEngine.Type == ToolkitType.Wpf) {
				xwtPopover = new Popover ();
				xwtPopover.BackgroundColor = Styles.PopoverWindow.DefaultBackgroundColor;
				xwtPopover.Content = new Label { Wrap = WrapMode.Word };
				xwtPopover.Padding = 3;
			} else {
				tooltipWindow = new TooltipPopoverWindow ();
				tooltipWindow.ShowArrow = true;
			}
			Position = PopupPosition.Top;
			Severity = TaskSeverity.Information;
		}
コード例 #17
0
		protected override void OnMouseExited (EventArgs args)
		{
			base.OnMouseExited (args);
			if (popover != null) {
				popover.Destroy ();
				popover = null;
			}
		}
コード例 #18
0
		void ShowPopover ()
		{
			if (popover != null)
				popover.Destroy ();
			popover = new TooltipPopoverWindow {
				ShowArrow = true,
				Text = message,
				Severity = severity
			};
			popover.ShowPopup ((Gtk.Widget)this.Surface.NativeWidget, popupPosition);
		}
コード例 #19
0
ファイル: StatusArea.cs プロジェクト: Kalnor/monodevelop
            bool ShowTooltipEvent()
            {
                tipShowTimeoutId = 0;

                if (!mouseOver)
                    return false;

                int remainingMs = (int) (scheduledTipTime - DateTime.Now).TotalMilliseconds;
                if (remainingMs > 50) {
                    // Still some significant time left. Re-schedule the timer
                    tipShowTimeoutId = GLib.Timeout.Add ((uint) remainingMs, ShowTooltipEvent);
                    return false;
                }

                if (!string.IsNullOrEmpty (tip)) {
                    HideTooltip ();
                    tooltipWindow = new TooltipPopoverWindow ();
                    tooltipWindow.ShowArrow = true;
                    tooltipWindow.Text = tip;
                    tooltipWindow.ShowPopup (box, PopupPosition.Top);
                }
                return false;
            }
コード例 #20
0
			void ShowTooltip ()
			{
				if (!string.IsNullOrEmpty (tip)) {
					HideTooltip ();
					tooltipWindow = new TooltipPopoverWindow ();
					tooltipWindow.ShowArrow = true;
					tooltipWindow.Text = tip;
					tooltipWindow.ShowPopup (box, PopupPosition.Top);
				}
			}