NSView extension methods to implement min and max sizing behaviors.
Superclass: NSView
NSView extension methods implementing enforced minimum and maximum sizes for views. Also supports a view automatically getting its minimum size from the size of the NSClipView it is a subview of.
This category adds capabilities to all NSViews but does not affect the normal behavior of a view unless one or more of the "set" methods in the category are used. The category is implemented using the method replacement methods from MORuntimeUtilties. Specifically, +[NSObject MO_replaceInstanceSelector:withMethodForSelector:] is used to replace five NSView methods: -dealloc, -setFrame:, -setFrameSize:, -viewWillMoveToSuperview: and -viewDidMoveToSuperview.
Method replacement is not to be taken lightly, although done properly it should be safe. But becuase it is a slightly dicey business there are two mechanisms in MOKit to disable features that use method replacement.
One is a build time switch: if the macro MOKIT_NO_METHOD_REPLACEMENT is defined (via -DMOKIT_NO_METHOD_REPLACEMENT in the compiler flags) then no features of MOKit that use method replacement will be compiled into the framework. The public API that depends on it will still be present but will be ineffective.
The other is a runtime switch: if the user default MOKitAllowMethodReplacement is set to NO (it defaults to YES) then no method replacement will be done. Again, the public API that depends on it will still be present but will be ineffective.
Note that the minimum and maximum sizes and the setting for whether the min size tracks the clip view are NOT coded when a view is archived and so cannot be saved in a nib file.