Re: [gtk-list] Toolbar Question

>I've been playing around with the gtk_toolbar widget, and cool as it 
>what I'd really like to be able to do is to make a "tear-off" toolbar,
>as I've seen on quite a few gtk apps.
>However, there seems to be no mention of how to create one in
>gtktoolbar.h, and I can't find anything in the documentation...
>Is this a feature I have to program myself, or is it just a hidden
>toolkit function?
>To unsubscribe: mail -s unsubscribe < 

No.  What actually accomplishes the "tear-off" effect is the 
GtkHandleBox widget.  All you have to do is pack your toolbar into a 
handlebox and you're set:

GtkWidget *HandleBox, *Toolbar;

HandleBox = gtk_handle_box_new();

/* You don't have to use this style... */

Toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, 

gtk_container_add (GTK_CONTAINER (HandleBox), Toolbar);

/* Only use this next line if you don't want the window to shrink */
/* when detaching a handlebox.                                    */

/* GTK_HANDLE_BOX (HandleBox)->shrink_on_detach = FALSE; */

/* Add stuff to your toolbar... */

gtk_widget_show (Toolbar);
gtk_widget_show (HandleBox);

... And that's it.  Also, you can put a menubar in a handlebox for the 
tear-off effect.

Get Your Private, Free Email at

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