DependTree/Window.js
[app.Builder.js] / DependTree / Window.js
1 Gtk = imports.gi.Gtk;
2 Gdk = imports.gi.Gdk;
3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
5 Gio = imports.gi.Gio;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
9 Vte = imports.gi.Vte;
10 GtkClutter = imports.gi.GtkClutter;
11 Gdl = imports.gi.Gdl;
12 console = imports.console;
13 XObject = imports.XObject.XObject;
14 Window=new XObject({
15     xtype: Gtk.Window,
16     listeners : {
17         show : function (self) {
18             print("SHOW");
19             var BuildLists = imports['BuildLists.js'].BuildLists;
20             this.data = new BuildLists();
21             print(JSON.stringify(this.data.allmethods, null,4));
22             
23             var ls = this.get('method-list-store');
24             this.data.allmethods.forEach(function(v) {
25                 ls.append( [ v , false, true ]);
26             });
27             var ls = this.get('children-list-store');
28             this.data.allchildren.forEach(function(v) {
29                 ls.append( [ v , false, true ]);
30             });
31             var ls = this.get('class-list-store');
32             var i =0;
33             for (var c in this.data.methods) {
34                 i++;
35                 ls.append( [ c , true ,   true]);
36             };
37             
38             
39             
40         }
41     },
42     default_height : 500,
43     default_width : 600,
44     init : function() {
45         XObject.prototype.init.call(this);
46         this.el.show_all();
47     },
48     items : [
49         {
50             xtype: Gtk.VBox,
51             items : [
52                 {
53                     xtype: Gtk.HBox,
54                     pack : "pack_start,false,false",
55                     items : [
56                         {
57                             xtype: Gtk.Button,
58                             label : "Reset"
59                         }
60                     ]
61                 },
62                 {
63                     xtype: Gtk.HBox,
64                     items : [
65                         {
66                             xtype: Gtk.ScrolledWindow,
67                             items : [
68                                 {
69                                     xtype: Gtk.TreeView,
70                                     listeners : {
71                                         cursor_changed : function (self) {
72                                             var sel = this.el.get_selection();
73                                             var iter = new Gtk.TreeIter();
74                                             sel.get_selected(this.el.model, iter);
75                                         
76                                             var tp = this.el.model.get_path(iter);
77                                             // 
78                                             var cls = this.model.getValue(tp, 0);
79                                             print(cls);
80                                             
81                                         }
82                                     },
83                                     items : [
84                                         {
85                                             xtype: Gtk.TreeModelFilter,
86                                             init : function() {
87                                                 this.items[0].pack = false;
88                                                 this.items[0].init();
89                                                 this.list = this.items[0];
90                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
91                                                  this.el.set_visible_column(2);
92                                                 XObject.prototype.init.call(this);
93                                                 this.parent.model = this;
94                                                
95                                             },
96                                             items : [
97                                                 {
98                                                     xtype: Gtk.ListStore,
99                                                     id : "class-list-store",
100                                                     pack : false,
101                                                     init : function() 
102                                                             {
103                                                                 XObject.prototype.init.call(this);
104                                                                 this.el.set_column_types ( 6, [
105                                                                     GObject.TYPE_STRING, 
106                                                                     GObject.TYPE_BOOLEAN, 
107                                                                     GObject.TYPE_BOOLEAN, 
108                                                                     GObject.TYPE_STRING, 
109                                                                     GObject.TYPE_STRING, 
110                                                                     GObject.TYPE_STRING 
111                                                                 ] );
112                                                                 
113                                                             }
114                                                 }
115                                             ]
116                                         },
117                                         {
118                                             xtype: Gtk.TreeViewColumn,
119                                             title : "Class",
120                                             expand : true,
121                                             items : [
122                                                 {
123                                                     xtype: Gtk.CellRendererText
124                                                 }
125                                             ]
126                                         },
127                                         {
128                                             xtype: Gtk.TreeViewColumn,
129                                             title : "Active",
130                                             items : [
131                                                 {
132                                                     xtype: Gtk.CellRendererToggle,
133                                                     listeners : {
134                                                         toggled : function (self, path) {
135                                                             print("TOGGLE");
136                                                             // this.list
137                                                         
138                                                         
139                                                              
140                                                             var old = this.list.getValue(path, 1);
141                                                            // print(JSON.stringify(old));
142                                                             this.list.setValue(path, 1, old ? false : true)
143                                                             
144                                                             
145                                                             
146                                                             
147                                                         }
148                                                     },
149                                                     activatable : true
150                                                 }
151                                             ]
152                                         }
153                                     ]
154                                 }
155                             ]
156                         },
157                         {
158                             xtype: Gtk.ScrolledWindow,
159                             items : [
160                                 {
161                                     xtype: Gtk.TreeView,
162                                     items : [
163                                         {
164                                             xtype: Gtk.TreeModelFilter,
165                                             init : function() {
166                                                 this.items[0].pack = false;
167                                                 this.items[0].init();
168                                                 this.list = this.items[0];
169                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
170                                                  this.el.set_visible_column(2);
171                                                 XObject.prototype.init.call(this);
172                                                
173                                             },
174                                             items : [
175                                                 {
176                                                     xtype: Gtk.ListStore,
177                                                     id : "method-list-store",
178                                                     init : function() 
179                                                             {
180                                                                 XObject.prototype.init.call(this);
181                                                                 this.el.set_column_types ( 6, [
182                                                                     GObject.TYPE_STRING, 
183                                                                     GObject.TYPE_BOOLEAN, 
184                                                                     GObject.TYPE_BOOLEAN, 
185                                                                     GObject.TYPE_STRING, 
186                                                                     GObject.TYPE_STRING, 
187                                                                     GObject.TYPE_STRING 
188                                                                 ] );
189                                                                 
190                                                             }
191                                                 }
192                                             ]
193                                         },
194                                         {
195                                             xtype: Gtk.TreeViewColumn,
196                                             title : "Methods",
197                                             expand : true,
198                                             items : [
199                                                 {
200                                                     xtype: Gtk.CellRendererText
201                                                 }
202                                             ]
203                                         },
204                                         {
205                                             xtype: Gtk.TreeViewColumn,
206                                             title : "Active",
207                                             items : [
208                                                 {
209                                                     xtype: Gtk.CellRendererToggle,
210                                                     listeners : {
211                                                         toggled : function (self, path) {
212                                                             print("TOGGLE");
213                                                             // this.list
214                                                         
215                                                         
216                                                              
217                                                             var old = this.list.getValue(path, 1);
218                                                            // print(JSON.stringify(old));
219                                                             this.list.setValue(path, 1, old ? false : true)
220                                                             
221                                                             
222                                                             
223                                                             
224                                                         }
225                                                     },
226                                                     activatable : true
227                                                 }
228                                             ]
229                                         }
230                                     ]
231                                 }
232                             ]
233                         },
234                         {
235                             xtype: Gtk.ScrolledWindow,
236                             items : [
237                                 {
238                                     xtype: Gtk.TreeView,
239                                     items : [
240                                         {
241                                             xtype: Gtk.TreeModelFilter,
242                                             init : function() {
243                                                 this.items[0].pack = false;
244                                                 this.items[0].init();
245                                                 this.list = this.items[0];
246                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
247                                                  this.el.set_visible_column(2);
248                                                 XObject.prototype.init.call(this);
249                                                
250                                             },
251                                             items : [
252                                                 {
253                                                     xtype: Gtk.ListStore,
254                                                     id : "children-list-store",
255                                                     pack : false,
256                                                     init : function() 
257                                                             {
258                                                                 XObject.prototype.init.call(this);
259                                                                 this.el.set_column_types ( 6, [
260                                                                     GObject.TYPE_STRING, 
261                                                                     GObject.TYPE_BOOLEAN, 
262                                                                     GObject.TYPE_BOOLEAN, 
263                                                                     GObject.TYPE_STRING, 
264                                                                     GObject.TYPE_STRING, 
265                                                                     GObject.TYPE_STRING 
266                                                                 ] );
267                                                                 
268                                                             }
269                                                 }
270                                             ]
271                                         },
272                                         {
273                                             xtype: Gtk.TreeViewColumn,
274                                             title : "Child classes",
275                                             expand : true,
276                                             items : [
277                                                 {
278                                                     xtype: Gtk.CellRendererText
279                                                 }
280                                             ]
281                                         },
282                                         {
283                                             xtype: Gtk.TreeViewColumn,
284                                             title : "Active",
285                                             items : [
286                                                 {
287                                                     xtype: Gtk.CellRendererToggle,
288                                                     listeners : {
289                                                         toggled : function (self, path) {
290                                                             print("TOGGLE");
291                                                             // this.list
292                                                         
293                                                         
294                                                              
295                                                             var old = this.list.getValue(path, 1);
296                                                            // print(JSON.stringify(old));
297                                                             this.list.setValue(path, 1, old ? false : true)
298                                                             
299                                                             
300                                                             
301                                                             
302                                                         }
303                                                     },
304                                                     activatable : true
305                                                 }
306                                             ]
307                                         }
308                                     ]
309                                 }
310                             ]
311                         }
312                     ]
313                 }
314             ]
315         }
316     ]
317 });
318 Window.init();
319 XObject.cache['/Window'] = Window;