Draggable Circles
Posted by graineri on 2008-10-31 11:20
Ante mi desesperación por no poder lograr mover un puto círculo (claro, en realidad no es un círculo sino una consecución de puntitos con lo cual, ¿cómo demonios sabe Gtkmm que eso es un Widget?) mandé un mensaje a la lista de Cairo.
Esto es:
Respuesta:
You need a scenegraph, there are many cairo based ones available for GTK.
Otherwise you will have to make your own by storing the shapes as objects
and handling and testing for mouse events. This is not something cairo
provides. To test for a point in cairo you can use cairo_in_fill and
cairo_in_stroke but in my own code I just use bounding boxes. Depending on
your requirements first check out the existing gtk scenegraphs/canvas
projects (http://live.gnome.org/ProjectRidley/CanvasOverview) or even
custom GTK widgets before going it alone.
~Gerdus
On Fri, Oct 31, 2008 at 2:16 AM, Gabriel Raineri <
gabriel_raineri at yahoo.com.ar> wrote:
> Hi all!
>
> I'm using Gtkmm and Cairo.
> My idea is to draw a bunch of circles in a Gtk::DrawingArea and make them
> draggable but I don't know how to do this.
>
> Any help will be really appreciated.
>
> Thanks a lot in advance!
>
> Cheers,
> Gabe
Esto es:
Respuesta:
You need a scenegraph, there are many cairo based ones available for GTK.
Otherwise you will have to make your own by storing the shapes as objects
and handling and testing for mouse events. This is not something cairo
provides. To test for a point in cairo you can use cairo_in_fill and
cairo_in_stroke but in my own code I just use bounding boxes. Depending on
your requirements first check out the existing gtk scenegraphs/canvas
projects (http://live.gnome.org/ProjectRidley/CanvasOverview) or even
custom GTK widgets before going it alone.
~Gerdus
On Fri, Oct 31, 2008 at 2:16 AM, Gabriel Raineri <
gabriel_raineri at yahoo.com.ar> wrote:
> Hi all!
>
> I'm using Gtkmm and Cairo.
> My idea is to draw a bunch of circles in a Gtk::DrawingArea and make them
> draggable but I don't know how to do this.
>
> Any help will be really appreciated.
>
> Thanks a lot in advance!
>
> Cheers,
> Gabe
Home / Developer API / Tour / Get a Project - Solutions for Bug & Issue Tracking, Collaboration Tools, Subversion Hosting, Git Hosting
Taller i is powered by Assembla.
0 Comments