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; }
void DestroyPopover() { if (popover != null) { popover.Destroy(); popover = null; } }
void HideTooltip() { if (tooltipWindow != null) { tooltipWindow.Destroy(); tooltipWindow = null; } }
protected override void OnMouseExited(EventArgs args) { base.OnMouseExited(args); if (popover != null) { popover.Destroy(); popover = null; } }
public static TooltipPopoverWindow Create(bool tryNative = true) { TooltipPopoverWindow popover = null; (tryNative ? preferredEngine : Toolkit.CurrentEngine).Invoke(() => { popover = new TooltipPopoverWindow(); }); return(popover); }
void ShowPopover() { if (popover != null) { popover.Destroy(); } popover = TooltipPopoverWindow.Create(); popover.ShowArrow = true; popover.Text = message; popover.Severity = severity; popover.ShowPopup(this, popupPosition); }
void ShowPopover() { if (popover != null) { popover.Destroy(); } popover = TooltipPopoverWindow.Create(!WorkaroundNestedDialogFlickering()); popover.ShowArrow = true; popover.Text = message; popover.Severity = severity; popover.ShowPopup(this, popupPosition); }
void ShowPopover() { if (popover != null) { popover.Destroy(); } popover = new TooltipPopoverWindow { ShowArrow = true, Text = message, Severity = severity }; popover.ShowPopup((Gtk.Widget) this.Surface.NativeWidget, popupPosition); }
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; }
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); }
protected override void Dispose(bool disposing) { if (disposing) { HideTooltip(); hideTooltipTimer?.Dispose(); tooltipWindow?.Dispose(); xwtPopover?.Dispose(); } hideTooltipTimer = null; tooltipWindow = null; xwtPopover = null; base.Dispose(disposing); }
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); }
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); }
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 (); }
void HideConflictTooltip () { if (tooltipWindow != null) { tooltipWindow.Destroy (); tooltipWindow = null; } }
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; }
protected override void OnMouseExited (EventArgs args) { base.OnMouseExited (args); if (popover != null) { popover.Destroy (); popover = null; } }
void ShowPopover () { if (popover != null) popover.Destroy (); popover = new TooltipPopoverWindow { ShowArrow = true, Text = message, Severity = severity }; popover.ShowPopup ((Gtk.Widget)this.Surface.NativeWidget, popupPosition); }
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; }
void ShowTooltip () { if (!string.IsNullOrEmpty (tip)) { HideTooltip (); tooltipWindow = new TooltipPopoverWindow (); tooltipWindow.ShowArrow = true; tooltipWindow.Text = tip; tooltipWindow.ShowPopup (box, PopupPosition.Top); } }