[pdfmod] Scroll if dragging and near the iconview top/bottom



commit ce26db8fda0ab691a732d9ed5f05af940bfb700b
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Mon Aug 3 16:21:21 2009 -0700

    Scroll if dragging and near the iconview top/bottom

 src/PdfMod/PdfMod/PdfIconView.cs |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/PdfMod/PdfMod/PdfIconView.cs b/src/PdfMod/PdfMod/PdfIconView.cs
index 2e1cd56..5fd3ed0 100644
--- a/src/PdfMod/PdfMod/PdfIconView.cs
+++ b/src/PdfMod/PdfMod/PdfIconView.cs
@@ -178,6 +178,14 @@ namespace PdfMod
 
         protected override bool OnDragMotion (Gdk.DragContext context, int x, int y, uint time_)
         {
+            // Scroll if within 20 pixels of the top or bottom
+            var parent = Parent as Gtk.ScrolledWindow;
+            if (y < 20) {
+                parent.Vadjustment.Value -= 30;
+            } else if ((parent.Allocation.Height - y) < 20) {
+                parent.Vadjustment.Value = Math.Min (parent.Vadjustment.Upper - parent.Allocation.Height, parent.Vadjustment.Value + 30);
+            }
+
             var targets = context.Targets.Select (t => (string)t);
 
             if (targets.Contains (move_internal_target.Target) || targets.Contains (move_external_target.Target)) {



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