Roo/doc/Synopsis.js
[roojs1] / Roo / doc / Synopsis.js
1 /*
2  * - LGPL
3  *
4  */
5
6 /**
7  * @class Roo.doc.Synopsis
8  * @extends Roo.bootstrap.Component
9  * Synopsis Element class
10  * @cfg {String} returntype return value
11  * @cfg {String} returndesc description of return value. (used in the return section if set..)
12  * @cfg {String} name title really..
13  * @cfg {String} stype (function|constant)
14  * @cfg {String} memberof class name
15  * @cfg {bool} is_static is a static member
16  * @cfg {bool} is_constructor is a static member
17  * 
18  * @constructor
19  * Create a new Synopsis
20  * @param {Object} config The config object
21  */
22
23 Roo.doc.Synopsis = function(config){
24     Roo.doc.Synopsis.superclass.constructor.call(this, config);
25 };
26
27 Roo.extend(Roo.doc.Synopsis, Roo.bootstrap.Component,  {
28     
29     memberof : '',
30     is_static : false,
31     returntype : '',
32     returndesc : '',
33     name: '',
34     stype:   'function',
35     is_constructor : false,
36     
37     getAutoCreate : function(){
38         
39         var syn = this.items[0]; // hopefully...
40         
41         
42         
43         var nmp = (this.is_static ? '' : '$') +
44             this.memberof +
45             (this.is_static ? '::' : '->');
46             
47         var nm = this.name;
48         // this should probably do the params....?? then we need to disable the rendering..
49         if (this.is_constructor) {
50             nm = this.memberof;
51             nmp = 'new ';
52         }
53         
54          
55         var cfg ={
56             tag: 'h5',
57             cls : 'refsynopsisdiv',
58             cn : [
59                 {
60                     cls: 'funcsynopsis',
61                     cn: [
62                         {
63                             tag: 'p',
64                             cn: {
65                                 tag:'code',
66                                 cls : 'funcprototype',
67                                 cn: [
68                                     this.returntype + ' ' + nmp,
69                                     {
70                                         tag: 'strong',
71                                         cls : this.stype,
72                                         html : nm
73                                     },
74                                     '(',
75                                     {
76                                         tag: 'span',
77                                         cls : 'roo-params'
78                                     },
79                                     ')'
80                                 ]
81                                 
82                             }
83                         }
84                     ]
85                 }
86                 
87             ]
88         };
89         
90         
91         
92         return cfg;
93     },
94     getChildContainer : function(build_call)
95     {
96          
97         
98         return this.el.select('.roo-params',true).first();
99     }
100     
101     
102     
103     
104    
105 });
106
107  
108
109