Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

View Additions


Category Of: View
Declared In: apps/InterfaceBuilder.h



Category Description

Interface Builder adds these two methods to the definition of the View class so that a View that's dragged from the Palette window can control its size and make other adjustments as a consequence of resizing.  As the user begins to drag one of the View's control points, Interface Builder sends it a getMinSize:MaxSize:from: message.  When the user releases the mouse button, the View receives a placeView: message.



Instance Methods

getMinSize:maxSize:from:
getMinSize:(NXSize *)minSize maxSize:(NXSize *)maxSize from:(int)where

Implement this method to control the minimum and maximum dimensions of your View.  Place the dimensions you choose in the structures referred to by minSize and maxSize.

The where argument specifies which control point the user is dragging to resize the object.  It can have these values:

IB_BOTTOMLEFT
IB_MIDDLELEFT
IB_TOPLEFT
IB_MIDDLETOP
IB_TOPRIGHT
IB_MIDDLERIGHT
IB_BOTTOMRIGHT
IB_MIDDLEBOTTOM

You can use the where argument to determine how the View will resize.  For example, a Box determines which control point it being dragged and then lets the user shrink its size from that point only to the degree that no subview (Button, TextField) would be obscured.



placeView:
placeView:(NXRect *)frameRect

Notifies a View of a change in its frame size.  Interface Builder's implementation of this method is to send a setFrame: message to the receiver, using frameRect as the argument.

You can implement this method, for example, to resize the View's subviews.  In your implementation, you should also send a setFrame: message to self to set the View's new size.