Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2013-11-13 00:04:43 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-11-13 00:06:19 +0400
commitef54d065c721ce013d2dc96284629441aba1672b (patch)
tree952aeabcd4a034a587924807dfdae84be730e87a /Xwt.Gtk
parent31d15e6c9feb0f1c46a8531e0e4ffebb95f432b8 (diff)
[GTK] Another fix for label alignment
Diffstat (limited to 'Xwt.Gtk')
-rw-r--r--Xwt.Gtk/Xwt.GtkBackend/LabelBackend.cs19
1 files changed, 12 insertions, 7 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/LabelBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/LabelBackend.cs
index c9e7ea74..e7a7f691 100644
--- a/Xwt.Gtk/Xwt.GtkBackend/LabelBackend.cs
+++ b/Xwt.Gtk/Xwt.GtkBackend/LabelBackend.cs
@@ -175,15 +175,20 @@ namespace Xwt.GtkBackend
Label.Layout.GetPixelSize (out unused, out wrapHeight);
if (wrapWidth != args.Allocation.Width || oldHeight != wrapHeight) {
wrapWidth = args.Allocation.Width;
- // GTK renders the text using the calculated pixel width, not the allocated width.
- // If the calculated width is smaller and text is not left aligned, then a gap is
- // shown at the right of the label. We then have the adjust the allocation.
- if (Label.Justify == Gtk.Justification.Right)
- Label.Xpad = wrapWidth - unused;
- else if (Label.Justify == Gtk.Justification.Center)
- Label.Xpad = (wrapWidth - unused) / 2;
Label.QueueResize ();
}
+ // GTK renders the text using the calculated pixel width, not the allocated width.
+ // If the calculated width is smaller and text is not left aligned, then a gap is
+ // shown at the right of the label. We then have the adjust the allocation.
+ if (Label.Justify == Gtk.Justification.Right) {
+ var w = wrapWidth - unused;
+ if (w != Label.Xpad)
+ Label.Xpad = w;
+ } else if (Label.Justify == Gtk.Justification.Center) {
+ var w = (wrapWidth - unused) / 2;
+ if (w != Label.Xpad)
+ Label.Xpad = w;
+ }
}
void HandleLabelDynamicSizeRequest (object o, Gtk.SizeRequestedArgs args)