sizing of toolbar

View: New views
5 Messages — Rating Filter:   Alert me  

sizing of toolbar

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My app has a small "custom" toolbar.  Previously I constructed
this using gtk_toolbar_append_item to add buttons, but since that
function is is deprecated I'm now trying to use
gtk_toolbar_insert to stuff the bar with GtkToolButtons.

I've hit one problem.  The toolbar is small and I don't want its
raised window to extend the full width of the main window, so I'm
doing this sort of thing when packing the toolbar into an
enclosing vbox:

hbox = gtk_hbox_new(FALSE, 0);
/* don't expand the toolbar */
gtk_box_pack_start(GTK_BOX(hbox), toolbar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

This worked fine when I was using gtk_toolbar_append_item, but
with the new method the above code produces a drop-down toolbar!  
It seems the new-style toolbar doesn't have any "natural width" at
the point when it's packed into the hbox, so it's compacted to a
drop-down.

I've verified that the code is basically OK by substituting

gtk_box_pack_start(GTK_BOX(hbox), toolbar, TRUE, TRUE, 0);

for the second code-line above.  Then the toolbar displays
correctly, but it occupies the full width of the hbox, which I
don't want.  (When it's working correcly, it occupies about 1/3 of
the width, with the enclosing window at its default size).

Any suggestions gratefully received.

--
Allin Cottrell
Department of Economics
Wake Forest University, NC
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: sizing of toolbar

by Santi Regueiro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jun 23, 2008 at 17:55, Allin Cottrell <cottrell@...> wrote:
>
> Any suggestions gratefully received.
>
Have you tried this? :

gtk_toolbar_set_show_arrow ()
void                gtk_toolbar_set_show_arrow          (GtkToolbar *toolbar,
                                                         gboolean show_arrow);

Sets whether to show an overflow menu when toolbar doesn't have room
for all items on it. If TRUE, items that there are not room are
available through an overflow menu.

toolbar : a GtkToolbar
show_arrow : Whether to show an overflow menu

Since 2.4

I'm just starting with gtk and didn't start playing with toolbars yet
so I'm not sure if this will make the parent widget expand to be able
to show the entire toolbar.
Maybe if you let the container of the toolbar (and not the toolbar
itself) expand you'll get the desired behavior.

Hope you understand my english :)
--
Santi Regueiro
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: sizing of toolbar

by Ke Jin-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think you could use a layout component so you can put your toolbar of any
size.

Hope it helps.

Ke

On Mon, Jun 23, 2008 at 12:16 PM, Santi Regueiro <santiregueiro@...>
wrote:

> On Mon, Jun 23, 2008 at 17:55, Allin Cottrell <cottrell@...> wrote:
> >
> > Any suggestions gratefully received.
> >
> Have you tried this? :
>
> gtk_toolbar_set_show_arrow ()
> void                gtk_toolbar_set_show_arrow          (GtkToolbar
> *toolbar,
>                                                         gboolean
> show_arrow);
>
> Sets whether to show an overflow menu when toolbar doesn't have room
> for all items on it. If TRUE, items that there are not room are
> available through an overflow menu.
>
> toolbar : a GtkToolbar
> show_arrow : Whether to show an overflow menu
>
> Since 2.4
>
> I'm just starting with gtk and didn't start playing with toolbars yet
> so I'm not sure if this will make the parent widget expand to be able
> to show the entire toolbar.
> Maybe if you let the container of the toolbar (and not the toolbar
> itself) expand you'll get the desired behavior.
>
> Hope you understand my english :)
> --
> Santi Regueiro
>  _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@...
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: sizing of toolbar

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 23 Jun 2008, Santi Regueiro wrote:

> On Mon, Jun 23, 2008 at 17:55, Allin Cottrell <cottrell@...> wrote:
> >
> > Any suggestions gratefully received.
> >
> Have you tried this? :
>
> gtk_toolbar_set_show_arrow ()
> void                gtk_toolbar_set_show_arrow          (GtkToolbar *toolbar,
>                                                          gboolean show_arrow);
>
> Sets whether to show an overflow menu when toolbar doesn't have
> room for all items on it. If TRUE, items that there are not room
> are available through an overflow menu...

Thanks!  This works: if I set "show_arrow" to FALSE the bar is
shown correctly.

Allin Cottrell
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: sizing of toolbar

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 23 Jun 2008, K J wrote:

> I think you could use a layout component so you can put your
> toolbar of any size.

Thanks, but I just wanted the toolbar to show at its "natural
size" -- and supressing show_arrow did that.

Allin Cottrell.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
LightInTheBox - Buy quality products at wholesale price