[banshee/grid] [ColumnCellAlbum] begin implementing interaction



commit 37b24663b8013edddd976e0091631a959ca51a0a
Author: Aaron Bockover <abockover novell com>
Date:   Fri Jan 15 16:42:36 2010 -0500

    [ColumnCellAlbum] begin implementing interaction
    
    Stubbed, and a basic test overlay rendering that exposes some bad
    bugs with child allocation and damage computation after leaving
    an interaction call on the child. Yay.

 .../Banshee.Collection.Gui/ColumnCellAlbum.cs      |   33 +++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
index 2686c68..ce45c7b 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
@@ -40,9 +40,10 @@ using Banshee.ServiceStack;
 
 namespace Banshee.Collection.Gui
 {
-    public class ColumnCellAlbum : ColumnCell
+    public class ColumnCellAlbum : ColumnCell, IInteractiveCell
     {
         private ArtworkManager artwork_manager;
+        private object hover_object;
 
         public double PaddingX { get; set; }
         public double PaddingY { get; set; }
@@ -97,6 +98,14 @@ namespace Banshee.Collection.Gui
 
             RenderImageSurface (context, new Rectangle (x, y, width, height), image_surface);
 
+            // Render the overlay
+            if (LayoutStyle == DataViewLayoutStyle.Grid && hover_object != null) {
+                var cr = context.Context;
+                cr.Color = new Color (0, 0, 0, 0.5);
+                cr.Rectangle (x, y, width, height);
+                cr.Fill ();
+            }
+
             if (lines == null || lines.Length < 2) {
                 return;
             }
@@ -218,6 +227,28 @@ namespace Banshee.Collection.Gui
             return true;
         }
 
+#region IInteractiveCell
+
+        public bool ButtonEvent (int x, int y, bool pressed, Gdk.EventButton evnt)
+        {
+            return false;
+        }
+
+        public bool MotionEvent (int x, int y, Gdk.EventMotion evnt)
+        {
+            var redraw = hover_object != BoundObject;
+            hover_object = BoundObject;
+            return redraw;
+        }
+
+        public bool PointerLeaveEvent ()
+        {
+            hover_object = null;
+            return true;
+        }
+
+#endregion
+
 #region Accessibility
 
         private class ColumnCellAlbumAccessible : ColumnCellAccessible



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