src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/FitLayout.js
changeset 69 a361355b55c7
equal deleted inserted replaced
68:fd8fb93e1b6a 69:a361355b55c7
       
     1 /**
       
     2  * FitLayout.js
       
     3  *
       
     4  * Copyright, Moxiecode Systems AB
       
     5  * Released under LGPL License.
       
     6  *
       
     7  * License: http://www.tinymce.com/license
       
     8  * Contributing: http://www.tinymce.com/contributing
       
     9  */
       
    10 
       
    11 /**
       
    12  * This layout manager will resize the control to be the size of it's parent container.
       
    13  * In other words width: 100% and height: 100%.
       
    14  *
       
    15  * @-x-less FitLayout.less
       
    16  * @class tinymce.ui.FitLayout
       
    17  * @extends tinymce.ui.AbsoluteLayout
       
    18  */
       
    19 define("tinymce/ui/FitLayout", [
       
    20 	"tinymce/ui/AbsoluteLayout"
       
    21 ], function(AbsoluteLayout) {
       
    22 	"use strict";
       
    23 
       
    24 	return AbsoluteLayout.extend({
       
    25 		/**
       
    26 		 * Recalculates the positions of the controls in the specified container.
       
    27 		 *
       
    28 		 * @method recalc
       
    29 		 * @param {tinymce.ui.Container} container Container instance to recalc.
       
    30 		 */
       
    31 		recalc: function(container) {
       
    32 			var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox();
       
    33 
       
    34 			container.items().filter(':visible').each(function(ctrl) {
       
    35 				ctrl.layoutRect({
       
    36 					x: paddingBox.left,
       
    37 					y: paddingBox.top,
       
    38 					w: contLayoutRect.innerW - paddingBox.right - paddingBox.left,
       
    39 					h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom
       
    40 				});
       
    41 
       
    42 				if (ctrl.recalc) {
       
    43 					ctrl.recalc();
       
    44 				}
       
    45 			});
       
    46 		}
       
    47 	});
       
    48 });