Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2003-07-28 08:15:31


I'm using a library I developed here at work which I developed with the
goals of

1) hiding MFC
2) eliminating the repetitious and tedious nature of positioning and
manipulating various controls.

My library is far from boost ready (as it depends on other libraries of
mine and is only implemented for windows). It is greatly influenced by
Spirit.

The first phase of this was for the library to be able to position
controls:

    boost::function<void,CRect> positioner =
        row( edit_1, combo_1, column( edit_2, some_static_text));

Where positioner would position the controls inside the rectangle passed
to it. A control is positioned based on the fact that different types
of controls have preferred minimum and maximum (or no maximum) sizes. A
static text item, for instance has minimum and maximum equal to the
amount of space required to display its text, while a single line edit
box requires a fixed amount of vertical space, but could grow to any
size horizontally.

Next, I changed the library so the returned object could automate other
tasks besides position such as the two-phase construction create call (a
windows anomaly I hope) and setting various callbacks (such as change
notification).

At this point a few tedious tasks are maintained, but the programmer
still has to maintain (or own) the various gui objects. It was easiest
to get rid of managing static text objects since there is no data to
exchange with them:

    gui_manager gui =
        row( edit_1, combo_1, column( edit_2, "some static text"));

Completely getting rid of the static controls was pretty exciting. In
the above code a static text GUI object with the text "some static text"
is created automatically.

It wasn't a great leap to progress further to:

    typedef boost::mpl::vector_c<char,
 
'0','0','0','-','0','0','0','0','0','0'>
            ssn_mask;

    gui_manager<employee> gui =

        column( row("ssn: ", masked_edit<ssn_mask>(&employee::ssn),

                row("job", combo(make_job_code_map(),
&employee::job_code)),

                column("name: ", edit(&employee::name)));

    employee e = get_employee();

    gui.set(e);

    gui.set_on_change(some_function);

Does this seem like the right direction to take? At the very least it
has reduced screens that took over 500 lines of code for us down to
about 30.

-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of E. Gladyshev
Sent: Friday, July 25, 2003 12:11 PM
To: boost_at_[hidden]
Subject: [boost] GUI/GDI template library

I was thinking about designing a GUI/GDI template
library.

The main ideas are:
1. Create a portable template abstraction for standard
GUI/GDI elements and dialog boxes.
2. Design an "iterator-like" interface.
3. The most important goal is design a natural
connection between STL containers and GUI elements, so
that STL data can be easily presented in the GUI
environment.

For example
template < typename IT, typename PhysicalGuiLayer >
class ListControl
{
public:
        template < typename Filter, typename Format >
        void push_back( IT& FirstIt,
                        IT& EndIt,
                        Filter& filter,
                        Format& format )
        {
                for( IT it = FirstIt; it < EndIt; ++it )
                {
                        if( filter(it) )
                        {
                                PhysicalGuiLayer::list_add_item(
                                        m_hnd,
                                        format.get_list_item(it)
                                );
                        }
                }
        }
};

Does something similar exist already?
It seems like a challenging project. If anybody is
interested, let me know.

Eugene

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk