1 // ==========================================================================
  2 // Project:   SproutCore - JavaScript Application Framework
  3 // Copyright: ©2006-2011 Strobe Inc. and contributors.
  4 //            Portions ©2008-2011 Apple Inc. All rights reserved.
  5 // License:   Licensed under MIT license (see license.js)
  6 // ==========================================================================
  7 
  8 /**
  9   @namespace
 10 
 11   SC.StaticLayout is now built in to SC.View.  You do not need to
 12   apply this mixin to use static layout.  Just set useStaticLayout to YES.
 13 
 14 
 15 
 16   Normally, SproutCore views use absolute positioning to display themselves
 17   on the screen.  While this is both the fastest and most efficient way to
 18   display content in the web browser, sometimes your user interface might need
 19   to take advantage of the more advanced "flow" layout offered by the browser
 20   when you use static and relative positioning.
 21 
 22   This mixin can be added to a view class to enable the use of any kind of
 23   static and relative browser positioning.  In exchange for using static
 24   layout, you will lose a few features that are normally available on a view
 25   class such as the 'frame' and 'clippingFrame' properties as well as
 26   notifications when your view or parentView are resized.
 27 
 28   Normally, if you are allowing the browser to manage the size and positioning
 29   of your view, these feature will not be useful to your code anyway.
 30 
 31   ## Using StaticLayout
 32 
 33   To enable static layout on your view, just include this mixin on the view.
 34   SproutCore's builtin views that are capable of being used in static
 35   layouts already incorporate this mixin.  Then set the "useStaticLayout"
 36   property on your view class to YES.
 37 
 38   You can then use CSS or the render() method on your view to setup the
 39   positioning on your view using any browser layout mechanism you want.
 40 
 41   ## Example
 42 
 43       // JavaScript
 44 
 45       MyApp.CommentView = SC.View.extend(SC.StaticLayout, {
 46 
 47         classNames: ['comment-view'],
 48 
 49         useStaticLayout: YES,
 50 
 51         ...
 52       });
 53 
 54       // CSS
 55 
 56       .comment-view {
 57         display: block;
 58         position: relative;
 59       }
 60 
 61   @deprecated Version 1.10
 62   @since SproutCore 1.0
 63 */
 64 SC.StaticLayout = {
 65 
 66   /**
 67     Walk like a duck.  Used to determine that this mixin has been applied.
 68     Note that a view that hasStaticLayout still may not actually use static
 69     layout unless useStaticLayout is also set to YES.
 70 
 71     @type Boolean
 72     @default YES
 73   */
 74   hasStaticLayout: YES,
 75 
 76   initMixin: function () {
 77     //@if(debug)
 78     SC.warn("The SC.StaticLayout mixin code is included in SC.View directly now and the mixin has been deprecated.  Please do not mix it into your views.");
 79     //@endif
 80   }
 81 
 82 };
 83