コード例 #1
0
 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;
     }
 }
コード例 #2
0
 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;
 }
コード例 #3
0
        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_width = GetValueWidth ();
                        if (width > column_width) {
                            var column = view.GetColumn (1);
                            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 ();
            }
        }
コード例 #4
0
ファイル: StatusArea.cs プロジェクト: Kalnor/monodevelop
        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;
            }
        }
コード例 #5
0
 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;
             }
         }
     }
 }
コード例 #6
0
        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 ();
            }
        }