Beispiel #1
0
 private static bool ShowMe()
 {
     if (!Instance.Visible && is_interval_started)
     {
         Gtk.Widget  w    = CurrentWidget;
         ToolTipData data = widgets[w];
         int         x    = 0;
         int         y    = 0;
         //first take window position
         w.ParentWindow.GetPosition(out x, out y);
         //adauga locatia mausului in ea
         int _x = 0;
         int _y = 0;
         Gdk.ModifierType mt;
         //add pointer location
         w.ParentWindow.GetPointer(out _x, out _y, out mt);
         x += _x;
         y += _y + 20;
         //TODO: replace value with tail_left
         x -= Instance.TailLeft;
         Instance.Move(x, y);
         Instance.ToolTipTitle = data.Title;
         Instance.ToolTipText  = data.Text;
         Instance.Color1       = data.Color1;
         Instance.Color2       = data.Color2;
         Instance.StockIcon    = data.StockIcon;
         Instance.Resize(150, 100);
         Instance.Show();
     }
     return(false);
 }
Beispiel #2
0
        private static void AddWidget(Gtk.Widget widget, ToolTipData data)
        {
            if (!widgets.ContainsKey(widget))
            {
                widgets.Add(widget, data);
                widget.DeleteEvent += on_widget_delete;
                widget.AddEvents((int)Gdk.EventMask.ProximityInMask);
                widget.AddEvents((int)Gdk.EventMask.PointerMotionMask);
                widget.AddEvents((int)Gdk.EventMask.PointerMotionHintMask);
                widget.AddEvents((int)Gdk.EventMask.LeaveNotifyMask);
                widget.AddEvents((int)Gdk.EventMask.AllEventsMask);
                widget.AddEvents((int)Gdk.EventMask.EnterNotifyMask);
                widget.AddEvents((int)Gdk.EventMask.FocusChangeMask);

                widget.WidgetEvent += delegate(object sender, Gtk.WidgetEventArgs args)
                {
                    if (args.Event.Type == Gdk.EventType.LeaveNotify)
                    {
                        is_interval_started = false;
                        Instance.Close();
                    }
                    if (args.Event.Type == Gdk.EventType.EnterNotify)
                    {
                        CurrentWidget       = (Gtk.Widget)sender;
                        is_interval_started = true;
                        GLib.Timeout.Add((uint)ToolTipInterval, new GLib.TimeoutHandler(ShowMe));
                    }
                };
            }
            else
            {
                widgets[widget] = data;
            }
        }
        private static void AddWidget( Gtk.Widget widget, ToolTipData data )
        {
            if( !widgets.ContainsKey( widget ) )
            {
                widgets.Add( widget, data );
                widget.DeleteEvent  += on_widget_delete;
                widget.AddEvents( (int)Gdk.EventMask.ProximityInMask   );
                widget.AddEvents( (int)Gdk.EventMask.PointerMotionMask );
                widget.AddEvents( (int)Gdk.EventMask.PointerMotionHintMask );
                widget.AddEvents( (int)Gdk.EventMask.LeaveNotifyMask  );
                widget.AddEvents( (int)Gdk.EventMask.AllEventsMask    );
                widget.AddEvents( (int)Gdk.EventMask.EnterNotifyMask  );
                widget.AddEvents( (int)Gdk.EventMask.FocusChangeMask  );

                widget.WidgetEvent += delegate(object sender, Gtk.WidgetEventArgs args)
                {
                    if( args.Event.Type == Gdk.EventType.LeaveNotify )
                    {
                        is_interval_started = false;
                        Instance.Close();
                    }
                    if( args.Event.Type == Gdk.EventType.EnterNotify )
                    {
                        CurrentWidget       = (Gtk.Widget)sender;
                        is_interval_started = true;
                        GLib.Timeout.Add( (uint)ToolTipInterval, new GLib.TimeoutHandler( ShowMe ) );
                    }
                };
            }
            else
            {
                widgets[widget] = data;
            }
        }
 public static void SetToolTip( Gtk.Widget widget, String title, String text, Color color1, Color color2, String StockIcon )
 {
     ToolTipData data = new ToolTipData( title, text, color1, color2, StockIcon );
     AddWidget( widget, data );
 }
 public static void SetToolTip( Gtk.Widget widget, String title, String text )
 {
     ToolTipData data = new ToolTipData( title, text );
     AddWidget( widget, data );
 }
Beispiel #6
0
        public static void SetToolTip(Gtk.Widget widget, String title, String text, Color color1, Color color2, String StockIcon)
        {
            ToolTipData data = new ToolTipData(title, text, color1, color2, StockIcon);

            AddWidget(widget, data);
        }
Beispiel #7
0
        public static void SetToolTip(Gtk.Widget widget, String title, String text)
        {
            ToolTipData data = new ToolTipData(title, text);

            AddWidget(widget, data);
        }