• Keine Ergebnisse gefunden

trackMouse:inRect:oNiew:

Im Dokument Oriented Software (Seite 184-191)

- (BOOL)trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)cellFrame ofView:controlView

Tracks the mouse by starting the Sound (if any) and sending trackMouse:inRect:ofView to super with the same arguments. When super's method returns, stops the Sound if needed and returns YES if the mouse Button went up with the cursor in the cell, NO otherwise. This method returns if the cursor leaves the bounds of the ButtonCell.

See also: - trackMouse:inRect:ofView: (Cell)

write:

- write:(NXTypedStream *)stream

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

See also: - read:

Cell

Inherits From: Object Declared In: appkitiCell.h

Class Description

The Cell class provides a mechanism for displaying text or icons (that is, named NXImages) in a View without the overhead of a full View subclass. In particular, it provides much of the functionality of the Text class by providing access to a shared Text object used by all instances of Cell in an Application. Cells are also extremely useful for placing titles or icons at various locations in a custom subclass of View.

Cell is used heavily by the Control classes to implement their internal workings. Some subclasses of Control (notably Matrix) allow multiple Cells to be grouped and to act together in some cooperative manner. Thus, with a Matrix, a group of radio buttons can be implemented without needing a View for each button (and without needing a Text object for the text on each button).

The Cell class provides primitives for displaying text or an. icon, editing text, formatting floating point numbers, maintaining state, highlighting, and tracking the mouse. It has several subclasses: SelectionCell, NXBrowserCell, and ActionCell (which in tum has the subclasses ButtonCell, SliderCell, TextFieldCell, and FormCell). Cell's

trackMouse:inRect:ofView: method supports the target object and action method used to implement controls. However, Cell implements targetlaction features abstractly, deferring the details of implementation to subclasses of ActionCell.

The initlconCell: method is the designated initializer for Cells that display icons. The initTextCell: method is the designated initializer for Cells that display text. Override one or both of these methods if you implement a subclass of Cell that performs its own initialization. If you need to use target and action behavior, you may prefer to override ActionCell, which provides the default implementation of this behavior.

For more information on how Cell is used, see the Control class specification.

Instance Variables

char *contents;

id support;

struct _cFlagsl {

unsigned int state: 1;

unsigned int highlighted: 1;

unsigned int disabled: 1 ; unsigned int editable: 1;

unsigned int type:2;

unsigned int freeText: 1 ; unsigned int alignment:2;

unsigned int bordered: 1;

unsigned int bezeled: 1 ; unsigned int selectable: 1;

unsigned int scrollable: 1;

unsigned int entryType:3;

} cFlagsl;

struct _cFlags2 {

unsigned int continuous: 1;

unsigned int actOnMouseDown: 1;

unsigned int floatLeft:4;

unsigned int floatRight:4;

unsigned int auto Range: 1 ;

unsigned int actOnMouseDragged: 1;

unsigned int no Wrap: 1;

unsigned int dontActOnMouseUp: 1;

} cFlags2;

The string for a text Cell; the image name for an icon Cell.

The Font for a text Cell; the NXImage for an icon Cell.

The state of the Cell (0 or 1).

cFlags l.freeText

True if the Cell is highlighted.

True if the Cell is disabled.

True if the text in the Cell is editable.

The type of the Cell.

True if the Cell should free contents when freeing the Cell.

cFlags l.alignment

The text alignment of the Cell.

True if the Cell has a solid border.

True if the Cell has a bezeled border.

True if the text is selectable.

True if the text is scrollable.

Data type accepted when the user types in a text Cell.

True if the Cell sends its action continuously to target while control is active.

True if the Cell sends its action on a mouse-down.

Digits to left of decimal when text is floating-point number.

Digits to right of decimal when text is floating-point number.

True if the Cell autoranges decimal places when text is floating point number.

True if the Cell sends its action every time the mouse changes position.

True if the Cell wraps text by character, false if by word.

True if the Cell does not send its action on a mouse-up event.

Initializing, copying, and freeing a Cell - init

- initIconCell:

- initTextCell:

- copyFromZone:

-free

Determining component sizes - calcCellSize:

- calcCellSize:inRect:

- calcDrawInfo:

- getDrawRect:

- getIconRect:

- getTitleRect:

Setting the Cell's type - setType:

-type Setting the Cell's state - setState:

- incrementS tate - state

Enabling and disabling the Cell - setEnabled:

- isEnabled Setting the icon

Setting the Cell's value

Interacting with other Cells

Modifying text attributes

.:... takeDouble ValueFrom:

- takeFloatValueFrom:

- edit: in View: editor:delegate: event:

- endEditing:

- select:in View: editor: deleg£lte: start: length:

Validating input - setEntryType:

- entryType

- isEntry Acceptable:

Formatting data - setFloatingPointFormatleftright Modifying graphic attributes - setBezeled:

- isBezeled - setBordered:

- isBordered -isOpaque Setting parameters - setParameter:to:

- getParameter:

Displaying - controlView

- drawlnside:inView:

- drawSelf:in View:

- highlight: in View: lit - isHighlighted Target and action - setAction:

- action

Handling keyboard alternatives - keyEquivalent Tracking the mouse

Managing the cursor Archiving

+ prefersTracking UntilMouseUp - mouseDownFlags

Class Methods

prefersTrackin"gUntilMouseUp

+

(BaaL )prefersTrackingUntilMouseUp

Returns NO by default. Override this method to return YES if the Cell's View should allow it, after a mouse-down event, to track mouse-dragged and mouse-up events even if they occur outside the Cell's frame. For example, this method is overridden by SliderCell to ensure that a SliderCell in a Matrix doesn't stop responding to user input (and its neighbor start responding) just because its knob isn't dragged in a perfectly straight line.

See also: - trackMouse:inRect:ofView:

Instance Methods

action

- (SEL)action

Returns a null selector. This method is overridden by Action Cell and subclasses that actually implement a target object and action method.

See also: - setAction:, - target

alignment

- (int)alignment

Returns the alignment of text in the Cell. The return value can be one of three constants:

NX_LEFTALIGNED, NX_CENTERED, or NX_RIGHTALIGNED.

See also: - setAlignment:

awake

-awake

Used during unarchiving to initialize static variables for the Cell class. Returns self.

See also: - read:

calcCeliSize:

- calcCellSize:(NXSize *)theSize

Returns by reference the minimum width and height required for displaying the Cell. This method invokes calcCeIlSize:inRect: with the rectangle argument set to a rectangle with very large width and height. Override this method if that isn't the proper way to calculate the minimum width and height required for displaying the Cell. Returns self.

See also: - calcCellSize:inRect:

Im Dokument Oriented Software (Seite 184-191)