[hyena/gtk3] ListView: Try to implement scrolling



commit 2794ee094b286b980592cd45c9d820ec4dd574a0
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Jul 30 15:53:35 2011 +0200

    ListView: Try to implement scrolling
    
    This doesn't work yet because of issues with the Scrollable interface in
    gtk-sharp, but at least it gives us a test case.

 .../ListView/ListView_Interaction.cs               |   50 ++++++++++----------
 Hyena.Gui/Hyena.Widgets/RoundedFrame.cs            |   25 +++++++---
 2 files changed, 42 insertions(+), 33 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index c9493c0..fd4ca92 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -40,7 +40,7 @@ using Selection = Hyena.Collections.Selection;
 
 namespace Hyena.Data.Gui
 {
-    public partial class ListView<T> : ListViewBase, ScrollableImplementor
+    public partial class ListView<T> : ListViewBase, Scrollable
     {
         private enum KeyDirection {
             Press,
@@ -76,11 +76,27 @@ namespace Hyena.Data.Gui
         private Adjustment vadjustment;
         public Adjustment Vadjustment {
             get { return vadjustment; }
+            set {
+                if (value == vadjustment) {
+                    return;
+                }
+                vadjustment = value;
+                vadjustment.ValueChanged += OnVadjustmentChanged;
+                UpdateAdjustments ();
+            }
         }
 
         private Adjustment hadjustment;
         public Adjustment Hadjustment {
             get { return hadjustment; }
+            set {
+                if (value == hadjustment) {
+                    return;
+                }
+                hadjustment = value;
+                hadjustment.ValueChanged += OnHadjustmentChanged;
+                UpdateAdjustments ();
+            }
         }
 
         private SelectionProxy selection_proxy = new SelectionProxy ();
@@ -968,21 +984,17 @@ namespace Hyena.Data.Gui
 
 #region Adjustments & Scrolling
 
-        private void UpdateAdjustments ()
-        {
-            UpdateAdjustments (null, null);
+        public Gtk.ScrollablePolicy HscrollPolicy {
+            get; set;
         }
 
-        private void UpdateAdjustments (Adjustment hadj, Adjustment vadj)
-        {
-            if (hadj != null) {
-                hadjustment = hadj;
-            }
-
-            if (vadj != null) {
-                vadjustment = vadj;
-            }
+        public Gtk.ScrollablePolicy VscrollPolicy {
+            get; set;
+        }
 
+        private void UpdateAdjustments ()
+        {
+            Log.Debug ("UpdateAdjustments");
             // FIXME: with ViewLayout, hadj and vadj should be unified
             // since the layout will take the header into account...
             if (hadjustment != null) {
@@ -1088,18 +1100,6 @@ namespace Hyena.Data.Gui
             }
         }
 
-        /*protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
-        {
-            if (hadj == null || vadj == null) {
-                return;
-            }
-
-            hadj.ValueChanged += OnHadjustmentChanged;
-            vadj.ValueChanged += OnVadjustmentChanged;
-
-            UpdateAdjustments (hadj, vadj);
-        }*/
-
 #endregion
 
     }
diff --git a/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs b/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
index bab0e8d..0025cc2 100644
--- a/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
+++ b/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
@@ -36,7 +36,7 @@ using Hyena.Gui.Theming;
 
 namespace Hyena.Widgets
 {
-    public class RoundedFrame : Bin, Gtk.ScrollableImplementor
+    public class RoundedFrame : Bin, Gtk.Scrollable
     {
         private Theme theme;
         protected Theme Theme {
@@ -86,6 +86,22 @@ namespace Hyena.Widgets
             set { draw_border = value; QueueDraw (); }
         }
 
+        public Gtk.ScrollablePolicy HscrollPolicy {
+            get; set;
+        }
+
+        public Gtk.ScrollablePolicy VscrollPolicy {
+            get; set;
+        }
+
+        public Gtk.Adjustment Vadjustment {
+            get; set;
+        }
+
+        public Gtk.Adjustment Hadjustment {
+            get; set;
+        }
+
 #region Gtk.Widget Overrides
 
         protected override void OnStyleUpdated ()
@@ -149,13 +165,6 @@ namespace Hyena.Widgets
             child.SizeAllocate (child_allocation);
         }
 
-        /*protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
-        {
-            // This is to satisfy the gtk_widget_set_scroll_adjustments
-            // inside of GtkScrolledWindow so it doesn't complain about
-            // its child not being scrollable.
-        }*/
-
         protected override bool OnDrawn (Cairo.Context cr)
         {
             CairoHelper.TransformToWindow (cr, this, Window);



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