home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / InsertionPopUpAssociation.h < prev    next >
Encoding:
Text File  |  1996-08-23  |  3.9 KB  |  74 lines

  1. /*
  2.         Copyright (c) 1996, NeXT Software, Inc.
  3.         All rights reserved.
  4.  
  5.         You may freely copy, distribute and reuse the code in this example.
  6.         NeXT disclaims any warranty of any kind, expressed or implied,
  7.         as to its fitness for any particular use.
  8. */
  9. // The EOPopUpAssociation binds item list and seleted item in a NSPopUpButton to
  10. // a pair of DisplayGroups.
  11. //
  12. // Bindings:
  13. //     titles:          property of the EOs in the DisplayGroup containing
  14. //                      the title for an item in the PopUp list.
  15. //                      If not bound, the title list already in the popup is undisturbed.
  16. //     selectedTitle:   string property of the EO containing the title to select in the popup.
  17. //                      When the popup selection changes, the title of the new selection
  18. //                      is assigned to this property.
  19. //     selectedTag:     int property of the EO containing the tag to select in the popup.
  20. //                      When the popup selection changes, the tag of the new selection
  21. //                      is assigned to this property. This might be useful for localization
  22. //            purposes. Titles will be usually set in interface.If the tag was not
  23. //            found and _tagValueForOther is defined the corresponding item will
  24. //            be selected.
  25. //     selectedObject:  relationship property of the EO containing the EO to select
  26. //                      from the titles display group.  selectedObject is usually
  27. //                      mutually exclusive with selectedTitle.
  28. //     enabled:         BOOL property of EO indicating whether control should be enabled.
  29. //
  30. // Example uses:
  31. //  Selecting a string from a static list:
  32. //    Say I have a DisplayGroup of Movies and I want to provide a PopUp for setting
  33. //    the rating.  Assume the rating is a string propery of the Movie object rather
  34. //    than a relationship to a Rating EO.  In this case I can type the list of ratings
  35. //    into the popup in IB, and then bind the selectedTitle to the "rating" property
  36. //    of the "Movie" Display group.  If the database property contains instead an
  37. //    integer enumeration, selectedTag can be used, with appropriate tags assigned
  38. //    to the cells of the popup.
  39. //  Selecting a string from a dynamic list:
  40. //    Like above, but I want to fill the popup from the "ratingString" property
  41. //    of DisplayGroup contain an array of Rating objects fetched from an external
  42. //    source.  In this case I bind the titles aspect to the "ratingString" property
  43. //    of the "Ratings" Display group, and bind the selectedTitle to the "rating" property
  44. //    of the "Movie" Display group.
  45. //  Selecting an EO to assign to a to-one relationship:
  46. //   Say I have a list of employees and want to assign what department each employee
  47. //   belongs to.  In terms of the object model, I want to assign a Department EO to
  48. //   the "department" property of and Employee EO.  In this case I bind "titles" to
  49. //   the "name" property of a "Department" DisplayGroup, and bind "selectedObject"
  50. //   to the "department" relationship property of the "Employee" DisplayGroup.
  51. //
  52. #import <EOInterface/EOInterface.h>
  53.  
  54. @interface InsertionPopUpAssociation : EOAssociation
  55. {
  56.     BOOL _addedTempItem;
  57.     int _tagValueForOther;
  58.     BOOL _autoInsertsObject;
  59. }
  60. - (void)setTagValueForOther:(int)newValue;
  61. - (int)tagValueForOther;
  62.     // indicates the tag value of the cell to select when the selectedTag or selectedTitle
  63.     // of the current EO does not match any of the popup cells.
  64.     // By default, -1 is used.  If no matching cell is found, the last one is used.
  65.  
  66. - (void)setAutomaticallyInsertsObject:(BOOL)yn;
  67. - (BOOL)automaticallyInsertsObject;
  68.     // indicates that the "other" state should be used to indicate no object
  69.     // selected in the selectedTitle, selectedTag, or selectedObject aspect.
  70.     // When the user moves from "other" to a different item, an new object is
  71.     // automatically inserted in the display group.
  72.  
  73. @end
  74.