|
Boost : |
From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-07-30 18:57:42
I really enjoyed discussing the library with you guys.
I think I am getting a bit close to what the library
should look like from my personal standpoint.
The main ideas come from the MFC's document/view
architecture, STL and present discussion.
The main building blocks of the libarary will be two
classes, 'view' and 'viewdata'. Both classes will be
thread-safe.
It is similar to the document/view architecture in
MFC.
The 'viewdata' provides a connection between
'real-world' data
and instances of the 'view' class. Several 'view'
objects can be
connected together in terms of sharing an instance of
data.
The 'view' class is just something that can show the
data.
For example a single cell in the standard list control
will be derived from the 'view' class as will the
whole list control itself.
The 'view' class will have an event map. The event
map
will be implemented as pairs, (event, action).
It'll need to be discussed.
The events will be asynchronous, so that the actions
will
be called in the context of an internal thread.
I think the boost::signal libarary will work just
fine.
The 'view' classes could be combined as STL
containers.
There will a set of gui managers that will be able to
traverse
such view containers and perform various actions or
enforce
layout rules. I think the gui managers will be
implemented
using the 'visitor' design pattern.
The attached file is a demonstration of some these
ideas. It is very simple.
The main file is gui.h
The example consists of a dialog box with connected
static controls. If you change data in one control
the connected control is updated automatically.
It also shows how the GUI library communicates
to the physical GUI platform (win32 in this case).
The physical platform can be easily replaced w/o
any changes to the library itself.
The example doesn't have any event mechanism yet
and it is not a thread-safe implementation.
The example uses the boost::shared_ptr template.
Eugene
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk