diff options
author | Jérémie Laval <jeremie.laval@gmail.com> | 2015-03-25 16:13:33 +0300 |
---|---|---|
committer | Jérémie Laval <jeremie.laval@gmail.com> | 2015-03-25 16:13:33 +0300 |
commit | daa07a9a480f3f9030da1aef6228e9b458476292 (patch) | |
tree | d6bd260426ca7947a37c047fa25876f5e90238be /Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs | |
parent | 9531946ff0f32104ad94439098d7c8703f7c2535 (diff) |
[Gtk] Tweak button internal layout to have MenuButton arrow flushed right
Diffstat (limited to 'Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs')
-rwxr-xr-x | Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs index 68e7449a..69dd718f 100755 --- a/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs @@ -110,13 +110,14 @@ namespace Xwt.GtkBackend contentWidget = box; } + var expandButtonContent = false; if (b.Type == ButtonType.DropDown) { if (contentWidget != null) { Gtk.HBox box = new Gtk.HBox (false, 3); box.PackStart (contentWidget, true, true, 3); - box.PackStart (new Gtk.VSeparator (), true, true, 0); box.PackStart (new Gtk.Arrow (Gtk.ArrowType.Down, Gtk.ShadowType.Out), false, false, 0); contentWidget = box; + expandButtonContent = true; } else contentWidget = new Gtk.Arrow (Gtk.ArrowType.Down, Gtk.ShadowType.Out); } @@ -124,6 +125,16 @@ namespace Xwt.GtkBackend contentWidget.ShowAll (); Widget.Label = null; Widget.Image = contentWidget; + if (expandButtonContent) { + var alignment = Widget.Child as Gtk.Alignment; + if (alignment != null) { + var box = alignment.Child as Gtk.Box; + if (box != null) { + alignment.Xscale = 1; + box.SetChildPacking (box.Children [0], true, true, 0, Gtk.PackType.Start); + } + } + } } else Widget.Label = null; } |