|
11-02-09 / 23:37 : Cappuccino : automatic recursive layout (cjed) | Among many stunning features in Cappuccino for user interfaces creation (and among Interface Builder, dynamic binding/delegation chain, infinite and non fixed combination of components, specialization without need for inheritance - by using delegates -, very high abstraction level) is automatic layout management (tutorial posted two months ago). Contrary to JSP tags libraries (including JSF) and Java/Swing components, Cappuccino's AppKit (as with Cocoa) automatically manages the layout of components in the parent container view. We just have to define for each component the desired behaviours (constraints), through a properties mask (setted by using the setAutoresizingMask method) : CPViewWidthSizable, CPViewHeightSizable, CPViewMinXMargin, CPViewMaxXMargin, CPViewMinYMargin, CPViewMaxYMargin. The parent view then takes care of the components layout automatically, in a recursive manner (if nested views levels).
In a recent thread, a user stated :
Thankfully "layout managers" are a dopey Java-like paradigm that Cocoa
avoids. Cocoa pretty much has one (fairly sensible) layout paradigm. If you look at the 6 layout-related attributes that you can set on any view in IB, these translate directly to flags that you can set on any view's setAutoresizingMask: method from code. Views tell their parent which edges they want to be anchored to and which directions they wish their size to be expanded in. CPView figures out the rest
"automagically" when it lays out its subview. | | Comments | Write a comment | |
|