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