Copyright ã1998 by Robert Frank  All Rights Reserved.

NS_DEV_DOCFOR:objc_class:Text;,NIProperty

Inherits From:	Object

Conforms To:	

Declared In:	NIProperty.h

Class Description

The NIProperry class defines an object that manages the connection between a GUI item and a NetInfo entry. NIProperry objects are used by the specific property classes.  Your application inherits these uses of the NIProperty class when it incorporates any of the specific objects into its source. You rarely have to subclass this class directly. This class uses the structures defined in netinfo/ni.h.

Many of the NIProperty subcasses have a textField object as part of the GUI. This item does not actually have to be a textField element, it can be any object capable of responding to the following methods:

	- selectText:sender;	(NIBrowserProperty only)

Class Variables

None accessable from other units.

Instance Variables

id delegate;
const char *name;
ni_proplist *properties;
int tag;
int setMode;
const char *path;
const char *title;
BOOL changed;

delegate 	The object that's notified when the NIProperty object modifies a NetInfo entry.
name	The  (property) name of the NetInfo entry.
properties	A pointer to the property list.

tag 	The integer that the delegate uses to identify the NIProperty object.

setMode 	Determines the kind of panel to show for selecting existing values. (c.f. NIDirectory NIPT_ values.)

path 	The path or directory to use for the panels.

title 	The title to be displayed in the panels.

Method Types

Initializing the NIProperty object	+ init:

Initializing a new NIPropery object	- init:properties:name:

Freeing a NIPropery object	- free

Transfering to GUI	- display

Modifying the value list	- deleteValue: 
- findValue:how:
- insertValue: 
- insertValue:at: 
- removeValues
- updateValue:at: 
- valueAt:
- valueList
- values 

The property name	- name

The property's index	- index:

Assigning a tag	- setTag: 
- tag

Assigning a delegate	- setDelegate:
- delegate

Class Methods

NS_DEV_DOCFOR:objc_method:[Text-excludeFromServicesMenu:];,init:

+ init:strngs

Sets the class variable strings.  Returns strngs.

Instance Methods

NS_DEV_DOCFOR:objc_method:[Text-delegate];,delegate

- delegate

Returns the NIProperty object's delegate.

See also:  - setDelegate:

NS_DEV_DOCFOR:objc_method:[Text-getDefaultFont];,deleteValue:

- deleteValue:(int)idx

Deletes the value at index idx, if any. If this was the only value of the property, the entire property is removed. Any corresponding GUI element is not updated. Sends a propertyDidChange to the delegate with a value of NULL.

Returns self.

See also:  - removeValues

NS_DEV_DOCFOR:objc_method:[Text-getLocation:ofCell:];,display

- display

This method does nothing. It is meant to be overridden in the item specific methods.

Returns self.

NS_DEV_DOCFOR:objc_method:[Text-getLocation:ofCell:];,findValue:how:

- (int)findValue:(const char *)value how:(BOOL)mode

Returns the index of the entry value or NI_VALUE_NOT_FOUND if it is not found. How defines the kind of matching operation: NI_FIND_EXACT for an exact match of value or NI_FIND_REGEX for a regular expresion of value.

NS_DEV_DOCFOR:objc_method:[Text-free];,free

- free

Releases the storage for a NIProperty object.

NS_DEV_DOCFOR:objc_method:[Text-initFrame:];,index

- (int)index

Returns the index of this property within the NetInfo property list if such an entry exists or NI_INDEX_NULL if no NetInfo entry exists.

NS_DEV_DOCFOR:objc_method:[Text-initFrame:text:alignment:];,init:properties:name:

- init:sender
properties:(ni_proplist *)props
name:(const char *)label

Initializes a new NIProperty object.  This is the designated initializer for NIProperty objects:  If you subclass NIProperty, your subclass's designated initializer must maintain the initializer chain by sending a message to super to invoke this method.  See the introduction to the class specifications for more information.

The three arguments specify the delegate (sender) to which the propertyWillChange and propertyDidChange methods will be sent, the property list as read from NetInfo, and the string containing the name of the NetInfo entry. Init will initialize tag to -1, index to NI_INDEX_NULL and changed toNO.

Returns self.

NS_DEV_DOCFOR:objc_method:[Text-initFrame:];,insertValue:

- insertValue:(const char *)value

Inserts the value value to the end of the list, creating the property if neccessary. Any corresponding GUI element is not updated. Sends a propertyDidChange to the delegate with a value of value.

Returns self.

NS_DEV_DOCFOR:objc_method:[Text-initFrame:];,insertValue:at:

- insertValue:(const char *)value at:(int)idx

Inserts the value value at the position idx, creating the property if neccessary. Any corresponding GUI element is not updated. Sends a propertyDidChange to the delegate with a value of value.

Returns self.

NS_DEV_DOCFOR:objc_method:[Text-moveTo::];,name

- (const char *)name

Returns the name of the property.

See also:  - init:properties:name:

NS_DEV_DOCFOR:objc_method:[Text-setDelegate:];,removeValues

- removeValues

Removes all values of the property. Any corresponding GUI element is not updated.  Sends a propertyDidChange to the delegate with a value of NULL.

Returns self.

See also:  - deleteValue:

NS_DEV_DOCFOR:objc_method:[Text-setDelegate:];,setDelegate:

- setDelegate:anObject

Sets the NIProperty object's delegate.  In response to value changes, the NIProperty object can send the delegate any of several notification messages.  See the introduction to this class specification for more information. 

Returns self.

See also:  - delegate

NS_DEV_DOCFOR:objc_method:[Text-setTag:];,setTag:

- setTag:(int)anInt

Sets the NIProperty object's tag value to anInt.

Returns self.

See also:  - tag

NS_DEV_DOCFOR:objc_method:[Text-tag];,tag

- (int)tag

Returns the NIProperty object's tag.

See also:  - setTag:

NS_DEV_DOCFOR:objc_method:[Text-windowChanged:];,updateValue:at:

- updateValue:(const char *)value at:(int)idx

Updates the value at index idx. If the property did not exist, it is created. If value is NULL, the value is deleted from the list of values. If this results in an empty list, the property is removed. Any corresponding GUI element is not updated.  Sends a propertyDidChange to the delegate with a value of NULL and another propertyDidChange with the value if this was not NULL.

Returns self.

NS_DEV_DOCFOR:objc_method:[Text-getDefaultFont];,valueAt

- (const char *)valueAt:(int)idx

Returns the value at index idx within the list of values or the empty string if the index is out of range or the list is empty.

NS_DEV_DOCFOR:objc_method:[Text-windowChanged:];,valueList

- (ni_namelist *)valueList

Returns a pointer to the list of values associated with this property. This list should never be modified directly!

See also:  - values

NS_DEV_DOCFOR:objc_method:[Text-initialize];,values

- (int)values

Returns the number of values in the list or 0 if no entries.

See also:  - valueList

Methods Implemented by the Delegate

NS_DEV_DOCFOR:objc_method:[Text-textDidChange:];,propertyDidChange:value:

- propertyDidChange:sender value:(const char *)string

Responds to a message sent to the delegate after any change to the property's values.  The delegate receives a propertyWillChange: message immediately before receiving a propertyDidChange: message. The value which was copied to or removed from the value list is passed in string. A string value of NULL signals a change of a textfield value which has not yet been validated.

NS_DEV_DOCFOR:objc_method:[Text-textWillChange:];,propertyWillChange:value:default:index:

- (BOOL)propertyWillChange:sender value:(const char *)string default:(BOOL *)remove index:(int)anInt

Responds to a message sent upon any change of a property's value.  The delegate's propertyWillChange:value:default:index method can prevent the value from being changed by returning YES.  If the delegate allows the change, it immediately receives a propertyDidChange:value: message after the change is made.  If the delegate doesn't implement this method, the change is allowed by default.

String is a pointer to a copy of the new value or NULL, indicating the default value. This string can be reallocated  or freed in the [NXApp zone] zone. The memory will be freed after returning from the call. The index passed in anInt is the index into the property's value list. A value of NI_VALUE_NOT_FOUND indecates no previous value or property. If remove is true, the first value will be removed. If the value list becomes empty, the entire property will be removed.