public void ShowTooltip(string text, int x, int y, int altY) { if (tooltipWindow != null) { tooltipWindow.Hide(); } else { tooltipWindow = new CustomTooltipWindow(); tooltipWindow.TransientFor = this; tooltipWindow.DestroyWithParent = true; } tooltipWindow.Tooltip = text; int ox, oy; this.GdkWindow.GetOrigin(out ox, out oy); int w = tooltipWindow.Child.SizeRequest().Width; int h = tooltipWindow.Child.SizeRequest().Height; Gdk.Rectangle geometry = Screen.GetMonitorGeometry(Screen.GetMonitorAtWindow(this.GdkWindow)); if (ox + x + w + tooltipXOffset >= geometry.Right || oy + y + h >= geometry.Bottom) { tooltipWindow.Move(ox + x - w, oy + altY - h); } else { tooltipWindow.Move(ox + x + tooltipXOffset, oy + y); } tooltipWindow.ShowAll(); }
bool ShowTooltip() { HideTooltipWindow(); tooltipWindow = new CustomTooltipWindow(); tooltipWindow.Tooltip = tipItem.Tooltip; tooltipWindow.ParentWindow = this.GdkWindow; int ox, oy; this.GdkWindow.GetOrigin(out ox, out oy); tooltipWindow.Move(Math.Max(0, ox + tipX), oy + tipY); tooltipWindow.ShowAll(); return(false); }