• Keine Ergebnisse gefunden

setPeriodicDelay:andlnterval:

Im Dokument Oriented Software (Seite 159-168)

- setPeriodicDelay:(float)delay andlnterval:(float)interval

Sets the message delay and interval for the Button. These two values are used if the Button is configured (by a setContinuous: message) to continuously send the action message to the target object while tracking the mouse. delay is the amount of time (in seconds) that a continuous Button will pause before starting to periodically send action messages to the target object. interval is the amount of time (also in seconds) between those messages.

Returns self.

The maximum value allowed for both the delay and the interval is 60.0 seconds.

See also: - getPeriodicDelay:andlnterval:, - setContinuous (Control)

setSound:

- setSound:soundObject

Sets the Sound played when the Button is pressed, and whenever the cursor re-enters the Button while tracking. Returns self.

See also: - sound

setState:

- setState:(int)anlnt

Sets the Button's state to anlnt and redraws the Button. 0 is the normal or "off' state, and any nonzero number is the alternate or "on" state. Returns self.

See also: - state

setlitle:

- setTitle:( const char *)aStrin~

Sets the title displayed by the Button when in its normal state to aString. This title is always shown on Buttons that don't use their alternate contents when highighting or displaying their alternate state. Redraws the Button's inside and returns self.

See also: - setTitleNoCopy:, - title, - setAItTitle:, - setType:

setlitleNoCopy:

- setTitleNoCopy:( const char *)aString

Similar to setTitle: but doesn't make a copy of aString. Returns self.

See also: - setTitle:

setTransparent:

- setTransparent:(BOOL)jiag

Sets whether the Button is transparent, and redraws the Button ifjiag is NO. Returns self.

A transparent Button tracks the mouse and sends its action, but doesn't draw. A transparent Button is useful for sensitizing an area on the screen so that an action gets sent to a target when the area receives a mouse click.

See also: - isTransparent

setType:

- setType:(int)aType

Sets the way the Button highlights while pressed, and how it shows its state. Redraws the Button and returns self. The types available are for the most common Button types, which are also accessible in Interface Builder; you can configure different behavior with

ButtonCell's setHighlightsBy: and setShowsStateBy: methods. aType can be one of seven constants:

NX_MOMENTARYPUSH (the default): While the Button is held down it's shown as lit, and also "pushed in" to the screen if the Button is bordered. This type of Button is best for simply triggering actions, as it doesn't show its state; it always displays its normal icon or title. This option is called "Momentary Push" in Interface Builder's Button Inspector.,

NX_MOMENTARYCHANGE: While the Button is pressed, the alternate icon or alternate title is displayed. This type always displays its normal title or icon (that is, it doesn't display its state). The miniaturize button in a window's title bar is a good example of this type of Button. This option is called "Momentary Change" in Interface Builder's Button Inspector.

NX_PUSHONPUSHOFF: Holding the Button down causes it to be shown as lit, and also "pushed in" to the screen if the Button is bordered. The Button displays itself as lit while in its alternate state. This option is called "Push On/Push Off' in Interface Builder's Button Inspector.

NX_ONOFF: Highlights while pressed by lighting, and stays lit in its alternate state.

This option is called "On/Off' in Interface Builder's Button Inspector.

NX_ TOGGLE: Highlighting is performed by changing to the alternate title or icon

"pushing in." The alternate state is shown by displaying the alternate title or icon. This option is called "Toggle" in Interface Builder's Button Inspector.

NX_SWITCH: A variant of NX_ TOGGLE that has no border, and that has a default icon called "switch" and an alternate icon called "switchH" (these are identical to the

"NXswitch" and "NXswitchH" system bitmaps). This type of Button is available as a separate palette item in Interface Builder.

NX_RADIOBUTTON: Like NX_SWITCH, but the default icon is "radio" and the alternate icon is "radioH" (identical to the "NXradio" and "NXradioH" system

bitmaps). This type of Button is available as a separate palette item in Interface Builder.

There is no constant for Interface Builder's "Momf-ntary Light" type; you can set this programmatically as follows:

[[myButton cell] setHighlightsBy:NX_CHANGEGRAY I NX_CHANGEBACKGROUND] i

[[myButton cell] setShowsStateBy:NX_NONE] i

See also: - setType: (ButtonCell), - setHighlightsBy: (ButtonCell), - setShowsStateBy: (ButtonCell)

sound

-sound

Returns the Sound played when the Button is pressed, and whenever the cursor re-enters the Button while tracking.

See also: - setSound:

state

- (int)state

Returns the Button's state, either 0 for normal or "off," or 1 for alternate or "on."

See also: - setState:

title

- (const char *)title

Returns the title displayed on the Button when it's in its normal state, or always if the Button doesn't use its alternate contents for highlighting or displaying the alternate state.

Returns NULL if there is no title.

See also: - setTitle:, - altTitle, - setType:

ButtonCel1

Inherits From: ActionCell : Cell: Object Declared In: appkitIB uttonCell.h

Class Description

ButtonCell is a subclass of ActionCell used to implement the user interface devices of push buttons, switches, and radio buttons, as well as any area of the screen that should send a message to a target when clicked. ButtonCells are used by the Button and Matrix subclasses of Control. Matrix is specifically used to hold sets of ButtonCells to create groups of switches or radio buttons.

A ButtonCell is a two-state Cell; it's either "off' or "on," and can be configured to display the two states differently, with a separate title and/or icon (named NXImage) for either state. The two states are more often referred to as "normal" and "alternate." A ButtonCell's state is also used as its value, so Cell methods that set the value (setIntValue: and so on) actually set the ButtonCell's state to "on" if the value provided is non-zero (or non-null for strings), and to "off' if the value is zero or null. Similarly, methods that retrieve the value return 1 for the "on" or alternate state (an empty string in the case of stringValue), or 0 or NULL for the "off' or normal state. Unlike Button, ButtonCell doesn't have setState: or state methods; you have to use setIntValue: or a related method.

A ButtonCell sends its action message to its target once if it's View is clicked and it gets the mouse-down event, but can also send the action message continuously as long as the mouse is held down with the cursor inside the ButtonCell. The ButtonCell can show that it's being pressed by highlighting in several ways, for example, a bordered ButtonCell can appear pushed into the screen, or the icon or title can change to an alternate form while the ButtonCell is pressed.

A ButtonCell can also have a key equivalent (like a Menu item). If the Window or Panel that the ButtonCell's View is on is the key window, then it gets the first chance to receive events related to key equivalents. This is used quite often in modal panels that have an

"OK" Button with a Return sign on them. Usually a ButtonCell displays a key equivalent as its icon; if you ever set an icon for the ButtonCell, the key equivalent remains, but doesn't get displayed.

For more information on ButtonCell's behavior, see the Button and Matrix class specifications.

Instance Variables

struct _hcFlagsl {

unsigned int pushIn: 1 ;

unsigned int changeContents: 1;

unsigned int changeBackground: 1 ; unsigned int changeGray: 1;

unsigned int lightByContents: 1;

unsigned int lightByBackground: 1;

unsigned int lightByGray: 1 ; unsigned int hasAlpha: 1 ; unsigned int bordered: 1 ; unsigned int iconOverlaps: 1 ; unsigned int horizontal: 1;

unsigned int bottomOrLeft: 1;

unsigned int iconAndText: 1;

unsigned int lastState: 1;

unsigned int iconSizeDiff: 1 ;

unsigned int iconIsKeyEquivalent: 1;

} bcFlagsl;

struct _hcFlags2 {

unsigned int key Equivalent: 8;

unsigned int transparent: 1 ; } bcFlags2;

unsigned short periodicDelay;

unsigned short periodicInterval;

altContents

icon.bmap.normal

The contents shown when the ButtonCell is in its alternate state: a string for a text ButtonCell, an NXlmage for an icon-only ButtonCell.

The icon for a ButtonCell that displays both a title and an icon.

icon.bmap.alternate The alternate icon for a ButtonCell that displays both a title and an icon.

icon.ke.font Font used to draw the key equivalent.

icon.ke.descent The descent of descenders in the key equivalent font.

sound The Sound played when the ButtonCell gets a mouse-down event.

bcFlagsI.pushln If 1, a bordered ButtonCell appears to push into the screen when pressed.

bcFlags I.changeContents If 1, the ButtonCell shows its alternate state by displaying its alternate icon and title.

bcFlags1.changeBackground If 1, the ButtonCell shows its alternate state by swapping the light gray and white pixels in its background.

bcFlags I.changeGray If 1, the ButtonCell shows its alternate state by swapping its light gray and white pixels.

bcFlags I.lightByContents If 1, the ButtonCell highlights while pressed by displaying its alternate icon and title.

bcFlags1.lightByBackground If 1, the ButtonCell highlights by swapping the light gray and white pixels in its background.

bcFlags I.lightByGray If 1, the ButtonCell shows its highlighting by swapping its light gray and white pixels.

bcFlags1.hasAlpha 1 if the ButtonCell's icon has alpha values (transparent pixels).

bcFlagsI.bordered 1 if the ButtonCell has a raised bezel border.

bcFlags I.iconOverlaps 1 if the icon overlaps the title.

bcFlags I.horizontal 1 if the icon is to one side of title.

bcFlagsI.bottomOrLeft 1 if the icon is on the left or bottom.

bcFlags I.iconAndText 1 if the ButtonCell has both an icon and a title.

bcFlagsI.lastState The state of the ButtonCell when last drawn.

bcFlags I.iconSizeDiff 1 if the alternate icon is a different size than the normal icon.

bcFlagsl.iconIsKeyEquivalent 1 if the key equivalent is drawn as the icon.

bcFlags2.keyEquivalent The key equivalent character.

bcFlags2.transparent 1 if the ButtonCell doesn't draw itself at all.

periodicDelay periodicInterval

Method Types

The delay before sending the first action message by a continuous ButtonCell.

The interval at which a continuous ButtonCell sends its action.

Initializing, copying, and freeing a ButtonCell - init

- initTextCell:

- initlconCell:

- copyFrornZone:

-free

Determining component sizes - calcCellSize:inRect:

- getDrawRect:

- getTitleRect:

- getlconRect:

Setting the titles - setTitle:

- setTitleNoCopy:

- title - setAltTitle:

- altTitle - setFont:

Setting the icons - setlcon:

-icon Setting the Sound - setSound:

Setting the state - setDouble Value:

Setting the repeat interval - setPeriodicDelay:andInterval:

- getPeriodicDelay: andInterval:

Tracking the mouse - trackMouse:inRectofView:

Setting the key equivalent - setKeyEquivalent - setKeyEquivalentFont - setKeyEquivalentFontsize:

- keyEquivalent Setting parameters - setParameter:to:

- getParameter:

Modifying graphic attributes - setBordered:

- isBordered

- highlight in View: lit - read:

- write:

Instance Methods

altlcon

- (const char *)altIcon

Returns the name of the NXImage that appears on the ButtonCell when it's in its alternate state, or NULL if there is no alternate icon or the NXImage has no name. This NXImage is displayed only for ButtonCells that highlight or show their alternate state by displaying their alternate contents (as opposed to simply lighting or pushing in).

See also: - setAltIcon:, - setIconPosition:, - altImage, - icon, - image, - setType:

altlmage

- altImage

Returns the NXImage that appears on the ButtonCell when it's in its alternate state, or nil if there is no alternate NXImage. This ButtonCell only displays its alternate NXImage if it highlights or shows its alternate state by displaying its alternate contents.

See also: - setAltImage:, - setIconPosition:, - altIcon, - image, - icon, - setType:

altlitle

- (const char *)altTitle

Returns the string that appears on the ButtonCell when it's in its alternate state, or NULL if there isn't one. The alternate title is only displayed if the ButtonCell highlights or shows its alternate state by displaying its alternate contents.

See also: - setAItTitle:, - title, - setType:

Im Dokument Oriented Software (Seite 159-168)