home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / EOColumnAssociation.h < prev    next >
Encoding:
Text File  |  1996-09-09  |  5.5 KB  |  115 lines

  1. // EOColumnAssociation.h
  2. // Enterprise Objects Framework
  3. // Copyright (c) 1995, NeXT Software, Inc.  All rights reserved. 
  4.  
  5. #import <EOInterface/EOAssociation.h>
  6. #import <EOInterface/EODisplayGroup.h>
  7.  
  8. // The EOColumnAssociation object is the subclass of EOAssociation responsible
  9. // for making an assocation between a column of a NSTableView and a property of
  10. // all EOs in an EODisplayGroup.  The EOColumnAssociations take over
  11. // the column identifiers to point to themselves.  Furthermore, all of the
  12. // EOColumnAssociations associated with a given NSTableView must be
  13. // be bound to the same EODisplayGroup.
  14. //
  15. // EOControlAssociation Bindings:
  16. //     value:     property of the EO to be displayed in the column.
  17. //     enabled:   BOOL property of EO indicating whether cell should be enabled
  18. //
  19.  
  20. @interface EOColumnAssociation :EOAssociation
  21. {
  22.     unsigned _didChange:1;
  23.     unsigned _alreadySetObject:1;
  24.     unsigned _enabledAspectBound:1;
  25.     unsigned _unused :29;
  26.     SEL _sortingSelector;
  27. }
  28.  
  29. - (void)establishConnection;
  30.     // Activates the association after initWithObject: or initWithCoder:.
  31.     // If called for an association bound to a programmatically created
  32.     // NSTableColumn, make sure to add the TableColumn to the TableView
  33.     // *before* calling [assoc establishConnection];
  34.  
  35. - (void)setSortingSelector:(SEL)selector;
  36. - (SEL)sortingSelector;
  37.     // used if [EOTableViewAssociation setSortsByColumnOrder:YES].
  38.     // Should return sort comparison selector for values in this column
  39.     // (see EOSortOrdering.h) or nil if this column should not participate
  40.     // in the sort.  Returns EOCompareAscending by default.
  41.  
  42. // Methods forwarded on by the EOTableView association.
  43. // These should not be invoked directly.
  44. - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  45. - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  46. - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  47. - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  48. - (BOOL)control:(NSControl *)control isValidObject:(id)obj;
  49. - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)errorDescription;
  50. - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
  51. @end
  52.  
  53.  
  54. // The TableView association is the delegate and dataSource of
  55. // EOColumnAssociations and forward all per-column messages to the
  56. // column association associated with the column.
  57. // The first EOColumnAssociation to be bound automatically creates and binds
  58. // and EOTableView association.
  59. //
  60. // EOTableViewAssociation Bindings:
  61. //     source:    bind to the EODisplayGroup for the table view.
  62. //                The key for the binding is unimportant (it is not used)
  63. //     enabled:   BOOL property of EO indicating whether row should be enabled
  64. //     textColor: NSColor * property of EO indicating text color for row
  65. //     italic:    BOOL property of EO indicating whether row text should be italicized
  66. //     bold:      BOOL property of EO indicating whether row text should be made bold
  67. //
  68.  
  69. @interface EOTableViewAssociation :EOAssociation
  70. {
  71.     unsigned _updating:1;    // This flag indicated we're in the
  72.                                 // middle of some higher-level operation,
  73.                                 // and thus that any message from the TV
  74.                                 // should be ignored.
  75.     unsigned _enabledAspectBound:1;
  76.     unsigned _colorAspectBound:1;
  77.     unsigned _boldAspectBound:1;
  78.     unsigned _italicAspectBound:1;
  79.     unsigned _sortsByColumnOrder:1;
  80.     unsigned _didSetSortOrdering:1;
  81.     unsigned _autoCreated:1;
  82.     unsigned _unused:24;
  83. }
  84.  
  85. + (void)bindToTableView:(NSTableView *)tableView displayGroup:(EODisplayGroup *)displayGroup;
  86.     // called by a ColumnAssociation in establishConnection to ensure that an
  87.     // and appropriate TableViewAssociation has been bound to the given table view.
  88.     // This will only create and bind a new association if one has not already
  89.     // been set as the delegate of the TableView.
  90.  
  91. - (void)setSortsByColumnOrder:(BOOL)yn;
  92. - (BOOL)sortsByColumnOrder;
  93.     // sets whether or not the ColumnAssociation should set a sort ordering
  94.     // on the DisplayGroup based on the order of its columns
  95.  
  96. - (EOColumnAssociation *)editingAssociation;
  97.     // the currently editing association
  98.  
  99. // TableView messages processed by the TableViewAssocation: 
  100. - (int)numberOfRowsInTableView:(NSTableView *)tableView;
  101. - (void)tableViewSelectionDidChange:(NSNotification *)notification;
  102.  
  103. // Methods forwarded on by the TableAssociation to the appropriate EOColumnAssociation
  104. - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  105. - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  106. - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  107. - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  108.  
  109. // Control editing delegate messages.  These are forwarded on to the
  110. // current editing association
  111. - (BOOL)control:(NSControl *)control isValidObject:(id)obj;
  112. - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)errorDescription;
  113. - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
  114. @end
  115.