Search code examples
c++user-interfacegtkdrawgtkmm

How to make clickable shapes in GTKmm


I was looking for a way to create clickable shapes in GTKmm 3. I went through the documentation and going off how shapes are drawn with cairo I cant see how to do make these shapes clickable.

What I am trying to create are concentric arcs each being clickable very similar to this

sample with shapes

and I really can't see a way about creating it without clickable shapes.

Any help is appreciated.


Solution

  • SO apparently there is no way of going around this other than drawing an object and to figure out whether the mouse lied inside the shape using linear algebra and the coordinates of both the shape and the mouse.

    An example of this is in the source code for the GNOME disk analyzer tool. look for button-press-event and follow the function calls.