Re: Aligning ToolItem To Right in Toolbar
- From: Colomban Wendling <lists ban herbesfolles org>
- To: gtk-app-devel-list gnome org
- Subject: Re: Aligning ToolItem To Right in Toolbar
- Date: Tue, 27 Aug 2013 11:18:39 +0200
Le 27/08/2013 08:07, Joshua Strobl a écrit :
[...] and set to expand horizontally (set_hexpand(true)).
Tip: you could use the Vala-style property setter, toolbar.hexpand=true
As my Pastebin (link below) shows, the second
(exampleGlobalMenuContainer) ToolItem is left aligned, which is
completely understandable as it hasn't been set to do otherwise.
LINK: http://pastebin.com/M2nnuynk My question is, how on earth do I
set it (the exampleGlobalMenuContainer ToolItem) to horizontally
align to the right? I looked into using set_halign to GTK_ALIGN_END
and was contemplating using margin-left (although I'd have to have
an event listener that'd evaluate the window width and change the
margin-left otherwise). What would the appropriate method be to
align the ToolItem?
AFAIK the correct solution is using a separator item set to be invisible
and to expand. I didn't do Vala for at least a year so excuse the maybe
crappy style, but:
var sep = new Gtk.SeparatorToolItem();
sep.draw = false;
toolbar.add(sep);
toolbar.child_set(sep, expand:true);
This way you have the items after the separator pushed to the right[1]
-- and as a bonus you see a nice separator in the overflowing items menu
if the toolbar has to show it.
https://developer.gnome.org/gtk3/stable/GtkSeparatorToolItem.html#GtkSeparatorToolItem.description
https://developer.gnome.org/gtk3/stable/GtkToolbar.html#GtkToolbar--c-expand
Regards,
Colomban
[1] or to the left if locale is RTL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]