home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright (c) 1996, NeXT Software, Inc.
- All rights reserved.
-
- You may freely copy, distribute and reuse the code in this example.
- NeXT disclaims any warranty of any kind, expressed or implied,
- as to its fitness for any particular use.
- */
- // The EOPopUpAssociation binds item list and seleted item in a NSPopUpButton to
- // a pair of DisplayGroups.
- //
- // Bindings:
- // titles: property of the EOs in the DisplayGroup containing
- // the title for an item in the PopUp list.
- // If not bound, the title list already in the popup is undisturbed.
- // selectedTitle: string property of the EO containing the title to select in the popup.
- // When the popup selection changes, the title of the new selection
- // is assigned to this property.
- // selectedTag: int property of the EO containing the tag to select in the popup.
- // When the popup selection changes, the tag of the new selection
- // is assigned to this property. This might be useful for localization
- // purposes. Titles will be usually set in interface.If the tag was not
- // found and _tagValueForOther is defined the corresponding item will
- // be selected.
- // selectedObject: relationship property of the EO containing the EO to select
- // from the titles display group. selectedObject is usually
- // mutually exclusive with selectedTitle.
- // enabled: BOOL property of EO indicating whether control should be enabled.
- //
- // Example uses:
- // Selecting a string from a static list:
- // Say I have a DisplayGroup of Movies and I want to provide a PopUp for setting
- // the rating. Assume the rating is a string propery of the Movie object rather
- // than a relationship to a Rating EO. In this case I can type the list of ratings
- // into the popup in IB, and then bind the selectedTitle to the "rating" property
- // of the "Movie" Display group. If the database property contains instead an
- // integer enumeration, selectedTag can be used, with appropriate tags assigned
- // to the cells of the popup.
- // Selecting a string from a dynamic list:
- // Like above, but I want to fill the popup from the "ratingString" property
- // of DisplayGroup contain an array of Rating objects fetched from an external
- // source. In this case I bind the titles aspect to the "ratingString" property
- // of the "Ratings" Display group, and bind the selectedTitle to the "rating" property
- // of the "Movie" Display group.
- // Selecting an EO to assign to a to-one relationship:
- // Say I have a list of employees and want to assign what department each employee
- // belongs to. In terms of the object model, I want to assign a Department EO to
- // the "department" property of and Employee EO. In this case I bind "titles" to
- // the "name" property of a "Department" DisplayGroup, and bind "selectedObject"
- // to the "department" relationship property of the "Employee" DisplayGroup.
- //
- #import <EOInterface/EOInterface.h>
-
- @interface InsertionPopUpAssociation : EOAssociation
- {
- BOOL _addedTempItem;
- int _tagValueForOther;
- BOOL _autoInsertsObject;
- }
- - (void)setTagValueForOther:(int)newValue;
- - (int)tagValueForOther;
- // indicates the tag value of the cell to select when the selectedTag or selectedTitle
- // of the current EO does not match any of the popup cells.
- // By default, -1 is used. If no matching cell is found, the last one is used.
-
- - (void)setAutomaticallyInsertsObject:(BOOL)yn;
- - (BOOL)automaticallyInsertsObject;
- // indicates that the "other" state should be used to indicate no object
- // selected in the selectedTitle, selectedTag, or selectedObject aspect.
- // When the user moves from "other" to a different item, an new object is
- // automatically inserted in the display group.
-
- @end
-