[egg-list-box] add API to (un)highlight a widget during DnD



commit 15eab5980cafb3b1a538333ba82c0f4dbd1b11d2
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Jun 22 10:10:09 2012 +0200

    add API to (un)highlight a widget during DnD
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678603

 egg-list-box.vala |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/egg-list-box.vala b/egg-list-box.vala
index 370e6d2..380602c 100644
--- a/egg-list-box.vala
+++ b/egg-list-box.vala
@@ -48,6 +48,7 @@ public class Egg.ListBox : Container {
   private SelectionMode selection_mode;
   private Adjustment? adjustment;
   private bool activate_single_click;
+  private Widget drag_highlighted_widget;
 
   construct {
     set_can_focus (true);
@@ -1020,4 +1021,28 @@ public class Egg.ListBox : Container {
       child_allocation.y += child_min + focus_width + focus_pad;
     }
   }
+
+  /* DnD */
+
+  public void drag_unhighlight_widget () {
+    if (drag_highlighted_widget == null)
+      return;
+
+    Gtk.drag_unhighlight (drag_highlighted_widget);
+    drag_highlighted_widget = null;
+  }
+
+  public void drag_highlight_widget (Widget widget) {
+    if (drag_highlighted_widget == widget)
+      return;
+
+    drag_unhighlight_widget ();
+
+    Gtk.drag_highlight (widget);
+    drag_highlighted_widget = widget;
+  }
+
+  public override void drag_leave (Gdk.DragContext context, uint time_) {
+    drag_unhighlight_widget ();
+  }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]