[banshee: 49/61] [Hyena.Widgets] Vertically center WrapLabel text



commit eeef414bd0b5484acffdf96f8635f0befd872e26
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Oct 15 11:03:14 2009 -0700

    [Hyena.Widgets] Vertically center WrapLabel text

 src/Libraries/Hyena.Gui/Hyena.Widgets/WrapLabel.cs |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Widgets/WrapLabel.cs b/src/Libraries/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
index 582a208..a138e87 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
@@ -102,8 +102,13 @@ namespace Hyena.Widgets
         protected override bool OnExposeEvent (Gdk.EventExpose evnt)
         {
             if (evnt.Window == GdkWindow) {
+                // Center the text vertically
+                int lw, lh;
+                layout.GetPixelSize (out lw, out lh);
+                int y = Allocation.Y + (Allocation.Height - lh) / 2;
+
                 Gtk.Style.PaintLayout (Style, GdkWindow, State, false, 
-                    evnt.Area, this, null, Allocation.X, Allocation.Y, layout);
+                    evnt.Area, this, null, Allocation.X, y, layout);
             }
 
             return true;



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