
Hi Reece, Just a few thoughts:
I am currently designing a GUI framework in C++ (initially targeting the Windows platform) that uses a model similar to that which Java uses in
Take a deep breath if you want to make it cross-platform ;) I think that's Windows work x 10 or so. Maybe more ;) ...
it's AWT and Swing libraries. Specifically:
[1] Being able to use constructors to create the windows/components. This means there is no need to explicitly call a Create method like in the MFC framework.
win32gui does that ;)
[2] The use of layout managers. I like the various layout managers in Java and how easy it is to construct complex GUI interfaces.
I like the idea of layout managers. Still, it seems (to me) in real-life they kind of fail. You'll always want that special case where you need to hide control X and show control Y, etc. So far, I've created splitters on dialogs at design time (still beta ;)). If you use them correctly, you can specify a lot ot design time. Also, you can easily hide/show the left/right panes.
[3] The support for events via "listeners". This will most likely be geared towards key/mouse events and "action" events (e.g. when the user presses on a button).
I'm not a big fan of listeners. You need to do a lot of coding manually to set them, etc. I've implemented them totally different - using event handler classes.
At the moment, I have a basic working version that allows you to write the following:
int PASCAL WinMain( HINSTANCE, HINSTANCE, LPSTR, int sw ) { swing::JFrame frame( L"Swing JFrame!" ); frame.setPane( new swing::JPanel()); frame.setSize( 500, 500 ); frame.show( sw );
MessageLoop msg; return( msg.Execute()); }
can you break the message loop? That is, specify when a message loop should end (when a certain signal is received).
This creates two windows: the main frame and a panel that is a child of that frame. The JFrame is created in the constructor, but is not displayed until show is called. Likewise, the JPanel is created inside its constructor and the JFrame.setPane method makes that window a child of the frame.
I would appreciate comments and ideas as to what people would like out of a GUI framework, especially one that will be multi-platform.
I'm all for it, but again, I think it's so much work... Best, John -- John Torjo Freelancer -- john@torjo.com Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -- v1.3beta released - check out splitter/simple_viewer, a File Explorer/Viewer all in about 200 lines of code! Professional Logging Solution for FREE -- http://www.torjo.com/code/logging.zip (logging - C++) -- http://www.torjo.com/logview/ (viewing/filtering - Win32) -- http://www.torjo.com/logbreak/ (debugging - Win32)