Boost logo

Boost :

Subject: Re: [boost] Thoughts for a GUI (Primitives) Library
From: Alec Chapman (archapm_at_[hidden])
Date: 2010-09-09 20:52:29


Matus Chochlik wrote:
> The Mirror reflection library (http://bit.ly/bn7iYM), does something similar
> for input dialogs for constructing new instances of nested types with possibly
> multiple constructors. Look for the factory generator utility in the docs. Here
> (http://bit.ly/bqNqah) can also be found some images of gui dialogs
> automatically generated by this lib.

That looks interesting. Without having looked at the code, my main question is how closely is the dialog rendering tied to the reflection mechanism? If I'm using a class from a library that I can't modify, is there a way to make it provide the information your library needs? If so, it could be a useful starting point.

Yakov Galka wrote:
> Yes, I'm interested. Also please explain how the above approach will be
> customizable (e.g. I want to put a spin-control or a textbox for my float
> property and add data validation rules).

My thought was that it in the property map syntax it could be passed as an additional template parameter:

typedef
    property<var1_t, int, // regular textbox
    property<var2_t, int, spinner
> > some_type;

In the more general method it would look like:

struct some_type { int var1, var2 };

template <>
view default_view(some_type& t)
{
    view v;
    v << t.var1 << spinner(t.var2);
}

The library would access the data through get()/put() functions. The user provides these, and put() can do validation and throw if there's a problem. I'm not sure if this is completely consistent with everything I've written so far, but I think it could be with some work. I'm a bit tied up for a couple weeks, but after that I could try to put a demo together that would illustrate these ideas more concretely.


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