
The 2 previous posts about Curses::Toolkit were basically teasers :) Now I think it's
time to present in more details the architecture.
If you need an introduction to what Curses::Toolkit is, please refer to the
first post here.
Very briefly, Curses::Toolkit is a modern Curses console based toolkit in Perl.

1 Event Loop, Renderer

By itself the Curses::Toolkit Perl module is only what I would call a
Renderer.

The Renderer is in charge of building the widgets, calculating the various
coordinates, and rendering them using the associated theme. It is
also in charge of processing and emitting events, like keyboard inputs, buttons
clicked, etc... However it is not responsible for listening to the events.

The event Loop is in charge of listening to system events, and pass them to the
Renderer. It's also in charge of getting output events from the Renderer, and
handle them when it has time to do so.

Why have two different layers ?
Existing Perl Curses modules mix the event loop with the renderer. That means it's
reinvented, and in real life it lacks features. Seperating them means that one
can use any Event Loop, provided you build the matching thin wrapper so that
the event communication is compatible

1.1 The Renderer

Concepts : 
root window (with a Shape)
windows
widgets in windows : boxes, buttons, borders, labels, ...

There is only one Root Window. The root window is the terminal background, as
you have the root window in X. Root windows cannot be drawn on directly, but
Windows can be added to it.

Windows are special widgets :
- they are the only one that can be added in he root window
- they are the only one that can have absolute positions (or relatives to the
root window shape)

Widgets
- have to be added in a window or another widget
- cannot have absolute position

1.2 Events

1.2.1 System events
The main system events are : keys pressed, root window resized, mouse interaction,
timers.

1.2.2 Toolkit events
Widgets interactions : clicks, window resizing, panes resizing, dragdrop, etc
Special event : redraw event.

1.3 The Event Loop
The goal is to provide Curses::Toolkit with at least one working Event Loop, so
that it's functional straight away, and later on, develop the connection to
other Event Loop.

For the start, Curses::Toolkit will use POE as Event Loop. It's probably the
best thing around these days, and is very easy to use.

POE::Component::Curses is the POE twin module of Curses::Toolkit :
- it spawns a Curses Toolkit object
- it listens for system events
- it instanciates a POE::Component::Curses::Mainloop

POE::Component::Curses::Mainloop is a translation layer. It translates the POE
event into Curses::Toolkit events back and forth.

(POE Event Loop) | Mainloop | (Renderer)


