[hyena/gtk3] RatingEntry: Fix rendering of the background and frame



commit 397813dd6626efe3dd338a82d9bf47536ed03b8f
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Mon Jul 4 21:34:11 2011 +0200

    RatingEntry: Fix rendering of the background and frame
    
    By adding the "entry" class, the background and the frame will be
    rendered like they are for a regular GtkEntry.

 Hyena.Gui/Hyena.Widgets/RatingEntry.cs |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Widgets/RatingEntry.cs b/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
index f78b9f0..2a9a315 100644
--- a/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
+++ b/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
@@ -272,22 +272,16 @@ namespace Hyena.Widgets
 
             if (HasFrame) {
                 int y_mid = (int)Math.Round ((Allocation.Height - renderer.Height) / 2.0);
-                this.StyleContext.State = StateFlags.Normal;
-                StyleContext.RenderFrame (cr, Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
-                StyleContext.RenderBackground (cr, Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
-                //Gtk.Style.PaintFlatBox (Style, cr, State, ShadowType.None, this, "entry",
-                //    Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
-                this.StyleContext.State = StateFlags.Active;
-                StyleContext.RenderFrame (cr, Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
-                //Gtk.Style.PaintShadow (Style, cr, State, ShadowType.In,
-                //    this, "entry", Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
+                StyleContext.Save ();
+                StyleContext.AddClass ("entry");
+                StyleContext.RenderBackground (cr, 0, y_mid, Allocation.Width, renderer.Height);
+                StyleContext.RenderFrame (cr, 0, y_mid, Allocation.Width, renderer.Height);
+                StyleContext.Restore ();
             }
 
-            Gdk.RGBA rgba = Parent.StyleContext.GetColor (StateFlags);
-
             CairoHelper.TransformToWindow (cr, this, Window);
             renderer.Render (cr, Allocation,
-                new Cairo.Color (rgba.Red, rgba.Green, rgba.Blue, rgba.Alpha),
+                CairoExtensions.GdkRGBAToCairoColor ( Parent.StyleContext.GetColor (StateFlags)),
                 AlwaysShowEmptyStars, PreviewOnHover && hover_value >= renderer.MinRating, hover_value,
                 State == StateType.Insensitive ? 1 : 0.90,
                 State == StateType.Insensitive ? 1 : 0.55,



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