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

FormCell



Inherits From: ActionCell : Cell : Object
Declared In: appkit/FormCell.h



Class Description

This class is used to implement entries in a Form.  It displays a title within itself, and allows editing only in the remaining (right-hand) portion of the Cell.

See the Form class specification for more on the use of FormCell.



Instance Variables

NXCoord titleWidth;

id titleCell;

NXCoord titleEndPoint;


titleWidth The width of the title portion; if 1, width is calculated as needed.
titleCell The Cell used to draw the title.
titleEndPoint The coordinate that separates the title from the text area.



Method Types

Initializing, copying, and freeing a FormCell
init
initTextCell:
copyFromZone:
free
Determining a FormCell's size calcCellSize:inRect:
Enabling the FormCell setEnabled:
Modifying the title setTitle:
title
setTitleFont:
titleFont
setTitleAlignment:
titleAlignment
setTitleWidth:
titleWidth:
titleWidth
Modifying graphic attributes isOpaque
Displaying drawInside:inView:
drawSelf:inView:
Managing cursor rectangles resetCursorRect:inView:
Tracking the mouse trackMouse:inRect:ofView:
Archiving read:
write:



Instance Methods

calcCellSize:inRect:
calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect

Calculates the size of the FormCell assuming it's constrained to fit within aRect.  Returns the size in theSize.



copyFromZone:
copyFromZone:(NXZone *)zone

Creates and returns a copy of the receiving FormCell instance allocated from zone.



drawInside:inView:
drawInside:(const NXRect *)cellFrame inView:controlView

Draws only the text inside the FormCell (not the bezel or the title of the FormCell).  If you create a subclass of FormCell and override drawSelf:inView:, you must implement this method as well.  Returns self.

See also:  drawSelf:inView:



drawSelf:inView:
drawSelf:(const NXRect *)cellFrame inView:controlView

Has the FormCell's title Cell drawn, then draws the editable text portion of the FormCell.  returns self.

See also:  drawInside:inView:



free
free

Frees the storage used by the FormCell and returns nil.



init
init

Initializes and returns the receiver, a new instance of FormCell, with its contents set to an empty string ("") and its title set to "Field", right-aligned.

See also:  initTextCell:



initTextCell:
initTextCell:(const char *)aString

Initializes and returns the receiver, a new instance of FormCell, with its contents set to the empty string ("") and its title set to aString.  The font for both title and text is the user's chosen system font in 12.0 point, and the text area is drawn with a bezel. This method is the designated initializer for FormCell.

See also:  init



isOpaque
(BOOL)isOpaque

Returns YES if the FormCell is opaque, NO otherwise.  If the FormCell has a title, then it's not opaque (since the title field is not opaque).

See also:  isOpaque (Cell)



read:
read:(NXTypedStream *)stream

Reads the FormCell from the typed stream stream.  Returns self.

See also:  write:



resetCursorRect:inView:
resetCursorRect:(const NXRect *)cellFrame inView:controlView

Adds a cursor rectangle to controlView (with addCursorRect:cursor:), allowing the cursor to change to an I-beam when it passes over the text portion of the FormCell.

See also:  addCursorRect:cursor: (View, Control)



setEnabled:
setEnabled:(BOOL)flag

If flag is YES, the FormCell accepts mouse clicks; if NO, it doesn't.

See also:  isEnabled (Cell)



setTitle:
setTitle:(const char *)aString

Sets the title of the FormCell to aString.

See also:  title



setTitleAlignment:
setTitleAlignment:(int)mode

Sets the alignment of the title.  mode can be one of three constants: NX_LEFTALIGNED, NX_CENTERED, or NX_RIGHTALIGNED.

See also:  titleAlignment



setTitleFont:
setTitleFont:fontObject

Sets the Font used to draw the title of the FormCell.

See also:  setFont:



setTitleWidth:
setTitleWidth:(NXCoord)width

Sets the width of the title field to width.  If width is 1, the title field's width is always calculated when needed.  Use this method only if the FormCell's title isn't going to change, or if your code always resets the title width when it resets the title.

See also:  titleWidth, titleWidth:



title
(const char *)title

Returns the title of the FormCell.

See also:  setTitle:



titleAlignment
(int)titleAlignment

Returns the alignment of the title, which will be one of the following: NX_LEFTALIGNED, NX_CENTERED, or NX_RIGHTALIGNED.

See also:  setTitleAlignment:



titleFont
titleFont

Returns the Font used to draw the title of the FormCell.

See also:  setTitleFont:



titleWidth
(NXCoord)titleWidth

If the width of the title has already been set, then that value is returned.  Otherwise, it's calculated and returned.

See also:  setTitleWidth:, titleWidth:



titleWidth:
(NXCoord)titleWidth:(const NXSize *)aSize

If the title width has been set, then it's returned.  Otherwise, the width is calculated constrained to aSizeaSize may be NULL, in which case the width is calculated without constraint.

See also:  setTitleWidth:, titleWidth:



trackMouse:inRect:ofView:
(BOOL)trackMouse:(NXEvent*)event
inRect:(const NXRect*)aRect
ofView:controlView

Causes editing to occur.  Returns YES if the mouse goes up in the FormCell, NO otherwise.

See also:  trackMouse:inRect:ofView: (TextFieldCell)



write:
write:(NXTypedStream *)stream

Writes the receiving FormCell to the typed stream stream.  Returns self.

See also:  read: