Next: , Previous: , Up: Top   [Contents][Index]


5 Implementation

5.1 Notes on implementation

The IB documentation on how object selection is managed and how editors and inspectors are used is unclear ... so I’ve gone my own way.

1. When a document is loaded, the document object creates an editor attached to each top-level object in the user interface (NSMenu and NSWindow objects).

These editors must be aware of their edited objects being clicked upon, and clicking on one of these should cause the corresponding editor to become the active editor.

The active editor is responsible for handling selection of the edited object (and any objects below it in the object hierarchy). Upon change of selection, the editor is responsible for sending an IBSelectionChangedNotification with the selection owner (normally the editor itsself) as the notification owner.

The main application watches for these notifications in order to keep track of who has the selection.

5.2 Connections

The connection API is the same as that for IB, but with the extension that the document object must implement [-windowAndRect:forObject:] to return the window in which the object is being displayed, and the rectangle enclosing the object (in window base coordinates).

This information is needed by Gorm so that it can mark the connection.

The editors mananging the drag-and-drop operation for a connection must call ‘[NSApp -displayConnectionBetween:and:]’ to tell Gorm to update its display. This method sets the values currently returned by ‘[NSApp -connectSource]’ and ‘[NSApp -connectDestination]’.