Pixbuf versus Pixmap in drag and drop set_icon



Hi there... I'm coding this Arimma  (an amazing and amusing board game) client,
and I'm using drag  and drop in a table of Gtk::Image  widgets to implement the
movement of the stones.


To make  the user actually  feels as he/she/it  has grabbed the stone  with the
mouse click, I have to move the  drag icon to position the stone image right at
the place where the user clicked in the board image...

I had implemented it with Pixmap, using the Dragcontext method

void 	set_icon (const Glib::RefPtr<Gdk::Colormap>& colormap, const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask, int hot_x, int hot_y)

and it worked just fine.  Now I decided to use a pixbuf instead of a pixmap, and when I tried to use the method

void 	set_icon (const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y)

I didn't get any error messages, but the icon was not translated... What is wrong??


The following code has the two versions, the pixmap version is commented out, and is the one that actually works...  Can it be a bug in the set_icon method?



void House::on_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context) {
	//  Glib::RefPtr<Gdk::Pixmap> stone;
	//  Glib::RefPtr<Gdk::Bitmap> mask;

	Glib::RefPtr<Gdk::Pixbuf> stonebuf;
	stonebuf = img.get_pixbuf();
	
	//	stonebuf->render_pixmap_and_mask(stone, mask, 100);

	int x;
	int y;
	img.get_pointer(x, y);
	
	//context->set_icon(get_colormap(), stone, mask, x, y);
	context->set_icon(stonebuf, x, y);
	
	img.set(board->board_images[lin*8+col]);
}




-- 
Nicolau Werneck <nwerneck cefala org>         9F99 25AB E47E 8724 2F71
http://cefala.org/~nwerneck                   EA40 DC23 42CE 6B76 B07F
"After silence, that which comes nearest to expressing the inexpressible is music."
-- Aldous Huxley

Attachment: signature.asc
Description: Digital signature



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