Builder/Window.js
[app.Builder.js] / Builder / Window.js
1 //<Script type="text/javascript">
2
3 Gtk = imports.gi.Gtk;
4
5 XObject = imports.XObject;
6 console = imports.console;
7
8   
9 // concept:
10 /**
11  * 
12  * left - tree + props
13  * right - top = preview - webkit?
14  * right - bottom = soruceview
15  * 
16  * Palete... as toolbar??? - changes depending on what you pick?
17  * 
18  * Not sure how to do Gtk version.. - our preview might be fun... = probably have to do a gtkhbox.. or something..
19  * 
20  */
21  
22  
23  
24 var _win;
25 var _left;
26  
27 //print('window loaded');
28
29 Window = new XObject({
30     
31         id: 'Builder.Window',
32         
33         xns : 'Gtk',
34         xtype : 'Window',
35         type: Gtk.WindowType.TOPLEVEL,
36         listeners : {
37             'delete-event' : function (widget, event) {
38                 return false;
39             },
40             destroy  : function (widget) {
41                 Gtk.main_quit();
42             },
43             _new  : function(self) {
44                 _win = self;
45             },
46             _rendered : function()
47             {
48                 Builder.MidPropTree._win.hideWin();
49                 Builder.RightPalete._palete.hide();
50                 
51                 
52                 /*
53                 var pr = new Builder.Provider.Project.Roo({
54                     file : "/home/alan/test.json"
55                 });
56                 pr.load({
57                     scope : this,
58                     success : function()
59                     {
60                         //console.log("loaded");
61                         
62                         //Seed.quit();
63                         Builder.projects.push(pr);
64                         Builder.LeftProjectTree._model.loadProject(pr);
65                         Builder.LeftProjectTree._expander.el.set_expanded(true);
66
67                     }
68                 });
69                 */
70                 
71                 
72             }
73         },
74        
75         set : {
76             set_border_width : [ 0 ],
77             set_title : [ 'Application Builder' ],
78             set_default_size: [900, 600],
79             
80             show_all : []
81         },
82         
83         items : [
84             {
85                 xtype : 'VBox',
86                 xns: 'Gtk',
87                 items : [
88                     
89                     {
90                         xtype : 'Include',
91                         xns : 'xnew',
92                         cls : Builder.TopMenu
93                     },
94                     
95                     
96                     {
97                         xtype : 'HPaned',
98                         xns: 'Gtk',
99                         set : {
100                                 set_position : [ 400 ]
101                         },
102                         listeners : {
103                             _new : function(self) {
104                                 _left = this;
105                             }
106                         },
107                         items : [
108                             // in my original design - the child elements get loaded by a 'module loader...',
109                               
110                             {
111                                 xtype : 'HBox',
112                                 xns: 'Gtk',
113                                 
114                         
115                                 items : [
116                                     
117                                    
118                                     {
119                                         xtype : 'VPaned',
120                                         xns: 'Gtk',
121                                         listeners : {
122                                             _new  : function()
123                                             {
124                                                 _leftvpaned = this;
125                                             }
126                                         },
127                                         set : {
128                                             set_position : [ 300 ]
129                                         },
130                                         items : [
131                                            
132                                                      
133                                             {
134                                                 xtype : 'Include',
135                                                 xns : 'xnew',
136                                                 cls : Builder.LeftTopPanel
137                                             },
138                                             
139                                                     
140                                             {
141                         
142                                                 xns : 'Gtk',
143                                                 xtype: 'VBox',
144                                                 
145                                                 items : [
146                                               
147                                                     {
148                                 
149                                                         xns : 'Gtk',
150                                                         xtype: 'HBox',
151                                                         packing : [ 'pack_start', false, true, 0 ],
152                                                         items : [   
153                                                             {
154                                                                 xtype : 'Include',
155                                                                 xns : 'xnew',
156                                                                 cls : Builder.LeftProps
157                                                             }
158                                                          
159                                                         ]
160                                                     },
161                                                     {
162                                                         xtype : 'Include',
163                                                         xns : 'xnew',
164                                                         cls : Builder.LeftPanel
165                                                     }
166                                                     
167                                                 ]
168                                             }
169                                             //LeftProps.add()
170                                         ]
171                                     },
172                                     {
173                                         xtype : 'Include',
174                                         xns : 'xnew',
175                                         cls : Builder.MidPropTree
176                                     }
177                                     
178                                 ]
179                             },
180                                     
181                                     
182                             {
183                                 xtype : 'HBox',
184                                 xns: 'Gtk',
185                                 
186                         
187                                 items : [
188                            
189                                 
190                                     {
191                                         xtype : 'VPaned',
192                                         xns: 'Gtk',
193                                         set : {
194                                             set_position : [ 300 ]
195                                         },
196                                         items : [
197                                             {
198                                                 xtype : 'VBox',
199                                                 xns: 'Gtk',
200                                                 items : [
201                                                     {
202                                                         xtype : 'Include',
203                                                         xns : 'xnew',
204                                                         cls : Builder.RightBrowser
205                                                     },
206                                                     {
207                                                         xtype : 'Expander',
208                                                         xns: 'Gtk',
209                                                         label : 'Console',
210                                                         packing : ['pack_start', false , false ],
211                                                         set : {
212                                                             //set_position : [ 300 ]
213                                                         },
214                                                         items : [
215                                                         //    Builder.ProjectTree.create()
216                                                             {
217                                                                 xtype : 'Button',
218                                                                 xns: 'Gtk',
219                                                                 label : 'Console Goes here'
220                                                             }
221                                                         ]
222                                                     }
223                                                    
224                                                   
225                                                             
226                                                       
227                                                    
228                                                 ]
229                                             },
230                                         
231                                         
232                                            
233                                             {
234                                                 xtype : 'Include',
235                                                 xns : 'xnew',
236                                                 cls : Builder.RightEditor
237                                             }
238                                            
239                                            
240                                            
241                                           
242                                             //LeftProps.add()
243                                         ]
244                                     },
245                                     
246                                     {
247                                         xtype : 'Include',
248                                         xns : 'xnew',
249                                         cls : Builder.RightPalete
250                                     }
251                                    
252                                     
253                                     
254                                    
255                                 ]
256                             }
257                         ]
258                     }
259                     
260                 ]
261            }
262                     
263         ]
264 }); 
265  
266     
267  
268  
269