[hyena/gtk3] WrapLabel: Fix coordinates in OnDrawn and clean up



commit b42660925e1dbe9fa65e5cc5eac8c0d9794c1c19
Author: Olivier Dufour <olivier duff gmail com>
Date:   Wed Jul 27 19:30:37 2011 +0200

    WrapLabel: Fix coordinates in OnDrawn and clean up

 Hyena.Gui/Hyena.Widgets/WrapLabel.cs |   34 ++++------------------------------
 1 files changed, 4 insertions(+), 30 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Widgets/WrapLabel.cs b/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
index 807dc4f..174b8c6 100644
--- a/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
+++ b/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
@@ -106,36 +106,10 @@ namespace Hyena.Widgets
                 // Center the text vertically
                 int lw, lh;
                 layout.GetPixelSize (out lw, out lh);
-                int y = Allocation.Y + (Allocation.Height - lh) / 2;
-                
-                //TODO include in a utils class or find one in gtk
-                switch (State) {
-                    case StateType.Active:
-                        StyleContext.State = StateFlags.Active;
-                    break;
-                    case StateType.Focused:
-                        StyleContext.State = StateFlags.Selected;
-                    break;
-                    case StateType.Inconsistent:
-                        StyleContext.State = StateFlags.Inconsistent;
-                    break;
-                    case StateType.Insensitive:
-                        StyleContext.State = StateFlags.Insensitive;
-                    break;
-                    case StateType.Normal:
-                        StyleContext.State = StateFlags.Normal;
-                    break;
-                    case StateType.Prelight:
-                        StyleContext.State = StateFlags.Prelight;
-                    break;
-                    case StateType.Selected:
-                        StyleContext.State = StateFlags.Selected;
-                    break;
-                }
+                int y = (Allocation.Height - lh) / 2;
 
-                StyleContext.RenderLayout (cr, Allocation.X, y, layout);
-                //Gtk.Style.PaintLayout (Style, cr, State, false,
-                //    this, null, Allocation.X, y, layout);
+                StyleContext.State = StateFlags;
+                StyleContext.RenderLayout (cr, 0, y, layout);
             }
 
             return true;



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