Re: [gtk-list] Toolbar Question



>Hi,
>
>I've been playing around with the gtk_toolbar widget, and cool as it 
is,
>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?
>
>Regards,
>
>-- 
>Lee.
>
>-- 
>To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < 
/dev/null
>

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_TOOLBAR_ICONS);

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 http://www.hotmail.com



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