|
Boost : |
From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-09-24 10:04:34
Thomas Witt wrote:
> David Abrahams wrote:
>
>> Reece Dunn <msclrhd_at_[hidden]> writes:
>>
>>> [1] Support constructor-based window creation, e.g.:
>>>
>>> frame.add( new gui::button( "Boost!" ));
>>
>>
>>
>> Get rid of the new operator, though. IMO there's no excuse for a GUI
>> framework to expose users to unmanaged resources.
>
>
> Hmm, do you know of a C++ GUI framework that gets this right?
>
> Just curious
There is also the issue of dynamically creating the GUI. If you create a
docking/floating toolbar for example, which object stores the toolbar?
The docked frame or the floating frame?
Also, what if you have a large number of GUI components? Storing them in
the frame class would just increase the size of the object to the point
where it is unusable.
Also, doing:
frame.add( gui::button( "Boost!" ));
frame.add( gui::textbox( "Hello", 25, true ));
would incur copy penalties. What if you want to share the same object
across multiple objects (e.g. the docking/floating frame) instead of
making a separate copy of it.
One solution would be to make gui::frame, gui::boost, etc. lightweight
wrappers around the actual objects. They would use the PIMPL paradigm to
store the actual object. That way, these can be easily passed around,
managing the allocated resource themselves, as well as providing the
mechanism to select native/lightweight components.
Regards,
Reece
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk