Hex Fiend's document window Cocoa view hierarchy is shown above. Of course, the topmost MyDocument is not really a view, but it conceptually owns all of its contents.
Note that Hex Fiend uses NSTextView and NSScroller, but no NSScrollView. Because Hex Fiend supports files larger than you would want to put into an NSTextView, the MyDocument class takes over all of NSScrollView's responsibilities.
From outside to inside, left to right:
- MyDocument, the NSDocument subclass, acts as the controller (as in MVC) - it sets up the views and communicates with the data representation.
- DataViewHolder is a simple flipped view, and doesn't do much except draw the horizontal and vertical lines outside the resize indicator (what, you thought Cocoa did that for you?)
- LineCountingView is a simple view for showing the line numbers.
- DataViews act as intermediate controllers - they are responsible for converting the raw data to or from a specific representation (currently ASCII or hex). There is currently a subclass for ASCII and one for hexadecimal.
- DataTextViews are NSTextView subclasses responsible for representation-specific NSTextView overrides. There is currently a subclass for ASCII and one for hexadecimal.