Boost logo

Boost :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2004-03-04 11:18:48


David Turner wrote:
> window w("Test");
> button b = w.spawn("button");
> b.label("Click me");
> w.contain(b);

Excuse me butting in, but this is redundant information:
  // b belongs to w
  button b = w.spawn("button");
  // b belongs to w
  w.contain(b);

It seems to me that you're trying to fit two concepts into one box,
the widget and its properties. All this jumping through hoops occurs
because you're trying to manipulate a "widget that must belong to a
window" when in actual fact you're interested only in its properties:

  button_properties bp;
  bp.label("Click me");
  bp.size(10,10);
  bp.foreground_color(red);

  window w;
  w.add_widget(bp);

Persumably, therefore, the button_widget's constructor would be
  struct button_widget {
    button_widget(window const &, button_properties const &);
  };

Regards,
Angus


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