Builder/Window.js
[app.Builder.js] / Builder / Window.js
1 //<Script type="text/javascript">
2
3 Gtk = imports.gi.Gtk;
4 // core libs
5 XObject = imports.XObject.XObject;
6 console = imports.console;
7
8 // components.
9 TopMenu         = imports.Builder.TopMenu.TopMenu;
10 LeftTopPanel    = imports.Builder.LeftTopPanel.LeftTopPanel;
11 LeftProps       = imports.Builder.LeftProps.LeftProps;
12 LeftPanel       = imports.Builder.LeftPanel.LeftPanel;
13 MidPropTree     = imports.Builder.MidPropTree.MidPropTree;
14 RightBrowser    = imports.Builder.RightBrowser.RightBrowser;
15 RightGtkView    = imports.Builder.RightGtkView.RightGtkView;
16 RightEditor     = imports.Builder.RightEditor.RightEditor;
17 RightPalete     = imports.Builder.RightPalete.RightPalete;
18 // concept:
19 /**
20  * 
21  * left - tree + props
22  * right - top = preview - webkit?
23  * right - bottom = soruceview
24  * 
25  * Palete... as toolbar??? - changes depending on what you pick?
26  * 
27  * Not sure how to do Gtk version.. - our preview might be fun... = probably have to do a gtkhbox.. or something..
28  * 
29  */
30  
31  
32   
33 //print('window loaded');
34
35 Window = new XObject({
36     
37     id: 'Builder.Window',
38     
39     xtype : function() {
40         return new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
41     },
42     
43     //type: Gtk.WindowType.TOPLEVEL,
44     title : "Application Builder",
45     border_width : 0,
46     
47     init : function()
48     {
49         XObject.prototype.init.call(this); 
50         
51         this.el.show_all();
52         MidPropTree.hideWin();
53         RightPalete.hide();
54         
55         this.el.set_default_size(900, 600);
56         
57     },
58     
59     listeners : {
60         'delete-event' : function (widget, event) {
61             return false;
62         },
63         destroy  : function (widget) {
64             Gtk.main_quit();
65         },
66          
67     },
68     
69         
70     items : [
71         {
72             xtype : Gtk.VBox,
73             id: 'w-vbox',
74             items : [
75                 TopMenu,
76                 {
77                     id : 'left',
78                     xtype : Gtk.HPaned,
79                     position : 400,
80                     items : [
81                         {
82                             xtype : Gtk.HBox,
83                             items : [
84                                 {
85                                     id : 'leftvpaned',
86                                     xtype : Gtk.VPaned,
87                                     position : 300,
88                                     items : [
89                                         LeftTopPanel,
90                                         {
91                                             xtype: Gtk.VBox,
92                                             items : [
93                                                 {
94                             
95                                                     xtype : Gtk.HBox,
96                                                     pack : [ 'pack_start', false, true, 0 ],
97                                                     items : [  
98                                                         LeftProps 
99                                                     ]
100                                                 },
101                                                 LeftPanel
102                                                 
103                                             ]
104                                         }
105                                         
106                                     ]
107                                 },
108                                 MidPropTree
109                                 
110                             ]
111                         },
112                                 
113                         {
114                             xtype : Gtk.HBox,
115                             items : [
116                                 {
117                                     xtype : Gtk.VPaned,
118                                     position :  300,
119                                     items : [
120                                         {
121                                             xtype : Gtk.VBox,
122                                             items : [
123                                             
124                                                 {
125                                                     id : 'view-notebook',
126                                                     xtype : Gtk.Notebook,
127                                                     show_tabs : false,
128                                                     tab_border : 0,
129                                                     pack : ['pack_start', true,true],
130                                                     init : function()
131                                                     {
132                                                         XObject.prototype.init.call(this); 
133                                                         this.el.set_current_page(0);
134                                                     },
135                                                     items : [
136                                                        RightBrowser,
137                                                        RightGtkView,
138                                                     ]
139                                                 } 
140                                                
141                                             ]
142                                         },
143                                         {
144                                             xtype: Gtk.Notebook,
145                                             "pack":"add",
146                                             "init":function() {
147                                                 XObject.prototype.init.call(this);
148                                                 this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Code Editor" }));
149                                                     this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : "Console" }));
150                                             },
151                                             items : [
152                                                 RightPalete,
153                                                 {
154                                                     xtype: Vte.Terminal,
155                                                     "pack":"add",
156                                                     "id":"Terminal",
157                                                     "feed":function(str) {
158                                                         this.el.feed(str,str.length);
159                                                     },
160                                                     
161                                                 }
162                                             ]
163                                         }
164                                     ]
165                                 },
166                                
167                                  
168                                 
169                             ]
170                         }
171                     ]
172                 }
173                 
174             ]
175        }
176                 
177     ]
178 }); 
179  
180     
181  
182  
183