[hyena] Theme: Add DrawHighlightFrame method to render selection border



commit ad9f055a49fc78dc2486cfdb35ce9effa90a5e51
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sun Jun 15 12:44:04 2014 +0200

    Theme: Add DrawHighlightFrame method to render selection border
    
    Turns out Banshee was using the DrawRowSelection in the SourceView to
    highlight the source row when you right click on it. So we add a simple
    DrawHighlightFrame method that does just what was done in this case:
    draw a sharp single pixel border using the selection color.

 Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs |    8 ++++++++
 Hyena.Gui/Hyena.Gui.Theming/Theme.cs    |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
index 9e3f252..ef87284 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
@@ -169,6 +169,14 @@ namespace Hyena.Gui.Theming
             cr.Stroke ();
         }
 
+        public override void DrawHighlightFrame (Cairo.Context cr, int x, int y, int width, int height)
+        {
+            cr.LineWidth = 1.0;
+            cr.SetSourceColor (SelectionStroke);
+            CairoExtensions.RoundedRectangle (cr, x + 0.5, y + 0.5, width - 1, height - 1, Context.Radius);
+            cr.Stroke ();
+        }
+
         public override void DrawRowCursor (Cairo.Context cr, int x, int y, int width, int height,
                                             Cairo.Color color, CairoCorners corners)
         {
diff --git a/Hyena.Gui/Hyena.Gui.Theming/Theme.cs b/Hyena.Gui/Hyena.Gui.Theming/Theme.cs
index b7458dc..458059b 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/Theme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/Theme.cs
@@ -134,6 +134,8 @@ namespace Hyena.Gui.Theming
 
         public abstract void DrawFrameBorder (Cairo.Context cr, Gdk.Rectangle alloc);
 
+        public abstract void DrawHighlightFrame (Cairo.Context cr, int x, int y, int width, int height);
+
         public void DrawRowCursor (Cairo.Context cr, int x, int y, int width, int height)
         {
             Cairo.Color color = CairoExtensions.GdkRGBAToCairoColor (Widget.StyleContext.GetBackgroundColor 
(StateFlags.Selected));


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