|
Boost : |
From: John Torjo (john.lists_at_[hidden])
Date: 2004-12-15 03:12:21
> The first thing that comes to mind when reading "data that is associated
> with the component" is data binding. I think it is a mistake to build
What do you mean by this? Could you give an example?
> The majority of the current proposals (mine included) have taken the
> approach of providing native interoperability with the OS-specific data
> structures. This is very difficult to maintain properly and support
> generic code because of the different names of the data elements, types
> used (long or float) and whether an area is (position + size) or
> (top-left + bottom-right). Also, most OSs have (0,0) being the top-left
> corner, but MacOS has (0,0) being bottom-left.
>
> With this in mind, I have taken a drastic approach: do not provide
> native interoperability for size, position and area. I have designed
> them as:
>
> struct position{ float x; float y; };
> struct size{ float dx; float dy; };
> struct area
> {
> float top; float left;
> float width; float height;
> };
>
> This means that the interface must convert these to the native
> representations and vise versa.
>
I would say that this is the correct approach.
As a side-node, I'm moderately against having float coordinates. Why
would you think int is not enough?
Best,
John
-- John Torjo, Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -- http://www.torjo.com/cb/ - Click, Build, Run!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk