
Then engineer the library on top of that. This would simplify x-platform development... the problem is working out the right abstraction.
Exactly! But is there any ;) ? One interesting point is: in Windows, once you create a window on a thread, you'll only receive messages in that thread. I have no idea how this happens on Mac/Unix.
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 why not have that ability in the framework? That is the reason I posted this, to get ideas. It should not be that difficult to be able to change the layouts at run-time... once the layout managers have been written, that is.
I you create the right layout manager, definitely ;)
[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.
My idea was something along the lines of:
class MouseEvent { public: static const int LeftButton = 0; static const int MiddleButton = 1; static const int RightButton = 2; private: int button; unsigned int vkeys; win::api::point pt; public: inline MouseEvent( int, WPARAM, LPARAM ); };
MouseEvent::MouseEvent( int btn, WPARAM wp, LPARAM lp ): button( btn ), vkey( wp ), pt( lp ) { }
class MouseListener { public: virtual void mouseMove( const MouseEvent & ); virtual void mouseButtonDown( const MouseEvent & ); virtual void mouseButtonUp( const MouseEvent & ); virtual void mouseButtonDoubleClick( const MouseEvent & ); public: virtual ~MouseButtonListener(); };
Good luck. I'm not a big fan of this. Mostly, because there are just so many events out there. You'll need to create a certain class for each. And what about custom events and such? What about commands/ notifications (Win32 only)? As a side-note, how are these implemented on Unix/MAC? Is there similarity between them and Win32?
I'm all for it, but again, I think it's so much work...
But it will be fun! :D
Great! Just keep us posted! 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)