Re: [GTKMM] Standalone pixmap



On Wednesday 29 December 2004 12:55, Mateusz 'vArDo' Bilinski wrote:
> Rob Benton wrote:
> > Passing a Gdk::Drawable into the Gdk::Pixmap::create() method does not
> > associate it or anything like that.  All it does is set the Pixmap's
> > depth to that of the Gdk::Drawable you passed in.
> >
> > If I'm wrong someone please correct me.  I looked at the Gtk
> > "gdk_pixmap_new()" function for this info.
>
> Thanks for anwsering.
>
> I think you're right. I've checked this once again. I misunderstood it
> because I thought I've checked it once and for example I couldn't create
> a pixmap with size for 10x20 and had to create a pixmap using get_width
> (), get_height() methods. But it was probably very late ;/.
>
> But from what I read if I set my own depth (diffrent from -1) I don't
> have to give any Gdk::Drawable. The question is how to do it?

The first argument is of type const Glib::RefPtr<Gdk::Drawable>&.  You can 
have an null (empty) Glib::RefPtr<>.  Thus:

  Glib::RefPtr<Gdk::Drawable> drawable;

Will provide an empty Glib::RefPtr with a reference count of 0, for which the 
test (drawable) will yield false, and !drawable will yield true.

Try passing a first argument of Glib::RefPtr<Gdk::Drawable>() to the 
Gdk::Pixmap::create() function.  It is legal c++.  Whether you can pass no 
object and get the result you want is another matter - try it and see.

Chris.



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