Re: Mouse events on a Cairo Context



Le 30/06/2013 21:10, Borja Mon Serrano a écrit :
Hi all,

[...]

1 - I think the best way is to create a signal to the cairomm context, but
I didn't see anything to do that. Maybe the way would be to create a cairo
surface or something like that.

I don't think Cairo has this kind of thing.  It's a library for drawing,
not interacting with the drawing.

2 - Every time I click to create a circle, I would have to create a gtk
widget in which I can handle mouse events. The problem here is that I think
it is impossible to put a widget on a DrawingArea, is it possible?

No you can't.  And no stock widget will give you a circular event area.

3 - Use goocanvasmm. The problem here is that goocanvasmm has a little
documentation <https://developer.gnome.org/goocanvasmm/stable/> and I think
this is not the best solution, I prefer to use cairomm.

This is probably the simplest solution, it's meant for this kind of things.

4 - Handle the events yourself:  listen to the
button-press-event/button-release-event of your DrawingArea and do the
math to know whether the click is on your circle or not.  Maybe Cairo
has this kind of thing, like "is that point in that shape", not sure.


Regards,
Colomban


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