Re: [gtk-list] Re: [gtk-1.0.6] GtkToolbar: THX



Damon Chaplin wrote:
> 
> Norbert Bladt wrote:
> >
> > Hi !
> >
> > I did ask two questions on this list how to change a pixmap
> > in a toolbar button.
> > The replies I received gave me some new ideas to try.
> >
> > Thanks a lot for sending this comments. I'll try both and see
> > what happens and if they work.
> >
> > john@giorgio.hart.bbk.ac.uk suggested to take a look at the
> > testgtk notebook part. I did it. It looks promising.
> >
> > Feiguin <feiguin@ifir.ifir.edu.ar> suggested a way to remove from and
> > then add the item, e.g. the button, to the container, again .
> > I'll try this, too.
> 
> I use gtk_pixmap_set() to change the pixmap.
> The only awkward thing is getting the pixmap widget to change.
> 
> The toolbar returns the button when you add the toolbar item.
Right. I figured that out, yesterday.

> The button contains a vbox which has 2 children - the label and the pixmap
> (assuming you are using standard toolbar buttons).
I couldn't figure that out, even by reading the gtktoolbar.c sources
Thank you very much for pointing this out !

> So you can do something like:
> 
> #ifdef GTK_HAVE_FEATURES_1_1_0
>   vbox = GTK_BIN (toolbar_button)->child;
> #else
>   vbox = GTK_BUTTON (toolbar_button)->child;
> #endif
> 
>   vbox_children = GTK_BOX (vbox)->children;
> 
>   /* Note that the label is added first in gtktoolbar.c which is why
>      it is first in the list (unless you didn't set any label). */
>   label = ((GtkBoxChild*)vbox_children->data)->widget;
>   pixmap = ((GtkBoxChild*)vbox_children->next->data)->widget;
> 
>   gtk_pixmap_set (GTK_PIXMAP (pixmap), gdk_pixmap, mask);
I'll try it.

Regards,

Norbert.

-- 
Norbert Bladt		 Payphone Management System Software Development
ascom Autelca AG
Worbstrasse 201		 CH-3073 Guemligen, Switzerland
abladtn@autelca.ascom.ch VOICE: +41 31 999 6552, FAX: +41 31 999 6575



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