Re: [gtk-list] Re: GDK



Chad Nicolas Tindel wrote:
> 
> I agree wholeheartedly.  What GTK is really lacking is an application
> framework, which makes it possible for rapid application development.
> I'm thinking about the Doc/View model introduced in the book by Gamma, et
> al.  I always have to write all this code by hand when I write an app, and
> it's always the same code.... such a waste of time.

Again, you might want to take a look at my game (URL below), in the
directory ufe/view.

I implemented the View Handler pattern from the POSA book. It creates
views as an Abstract Factory and coordinates them as a Mediator. It uses
Observers (very much like java.awt.event.WindowListener) to keep
informed of what the views are up to.

My View class installs callbacks for most things. These callbacks are
Template Methods that call virtual methods on the view instance to do
the real work (i.e., polymorphic hooks). In the Template Method
callbacks they typically perform work before (such as converting events
to transformed coordinate classes) and after (such as notifying
Observers).

When I add a new view, I just subclass at the appropriate place in my
little view hierarchy. When I add functionality (such as lassoing or
selection) I percolate it up the hierarchy as it becomes more general.

You probably won't be able to use my code without *some* modification
but it's a bit of a start. I'm not sure what GTK-- does but it may be
similar.

-- 
SEGV  -  http://www.cgocable.net/~mlepage/
Features Minion real-time strategy game, RTS game programming info,
GTK+ tutorial, etc.



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