From: Sean P. <sp...@ad...> - 2005-04-01 08:01:00
|
On Mar 31, 2005, at 8:30 AM, David Catmull wrote: > > In Interface Builder I can place a control a lot closer to the edge > than where these are getting clipped - and it still looks good in IB's > Carbon Simulator, which I assume is a valid test - so I'm not sure > where the clipping comes from. The clipping is happening because of the panels and outsets not being handled correctly. This seems to be a common point of breakage so I'll describe it here (and find a good place for it in the docs soon). The idea with the outsets for a widget is that they describe the visual area beyond the visual alignment box that the widget hangs. This space is for parts of the control that should hang into white space. Examples include: drop shadows on buttons the part of the check on a check box that sticks above the box the thin edge on the left side of a radio button (and right side if it has no label) to optically align it (the same way a letter "O" will hang a little into the margin in an app with good typography). The white space around a control that the OS imposes So the width and hight of the control should be the "tight visual bounds" - and the outset goes beyond that. Right now outsets are used for two purposes: To adjust panels so that they are big enough to hold their complete contents to correctly hide/show without clipping or shearing. To warn (currently with a rather hostile assert) when visual elements collide. A big problem seems to be how the first of these is handled - what currently happens is that when an outset of something in a container with no visual edge goes over the edge of the container, the outset of the container is increased to contain it. This means that containers with non-visible edges (such as a panel) need to compensate. This is done by growing the bounds to include the offset, adjusting the position (if the offset is on the top or left side), and, if the view system is hierarchical, adjusting the origin so 0,0 is in the same place as it would have been prior to adjusting the position. Right now, Eve in our example app is running flat (and the client code is adjusting the hierarchies of HI views). For most widgets you want to do the same steps as above to compensate for the outset except for adjusting the origin. The way the example code is written, adjusting the origin correctly is a pain - we should be running with Eve in hierarchical mode. I was considering when I started this e-mail changing Eve so that it would simply expand out the side of a panel rather than expanding the outset. The problem with this solution is it will fail for containers with some visual edges (consider a container with a divider line on the top - you don't want the line to grow some odd number of pixels on the left or right side to match the outsets of the content). So I don't have a better way to handle this - but hopefully this helps get the example code cleaned up. Sean |