
* Alan Gutierrez <alan-boost@engrm.com> [2004-12-22 05:41]:
* Reece Dunn <msclrhd@hotmail.com> [2004-12-22 05:22]:
Hi All,
In the "thoughts on a GUI component library" thread there have been various discussions about the layout of a rectangle and come relating to CSS. Note that point and size are stable.
I personally like the CSS box model (http://www.w3.org/TR/css3-box/) which can be defined as:
struct css::box_model { rect margin; rect border; rect padding; size dimensions; // width and height // T content; };
The problem with supporting it by default is that we would need:
class component: public css::box_model; class graphics::object: public css::box_model;
This clearly violates the don't pay for what you don't need rule of C++, so for a css_block_layout, it needs to contain the box model properties and a pointer to the component/graphical object. Obviously some level of support for the CSS box model should be provided, allowing an implementation of it to be written.
I'd imagined a division class that would have the block properties. If you don't want to pay for the borders if they are not needed, and in many cases, they would be the same from division to division, could you use a reference to shared set of demenions?
This may aid in the cascading asepct of the stylesheet.
struct css::division { box_model *block; size dimensions; };
Each division is going to need it's own size, but the block properties, margin, border, padding, are likely to be common for many divisions.
Actually, now that I think about it, the css box is going to cost a lot if it has actual structures. It is going to need a to return a margin, say by inspecting the margin it was assigned, and if assigned none, return the margin that it inherited. In some cases, a division might have been explicitly assigned a border, but in most cases it will choose one based on context. -- Alan Gutierrez - alan@engrm.com