
"David Abrahams" <dave@boost-consulting.com> wrote
Reece Dunn wrote:
With Carbon, I think you just use native controls.
With Win32 GDI you roll your own controls.
I think that this is not the right approach. You should only roll your own controls when that control isn't supported by the target OS. The Win32 GDI and Win32 controls/common controls are different things.
Not different enough, IIUC. They're both subject to the same (shared) constraint on maximum number of window handles. To make a windows GUI framework scalable it must provide for that. Not every widget on the screen can afford to be an OS control or window, even when there are appropriate built-ins (consider a grid of spreadsheet cells). One approach might be to make them "ephemeral," i.e. conjure up the actual OS thingy only when you need to draw or process clicks there and then throw it away immediately or soon.
I think the usual approach (eg MS Excel) is to draw the spreadsheet grid and its contents using graphics and text on the client area 'canvas'. Typically only one cell ever has 'focus'. ( Multiple selections are in fact just rendered using graphics, so no multiple windows are required here as you cant be selecting and editing simultaneously) An edit {control ,window, component, widget} is then created at the cell with the focus , using the size of the grid cell as the window size etc. eg pretty much as you describe. This does mean that there must be a general 'sameness' between drawing graphics on the canvas and drawing a window there. Lines and colours should be simple to match and align between the two types of graphics element(dumb and active). This implies to me that graphics_element is the common abstraction , which might be one base class of a window .The same methodology should apply to any graphics element . It should be possible to transform it into an active element. As to how an element is made active, this is surely an implementation detail. regards Andy Little