Re: [gtk-list] Re: how to swap pixmaps in a button?
- From: "Michael J. Hammel" <mjhammel fastlane net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: how to swap pixmaps in a button?
- Date: Wed, 21 Jan 1998 21:36:55 -0700 (MST)
In a previous message, Owen Taylor says:
> Or, you could use a single Pixmap widget, and switch the
> GDK pixmaps between them. In this case, you just call
>
> gtk_pixmap_set (pn->pn_alarmwidget, my_new_gdk_pixmap);
This worked. Much easier to use, too. In my application I had two
pixmaps, one blank and one for when the button was "on". One other problem
I had was that I was using the same mask for both, and the default was the
blank mask so when the "on" pixmap was installed it didn't show up because
the mask was wrong. Duh!
> You still have to be concerned about refcounting here, but things
> are a bit different - there is no "floating" flag or adoption -
> gtk_pixmap_set (and gtk_pixmap_new) just increment the reference
> count on the pixmap that is added. So you don't have to call
> gdk_pixmap_ref to begin with, but you do need to call
> gdk_pixmap_unref at the end.
I'm a little confused on this part. I create one pixmap with a call to
pixmap_id = gtk_pixmap_new(pixmap, mask).
Now, when I destroy the widget that is using this I need to do
gdk_pixmap_unref(pixmap_id)
Is that correct?
One other thing - when I destroy the button in which these pixmaps live, I
do so by destroying the top level widget (a dialog window). Won't that
clean up everything on its own? Or do I need to do the gdk_pixmap_unref()
anyway?
> Hope this helps,
It did. Thanks for the tips!
--
Michael J. Hammel |
The Graphics Muse | I don't suffer from insanity. I enjoy every
mjhammel@graphics-muse.org | minute of it.
http://www.graphics-muse.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]