Re: Howto manage objects in DrawingArea?



thanks for the answers

> first of all I am not quite sure why you would want to split up a single
> responsibility (draw something in MyDrawingAreaWidget) over several
> classes. Perhaps it's some sort of requirement.

no actually it's not, thought it would be the best this way so all
drawing stuff is done in the object which should be drawn. so the code
which does curve handling is done all in one file and the code for text
objects is done in another

> But if your shape classes are not derived from a DrawingArea then they
> probably shouldn't draw themselves because, well, drawing the shapes is
> the responsibility of your MyDrawingAreaWidget. I would have my shape
> objects provide all the necessary information/computation instead and
> query them when I draw the shapes in MyDrawingAreaWidget.

perhaps your right, that way everything might be easier, but i'm afraid
that i'll get a huge DrawingArea class, since all the drawing and
especially the event handling is done in that one class.

hm and while i'm at reconsidering my whole concept :)
i thought it would be good to move the whole code for the tools
(selection tool, curve tool etc.) in seperate classes which implement
methods like on_button_press_event, on_motion_notify_event etc.
the DrawingArea class passes the events to the currently active tool by
calling it's corresponding method.
is that clever or is it again just a silly idea of mine?

buergi


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