
window w("Test Window"); grid g(2, 2); w.contain(g); g.contain(button("Click me", on_click), 1, 1); g.contain(label("Enter your name:"), 0, 0); textentry t(); g.contain(t, 1, 0); wait_for_signal(w.delete_signal()); // note () after delete_signal
I like this syntax a lot. It's basically transparent to me as a non-GUI person, and I can easily envision how one would extend it. Three comments : 1) if a widget was capable of responding to multiple events, presumably you'd do something like this, right? g.contain(widget("do something",on_click | on_mouseover | on_mousemove),1,1); 2) textentry t; g.contain(t,1,0); is essentially equivalent to g.contain(textentry(),1,0);? 3) rather than having two arguments for grid position, how about a position class with x() and y() members or something like that? I think that would make the code more nearly model the abstraction... Your design also seems to offer a natural way to recursively nest stuff, too, which is nice : grid g2(1,3); g.contain(g2,pos(0,1)); Another possibility which would be interesting is a layer which allows the GUI to be scripted...no idea how easy or hard it would be to implement, though... ------------------------------------------------------------------------ --------------------------- Matthias Schabel, Ph.D. Utah Center for Advanced Imaging Research 729 Arapeen Drive Salt Lake City, UT 84108 801-587-9413 (work) 801-585-3592 (fax) 801-706-5760 (cell) 801-484-0811 (home) mschabel at ucair med utah edu