]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/tiny_mce/classes/ui/Container.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / tiny_mce / classes / ui / Container.js
1 /**
2  * Container.js
3  *
4  * Copyright 2009, Moxiecode Systems AB
5  * Released under LGPL License.
6  *
7  * License: http://tinymce.moxiecode.com/license
8  * Contributing: http://tinymce.moxiecode.com/contributing
9  */
10
11 /**
12  * This class is the base class for all container controls like toolbars. This class should not
13  * be instantiated directly other container controls should inherit from this one.
14  *
15  * @class tinymce.ui.Container
16  * @extends tinymce.ui.Control
17  */
18 tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {
19         /**
20          * Base contrustor a new container control instance.
21          *
22          * @constructor
23          * @method Container
24          * @param {String} id Control id to use for the container.
25          * @param {Object} s Optional name/value settings object.
26          */
27         Container : function(id, s, editor) {
28                 this.parent(id, s, editor);
29
30                 /**
31                  * Array of controls added to the container.
32                  *
33                  * @property controls
34                  * @type Array
35                  */
36                 this.controls = [];
37
38                 this.lookup = {};
39         },
40
41         /**
42          * Adds a control to the collection of controls for the container.
43          *
44          * @method add
45          * @param {tinymce.ui.Control} c Control instance to add to the container.
46          * @return {tinymce.ui.Control} Same control instance that got passed in.
47          */
48         add : function(c) {
49                 this.lookup[c.id] = c;
50                 this.controls.push(c);
51
52                 return c;
53         },
54
55         /**
56          * Returns a control by id from the containers collection.
57          *
58          * @method get
59          * @param {String} n Id for the control to retrive.
60          * @return {tinymce.ui.Control} Control instance by the specified name or undefined if it wasn't found.
61          */
62         get : function(n) {
63                 return this.lookup[n];
64         }
65 });
66