Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-09-15 06:10:42

Adam Badura wrote:
> I am interested in such a library too (now it is the main reason I
>use Java instead of C++) so I would like to help to project such a library
>and then to implement it. I have a little experience in OWL, some in Java
>GUI, MFC and some more in Win API. Unfortunattly I didn't even use
>(seriously) other platform then Win32/Intel (as C++ compiler I use Borland
>C++ 5.5, Microsoft Visual C++ Toolkit 2003, Microsoft Visual Studio .NET
>2003), so I can only write part for Win.
> What you say?

I too like the Java GUI framework. Especially, the layouts and
constructor-creates-a-window features make it possible to rapidly produce a

I tried to make attempts in this direction a while ago, but there are
numerous issues. Not only do you need to consider the OS you are targetting
(Windows, Linux, MacOS, OS/2, ...), but also what GUI library you are
targetting (Qt, Motif, John Torjo's Win32 framework, Win32 API, MFC, WTL,

Do you go for a unified coordinate system (Windows and Mac have different
coordinate orientations, so do you transform?)

What colour model do you use (RGB, CMY, HSV)? Can you convert between them?
Do you have a standard colour set (like in HTML)?

What event dispatching mechanism do you use (message maps, signals/slots,
boost::signal, boost::function)?

Are you going to write yet another Windows to C++ layer when ATL/WTL does it
*a lot* better than you could do (without ripping the ATL/WTL logic)? What
about other OSes?

I would say that leveraging the base API for an OS (PalmOS, Windows, GDK,
...) should be avoided -- there are libraries already available that do
this. I would suggest using the C++ frameworks as the base line for
developing a C++ GUI framework. That way, you can have a thin layer on top
of the framework.

On top of the thin layer, you could then add support for features like
layouts and constructing a window *creates* that window. You could then do
something like:

int gui_main( int argc, const char ** argv )
   boost::smart_ptr< gui::main_frame > frame( new gui::main_frame( "Hello
World" ));
   frame -> resize( 300, 250 );
   frame -> show();
   frame -> Invalidate(); // Use an ATL/WTL specific feature
   return 0;

There is then the issue of supporting window-based objects (that consume
window/GUI resources), windowless objects (those that don't) and
custom/owner drawn components.

Can you mix native components (e.g. a WTL splitter) with the generic
framework in *both* directions?

- Reece Haston Dunn
Software Engineer, Sophos

Boost list run by bdawes at, gregod at, cpdaniel at, john at