src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Resizable.js
changeset 69 a361355b55c7
equal deleted inserted replaced
68:fd8fb93e1b6a 69:a361355b55c7
       
     1 /**
       
     2  * Resizable.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  * Resizable mixin. Enables controls to be resized.
       
    13  *
       
    14  * @mixin tinymce.ui.Resizable
       
    15  */
       
    16 define("tinymce/ui/Resizable", [
       
    17 	"tinymce/ui/DomUtils"
       
    18 ], function(DomUtils) {
       
    19 	"use strict";
       
    20 
       
    21 	return {
       
    22 		/**
       
    23 		 * Resizes the control to contents.
       
    24 		 *
       
    25 		 * @method resizeToContent
       
    26 		 */
       
    27 		resizeToContent: function() {
       
    28 			this._layoutRect.autoResize = true;
       
    29 			this._lastRect = null;
       
    30 			this.reflow();
       
    31 		},
       
    32 
       
    33 		/**
       
    34 		 * Resizes the control to a specific width/height.
       
    35 		 *
       
    36 		 * @method resizeTo
       
    37 		 * @param {Number} w Control width.
       
    38 		 * @param {Number} h Control height.
       
    39 		 * @return {tinymce.ui.Control} Current control instance.
       
    40 		 */
       
    41 		resizeTo: function(w, h) {
       
    42 			// TODO: Fix hack
       
    43 			if (w <= 1 || h <= 1) {
       
    44 				var rect = DomUtils.getWindowSize();
       
    45 
       
    46 				w = w <= 1 ? w * rect.w : w;
       
    47 				h = h <= 1 ? h * rect.h : h;
       
    48 			}
       
    49 
       
    50 			this._layoutRect.autoResize = false;
       
    51 			return this.layoutRect({minW: w, minH: h, w: w, h: h}).reflow();
       
    52 		},
       
    53 
       
    54 		/**
       
    55 		 * Resizes the control to a specific relative width/height.
       
    56 		 *
       
    57 		 * @method resizeBy
       
    58 		 * @param {Number} dw Relative control width.
       
    59 		 * @param {Number} dh Relative control height.
       
    60 		 * @return {tinymce.ui.Control} Current control instance.
       
    61 		 */
       
    62 		resizeBy: function(dw, dh) {
       
    63 			var self = this, rect = self.layoutRect();
       
    64 
       
    65 			return self.resizeTo(rect.w + dw, rect.h + dh);
       
    66 		}
       
    67 	};
       
    68 });