Clever event management? [was: Howto manage objects in DrawingArea?]



Hello again,
can anyone give me a hint how to design a smart way to manage events, especially
the mouse events.
Project is still the same: in principle a simple vector graphics editor. First
of all only bezier curve drawing/editing is most important.

I've no idea how one usually makes a clever event handling. Of course the
interpretation of the mouse events needs to be totally different depending on
which tool is selected.
I thought about making a class for each tool. The MyDrawingArea class passes the
on_button_pressed etc. events to the active tool which handles them. I don't
know if it's a clever way of handling the events, since i also saw many projects
which had a huge central event handler class. Another way would be to include
the event management totally in the MyDrawingArea class.

Another thing is who should be responsible for moving an object e.g.? the object
itself or the eventhandler class? i thing the object itself would be better
since e.g. when dragging an object over the drawingarea i need to store the
position where the object was before the drag started, so it's position can be
reseted if one cancels the drag.
but on the other hand i want to separate the abstract objects from the GUI event
handling stuff, so i don't want to put any event handling routines in the
beziercurve class itself.

At the moment i'm totally confused how to approach all this event handling
stuff. I'm very noob in planning somewhat larger projects, hope anyone got some
hints for me.

thanks so much in advance

buergi


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