home *** CD-ROM | disk | FTP | other *** search
- // EOColumnAssociation.h
- // Enterprise Objects Framework
- // Copyright (c) 1995, NeXT Software, Inc. All rights reserved.
-
- #import <EOInterface/EOAssociation.h>
- #import <EOInterface/EODisplayGroup.h>
-
- // The EOColumnAssociation object is the subclass of EOAssociation responsible
- // for making an assocation between a column of a NSTableView and a property of
- // all EOs in an EODisplayGroup. The EOColumnAssociations take over
- // the column identifiers to point to themselves. Furthermore, all of the
- // EOColumnAssociations associated with a given NSTableView must be
- // be bound to the same EODisplayGroup.
- //
- // EOControlAssociation Bindings:
- // value: property of the EO to be displayed in the column.
- // enabled: BOOL property of EO indicating whether cell should be enabled
- //
-
- @interface EOColumnAssociation :EOAssociation
- {
- unsigned _didChange:1;
- unsigned _alreadySetObject:1;
- unsigned _enabledAspectBound:1;
- unsigned _unused :29;
- SEL _sortingSelector;
- }
-
- - (void)establishConnection;
- // Activates the association after initWithObject: or initWithCoder:.
- // If called for an association bound to a programmatically created
- // NSTableColumn, make sure to add the TableColumn to the TableView
- // *before* calling [assoc establishConnection];
-
- - (void)setSortingSelector:(SEL)selector;
- - (SEL)sortingSelector;
- // used if [EOTableViewAssociation setSortsByColumnOrder:YES].
- // Should return sort comparison selector for values in this column
- // (see EOSortOrdering.h) or nil if this column should not participate
- // in the sort. Returns EOCompareAscending by default.
-
- // Methods forwarded on by the EOTableView association.
- // These should not be invoked directly.
- - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (BOOL)control:(NSControl *)control isValidObject:(id)obj;
- - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)errorDescription;
- - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
- @end
-
-
- // The TableView association is the delegate and dataSource of
- // EOColumnAssociations and forward all per-column messages to the
- // column association associated with the column.
- // The first EOColumnAssociation to be bound automatically creates and binds
- // and EOTableView association.
- //
- // EOTableViewAssociation Bindings:
- // source: bind to the EODisplayGroup for the table view.
- // The key for the binding is unimportant (it is not used)
- // enabled: BOOL property of EO indicating whether row should be enabled
- // textColor: NSColor * property of EO indicating text color for row
- // italic: BOOL property of EO indicating whether row text should be italicized
- // bold: BOOL property of EO indicating whether row text should be made bold
- //
-
- @interface EOTableViewAssociation :EOAssociation
- {
- unsigned _updating:1; // This flag indicated we're in the
- // middle of some higher-level operation,
- // and thus that any message from the TV
- // should be ignored.
- unsigned _enabledAspectBound:1;
- unsigned _colorAspectBound:1;
- unsigned _boldAspectBound:1;
- unsigned _italicAspectBound:1;
- unsigned _sortsByColumnOrder:1;
- unsigned _didSetSortOrdering:1;
- unsigned _autoCreated:1;
- unsigned _unused:24;
- }
-
- + (void)bindToTableView:(NSTableView *)tableView displayGroup:(EODisplayGroup *)displayGroup;
- // called by a ColumnAssociation in establishConnection to ensure that an
- // and appropriate TableViewAssociation has been bound to the given table view.
- // This will only create and bind a new association if one has not already
- // been set as the delegate of the TableView.
-
- - (void)setSortsByColumnOrder:(BOOL)yn;
- - (BOOL)sortsByColumnOrder;
- // sets whether or not the ColumnAssociation should set a sort ordering
- // on the DisplayGroup based on the order of its columns
-
- - (EOColumnAssociation *)editingAssociation;
- // the currently editing association
-
- // TableView messages processed by the TableViewAssocation:
- - (int)numberOfRowsInTableView:(NSTableView *)tableView;
- - (void)tableViewSelectionDidChange:(NSNotification *)notification;
-
- // Methods forwarded on by the TableAssociation to the appropriate EOColumnAssociation
- - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
- - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
-
- // Control editing delegate messages. These are forwarded on to the
- // current editing association
- - (BOOL)control:(NSControl *)control isValidObject:(id)obj;
- - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)errorDescription;
- - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
- @end
-