GTK+3 - A common event handler - possible?



This is very general - I can't offer code - but is it possible to have all events (mouse, keys and other) come into a single event handler somehow?

I've got a Gtk Window onto which I am drawing shapes (override the draw method and use cairo) and I want to make various shapes react to mouse events.
For e.g. Mouse enter, leave and drag/drop on a circle.

There are a few lines of thought. One of them is to have all events come into a single handler so that I can set my various flags like is_dragging, or detect which modifier keys are pressed while the mouse is clicked in a certain way. After that, I'd be able to emit signals up into my Circle class - so I could have simple enter, leave, drag, drop, click, triple_click, shift_click, alt_click and so on handlers.

Is this crazy-talk?
I am using Gtk Window and not DrawingArea because I can't turn the double-buffering off on a DrawingArea. Is a Window a wise choice, or should I be using a custom Gtk.Widget or something else?

How would you structure a canvas-like system and its events?

I keep wondering how Inkscape does it, but I find reading such complex code almost impossible.

\d


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