Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-07-28 13:49:35


> Uh. I would not recommend inheriting from STL. I
> think that template
> policies would be rather more appropriate solution:

I agree with that.

> myWindow.create_widget<mylistbox>
>(myapp::ENUM_ID_LIST_OF_ITEMS,

Just a note.
Ideally, the library won't have to deal with the
numeric control ID's. You create a widget object and
from now on you use the object's pointer/reference to
access it (no need for an ID). One exception would be
dialog boxes. Usually resource files are ID-based so
we'll probably need to use the ID's.

boost::gui::dialog<> dlg(IDD_HELLO);
boost::gui::edit* hello_edit(
dlg.get<boost::gui::edit>(IDC_EDIT_HELLO) );

Under the covers the get function would do something
like this:

template< typename T, typename ID = int >
T* dlg::get( ID id )
{
    dlg::const_iterator it;
    for( it = begin(); it < end(); ++it )
    {
        if( it->getid() == id )
            return static_cast<T*>( *it );
    }
    return NULL;
}

It'd be nice to get rid of numeric id's completely.
Any ideas?

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