• Keine Ergebnisse gefunden

Application Kit Classes

Im Dokument NeXTstep Reference (Seite 103-110)

The class specifications for the Application Kit describe over 50 classes. The inheritance hierarchy for these classes is shown in Figure 2-2.

Application Kit Classes 2-63

Figure 2-2. Application Kit Inheritance Hierarchy

2-64 Chapter 2: Class Specifications

ActionCell

INHERITS FROM Cell: Object

DECLARED IN appkit/ ActionCell.h

CLASS DESCRIPTION

An ActionCell defines the active area inside a control (an instance of Control or one of its subclasses). You can set an ActionCell's control only by sending the

drawS elf: in View: message to the ActionCell, passing the control as the second argument.

A single control may have more than one ActionCell. An integer tag, provided as the instance variable tag, is used to identify an ActionCell object; this is of particular importance to controls that contain more than one ActionCell. Note, however, that no checking is done by the ActionCell object itself to ensure that the tag is unique. See the Matrix class for an example of a subclass of Control that contains multiple ActionCells.

ActionCell defines the target and action instance variables and methods for setting them. These define the ActionCell's target object and action method. As the user manipulates a control, ActionCell's trackMouse:inRect: ofView: method (inherited from Cell) sends the action message to the target object with the id of the Control object as the only argument.

Many of the methods that define the contents and look of an ActionCell, such as setFont: and setBordered:, are reimplementations of methods inherited from Cell.

They're subclassed to ensure that the ActionCell is redisplayed if it's currently in a control.

INSTANCE VARIABLES Inherited from Object Inherited from Cell

Declared in ActionCell

tag

struct _cFlags 1 struct _cFlags2

Reference number for the object.

The object's notification target.

The message to send to the target.

Application Kit Classes: ActionCell 2-65

METHOD TYPES

Configuring the ActionCell - setAlignment:

- setBezeled:

- setBordered:

- setEnabled:

- setFloatingPointFormat:left:right:

- setFont:

- setIcon:

Manipulating ActionCell values - double Value - float Value - intValue - setStringValue:

- setString ValueNoCopy:shouldFree:

- stringValue

Displaying - control View

- drawSelf:in View:

Target and action - action

- setAction:

- setTarget:

- target

Assigning a tag - setTag:

-tag

Archiving -read:

- write:

INSTANCE METHODS

action

- (SEL)action

Returns the selector for the receiver's action method. Keep in mind that the argument to an ActionCell's action method is the object's Control (the object returned by controIView).

See also: - setAction:

2-66 Chapter 2: Class Specifications

control View - control View

Returns the Control object in which the receiver was most recently drawn. In general, you should use the object returned by this method only to (indirectly) redisplay the receiver. For example, the subclasses of ActionCell defined by the Application Kit invoke this method in order to send the returned object a message such as

updateCelllnside: .

The Control in which an ActionCell is drawn is set through the drawSelf:in View:

method (only).

See also: - drawSelf:in View:

double Value

- (double )double Value

Returns the receiver's contents as a double.

See also: - setDoubleValue:(Cell), - doubleValue (Cell)

drawS elf: in View:

- drawSelf:(const NXRect *)ceIlFrame inView:controlView Displays the ActionCell by sending

[super drawSelf:cellFrame inView:controlView];

Sets the receiver's Control (the controlView instance variable) to controlView if and only if controlView is a Control object (in other words, an instance of Control or a subclass thereof).

See also: - drawS elf: in View: (Cell)

floatValue

- (float)floatValue

Returns the receiver's contents as a float.

See also: - setFloatValue:(Cell), - floatValue (Cell)

Application Kit Classes: ActioriCell 2-67

intValue

- (int)intValue

Returns the receiver's contents as an int.

See also: - setIntValue:(Cell), - intValue (Cell)

read:

- read:(NXTypedStream *)stream

Reads and returns an object of class ActionCell from stream.

setAction:

- setAction: (SEL )aSelector

Sets the receiver's action method to aSelector. Keep in mind that the argument to an ActionCell's action method is the object's Control (the object returned by

controIView). Returns self.

See also: - setTarget:, - sendAction:to: (Control)

setAlignment:

- setAlignment:(int)mode

If the receiver is a text Cell (type NX_TEXTCELL), this sets its text alignment to mode, which should be NXLEFTALIGNED, NX_CENTERED, or NX_RIGHTALIGNED.

If it's currently in a Control view, the receiver is redisplayed. Returns self.

setBezeled:

- setBezeled:(BOOL)jlag

Adds or removes the receiver's bezel, asflag is YES or NO. Adding a bezel will remove the receiver's (flat) border, if any. If it's currently in a Control view, the receiver is redisplayed. Returns self.

See also: - setBordered:

setBordered:

- setBordered:(BOOL )flag

Adds or removes the receiver's border, asflag is YES or NO. The border is black and has a width of 1.0. Adding a border will remove the receiver's bezel, if any. If it's currently in a Control view, the receiver is redisplayed. Returns self.

See also: - setBezeled:

2-68 Chapter 2: Class Specifications

setEnabled:

- setEnabled:(BOOL)jlag

Enables or disables the receiver's ability to receive mouse events asjlag is YES or NO.

If it's currently in a Control view, the receiver is redisplayed. Returns self.

setFloatingPointFormat: left: right:

- setFloatingPointFormat: (BOOL )autoRange left: (unsigned int ) leftDig its

right:(unsigned int)rightDigits

Sets the receiver's floating point format. If it's currently in a Control view, the receiver is redisplayed. Returns self.

See also: - setFloatingPointFormat:left:right: (Cell)

setFont:

- setFont:fontObJ

If the receiver is a text Cell (type NX_TEXTCELL), this sets its font to fontObJ. In addition, if it's currently in a Control view, the receiver is redisplayed. Returns self.

setIcon:

- setlcon:(const char *)iconName

Sets the receiver's icon to iconName and sets its Cell type to NX_ICONCELL. If it's currently in a Control view, the receiver is redisplayed. Returns self.

See also: - setlcon: (Cell)

setStringValue:

- setStringValue:(const char *)aString

Sets the receiver's contents to a copy of aString. If it's currently in a Control view, the receiver is redisplayed. Returns self.

See also: - setStringValue: (Cell)

Application Kit Classes: ActionCeli 2-69

Im Dokument NeXTstep Reference (Seite 103-110)