/// <summary> /// Changes the tooltip message based on the cell the mouse is over. /// </summary> private void OnShowTooltip(object o, QueryTooltipArgs args) { TreePath path; TreeIter iter; if (m_treeView.GetPathAtPos(args.X, args.Y, out path) && m_listStore.GetIter(out iter, path)) { int colNum = 0; int baseX = 0; foreach (TreeViewColumn col in m_treeView.Columns) { if (baseX <= args.X && args.X <= baseX + col.Width) { break; } baseX += col.Width; colNum++; } // visibility column if (colNum == 0) { bool visible = m_indexToMesh[path.Indices[0] - 1].IsVisible; args.Tooltip.Text = visible ? "Hide mesh in scene." : "Show mesh in scene."; args.RetVal = true; } } if (args.Tooltip != null) { args.Tooltip.Dispose(); } }
void messageBoxToolTip(object o, QueryTooltipArgs e) { if (theme.IsEllipsized && (e.X < messageBox.Allocation.Width)) { var label = new Label(); if (renderArg.CurrentTextIsMarkup) { label.Markup = renderArg.CurrentText; } else { label.Text = renderArg.CurrentText; } label.Wrap = true; label.WidthRequest = messageBox.Allocation.Width; e.Tooltip.Custom = label; e.RetVal = true; } else { e.RetVal = false; } }
private void OnQueryTooltip(object o, QueryTooltipArgs args) { int?objectNr = GetObjectNrByPosition(new Vector( (float)args.X, (float)args.Y)); if (objectNr.HasValue) { int selected = (int)objectNr; if (selected != LastObjectHovered) { //HACK: disable tooltip if hovered object changed LastObjectHovered = selected; return; } args.Tooltip.Text = ""; if (selected < gameObjectTypes.Count) { Type type = gameObjectTypes[selected]; if (type != null) { args.Tooltip.Text = type.Name; args.RetVal = true; } } } }
private void SetupOnHoverImage(QueryTooltipArgs args, Photo photo) { var customTooltip = new PreviewPhotoWidget(photo); args.Tooltip.Custom = customTooltip; args.RetVal = true; }
void YtreeRoutes_QueryTooltip(object o, QueryTooltipArgs args) { ytreeRoutes.ConvertWidgetToBinWindowCoords(args.X, args.Y, out int binX, out int binY); if (ytreeRoutes.GetPathAtPos(binX, binY, out TreePath path, out TreeViewColumn col) && ytreeRoutes.Model.GetIter(out TreeIter iter, path)) { var loadtimeCol = ytreeRoutes.ColumnsConfig.GetColumnsByTag(RouteColumnTag.OnloadTime).Where(x => x == col).ToArray(); if (loadtimeCol.Any() && ytreeRoutes.YTreeModel.NodeFromIter(iter) is RouteList node) { args.RetVal = true; args.Tooltip.Text = ViewModel.GenerateToolTip(node); } } }
private void HandleQueryTooltip(object o, QueryTooltipArgs args) { var source = Source; if (source != null && Child.Allocation.Width < Child.Requisition.Width) { args.Tooltip.Text = source.Name; args.RetVal = true; } // Work around ref counting SIGSEGV, see http://bugzilla.gnome.org/show_bug.cgi?id=478519#c9 if (args.Tooltip != null) { args.Tooltip.Dispose(); } }
void OnQueryTooltip(object o, QueryTooltipArgs args) { int binX; int binY; failuresView.ConvertWidgetToBinWindowCoords(args.X, args.Y, out binX, out binY); TreePath path; TreeIter iter; if (failuresView.GetPathAtPos(binX, binY, out path) && failuresStore.GetIter(out iter, path)) { string message = (string)failuresStore.GetValue(iter, 1); args.Tooltip.Text = message; args.RetVal = true; } }
private void OnTreeViewQueryTooltip(object o, QueryTooltipArgs args) { int x; int y; d_treeview.ConvertWidgetToBinWindowCoords(args.X, args.Y, out x, out y); TreePath path; TreeViewColumn column; args.RetVal = false; if (y < 0) { y = 0; } if (d_treeview.GetPathAtPos(x, y, out path, out column)) { int idx = Array.IndexOf(d_treeview.Columns, column); switch (idx) { case 0: args.Tooltip.Text = "Name of the argument"; args.RetVal = true; break; case 1: args.Tooltip.Text = "The default value of the argument (if defined the argument is optional)"; args.RetVal = true; break; case 2: args.Tooltip.Text = "Explicit arguments are function parameters, implicit arguments are looked up in the executing context (i.e. caller properties)"; args.RetVal = true; break; default: break; } } }
private void SetupOnHoverImage(QueryTooltipArgs args, IGridWidgetItem photo) { if (photo == null) { return; } if (photo.GetType() == typeof(Photo)) { var previewPhotoTooltip = new PreviewPhotoWidget((Photo)photo); args.Tooltip.Custom = previewPhotoTooltip; } else { var albumName = ((Photoset)photo).HtmlEncodedTitle; var albumNameToolTip = new Label(albumName); albumNameToolTip.UseMarkup = true; args.Tooltip.Custom = albumNameToolTip; } args.RetVal = true; }
private void HandleQueryTooltip(object o, QueryTooltipArgs args) { TreePath path; TreeIter iter; if (view.GetPathAtPos(args.X, args.Y, out path) && view.Model.GetIter(out iter, path)) { string text = (string)view.Model.GetValue(iter, 1); if (!String.IsNullOrEmpty(text)) { using (var layout = new Pango.Layout(view.PangoContext)) { layout.FontDescription = value_renderer.FontDesc; layout.SetText(text); layout.Attributes = new Pango.AttrList(); layout.Attributes.Insert(new Pango.AttrScale(value_renderer.Scale)); int width, height; layout.GetPixelSize(out width, out height); var column = view.GetColumn(1); var column_width = column.Width - 2 * value_renderer.Xpad - (int)view.StyleGetProperty("horizontal-separator") - 2 * (int)view.StyleGetProperty("focus-line-width"); if (width > column_width) { args.Tooltip.Text = text; view.SetTooltipCell(args.Tooltip, path, column, value_renderer); args.RetVal = true; } } } } // Work around ref counting SIGSEGV, see http://bugzilla.gnome.org/show_bug.cgi?id=478519#c9 if (args.Tooltip != null) { args.Tooltip.Dispose(); } }
private void CircuitEditor_QueryTooltip(object o, QueryTooltipArgs args) { var mouse = ToWorld(new Vector2d(args.X, args.Y)); // FIXME: Better tooltips. This is a placeholder. /* FIXME!! * foreach (var andGate in Gates.AndGates) * { * var pos = andGate.GetTopLeft() * DotSpacing; * var size = new Vector2d(3 * DotSpacing, 3 * DotSpacing); * * var bounds = new Rect(pos, size); * if (bounds.Contains(mouse)) * { * args.Tooltip.Text = "And Gate"; * args.Tooltip.TipArea = ToScreen(bounds); * args.RetVal = true; * return; * } * }*/ args.RetVal = false; }