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                                             if (!this.selection) {
73                                                 this.selection  = this.el.get_selection();
74                                             }
75                                             
76                                             var iter = new Gtk.TreeIter();
77                                             this.selection.get_selected(this.model.el, iter);
78                                             
79                                             var tp = this.model.el.get_path(iter).to_string();
80                                             print(tp);
81                                             // 
82                                             var cls = this.model.getValue(tp, 0);
83                                             print(cls);
84                                             
85                                         }
86                                     },
87                                     items : [
88                                         {
89                                             xtype: Gtk.TreeModelFilter,
90                                             init : function() {
91                                                 this.items[0].pack = false;
92                                                 this.items[0].init();
93                                                 this.list = this.items[0];
94                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
95                                                  this.el.set_visible_column(2);
96                                                 XObject.prototype.init.call(this);
97                                                 this.parent.model = this;
98                                                
99                                             },
100                                             items : [
101                                                 {
102                                                     xtype: Gtk.ListStore,
103                                                     id : "class-list-store",
104                                                     pack : false,
105                                                     init : function() 
106                                                             {
107                                                                 XObject.prototype.init.call(this);
108                                                                 this.el.set_column_types ( 6, [
109                                                                     GObject.TYPE_STRING, 
110                                                                     GObject.TYPE_BOOLEAN, 
111                                                                     GObject.TYPE_BOOLEAN, 
112                                                                     GObject.TYPE_STRING, 
113                                                                     GObject.TYPE_STRING, 
114                                                                     GObject.TYPE_STRING 
115                                                                 ] );
116                                                                 
117                                                             }
118                                                 }
119                                             ]
120                                         },
121                                         {
122                                             xtype: Gtk.TreeViewColumn,
123                                             title : "Class",
124                                             expand : true,
125                                             items : [
126                                                 {
127                                                     xtype: Gtk.CellRendererText
128                                                 }
129                                             ]
130                                         },
131                                         {
132                                             xtype: Gtk.TreeViewColumn,
133                                             title : "Active",
134                                             items : [
135                                                 {
136                                                     xtype: Gtk.CellRendererToggle,
137                                                     listeners : {
138                                                         toggled : function (self, path) {
139                                                             print("TOGGLE");
140                                                             // this.list
141                                                         
142                                                         
143                                                              
144                                                             var old = this.list.getValue(path, 1);
145                                                            // print(JSON.stringify(old));
146                                                             this.list.setValue(path, 1, old ? false : true)
147                                                             
148                                                             
149                                                             
150                                                             
151                                                         }
152                                                     },
153                                                     activatable : true
154                                                 }
155                                             ]
156                                         }
157                                     ]
158                                 }
159                             ]
160                         },
161                         {
162                             xtype: Gtk.ScrolledWindow,
163                             items : [
164                                 {
165                                     xtype: Gtk.TreeView,
166                                     items : [
167                                         {
168                                             xtype: Gtk.TreeModelFilter,
169                                             init : function() {
170                                                 this.items[0].pack = false;
171                                                 this.items[0].init();
172                                                 this.list = this.items[0];
173                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
174                                                  this.el.set_visible_column(2);
175                                                 XObject.prototype.init.call(this);
176                                                
177                                             },
178                                             items : [
179                                                 {
180                                                     xtype: Gtk.ListStore,
181                                                     id : "method-list-store",
182                                                     init : function() 
183                                                             {
184                                                                 XObject.prototype.init.call(this);
185                                                                 this.el.set_column_types ( 6, [
186                                                                     GObject.TYPE_STRING, 
187                                                                     GObject.TYPE_BOOLEAN, 
188                                                                     GObject.TYPE_BOOLEAN, 
189                                                                     GObject.TYPE_STRING, 
190                                                                     GObject.TYPE_STRING, 
191                                                                     GObject.TYPE_STRING 
192                                                                 ] );
193                                                                 
194                                                             }
195                                                 }
196                                             ]
197                                         },
198                                         {
199                                             xtype: Gtk.TreeViewColumn,
200                                             title : "Methods",
201                                             expand : true,
202                                             items : [
203                                                 {
204                                                     xtype: Gtk.CellRendererText
205                                                 }
206                                             ]
207                                         },
208                                         {
209                                             xtype: Gtk.TreeViewColumn,
210                                             title : "Active",
211                                             items : [
212                                                 {
213                                                     xtype: Gtk.CellRendererToggle,
214                                                     listeners : {
215                                                         toggled : function (self, path) {
216                                                             print("TOGGLE");
217                                                             // this.list
218                                                         
219                                                         
220                                                              
221                                                             var old = this.list.getValue(path, 1);
222                                                            // print(JSON.stringify(old));
223                                                             this.list.setValue(path, 1, old ? false : true)
224                                                             
225                                                             
226                                                             
227                                                             
228                                                         }
229                                                     },
230                                                     activatable : true
231                                                 }
232                                             ]
233                                         }
234                                     ]
235                                 }
236                             ]
237                         },
238                         {
239                             xtype: Gtk.ScrolledWindow,
240                             items : [
241                                 {
242                                     xtype: Gtk.TreeView,
243                                     items : [
244                                         {
245                                             xtype: Gtk.TreeModelFilter,
246                                             init : function() {
247                                                 this.items[0].pack = false;
248                                                 this.items[0].init();
249                                                 this.list = this.items[0];
250                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
251                                                  this.el.set_visible_column(2);
252                                                 XObject.prototype.init.call(this);
253                                                
254                                             },
255                                             items : [
256                                                 {
257                                                     xtype: Gtk.ListStore,
258                                                     id : "children-list-store",
259                                                     pack : false,
260                                                     init : function() 
261                                                             {
262                                                                 XObject.prototype.init.call(this);
263                                                                 this.el.set_column_types ( 6, [
264                                                                     GObject.TYPE_STRING, 
265                                                                     GObject.TYPE_BOOLEAN, 
266                                                                     GObject.TYPE_BOOLEAN, 
267                                                                     GObject.TYPE_STRING, 
268                                                                     GObject.TYPE_STRING, 
269                                                                     GObject.TYPE_STRING 
270                                                                 ] );
271                                                                 
272                                                             }
273                                                 }
274                                             ]
275                                         },
276                                         {
277                                             xtype: Gtk.TreeViewColumn,
278                                             title : "Child classes",
279                                             expand : true,
280                                             items : [
281                                                 {
282                                                     xtype: Gtk.CellRendererText
283                                                 }
284                                             ]
285                                         },
286                                         {
287                                             xtype: Gtk.TreeViewColumn,
288                                             title : "Active",
289                                             items : [
290                                                 {
291                                                     xtype: Gtk.CellRendererToggle,
292                                                     listeners : {
293                                                         toggled : function (self, path) {
294                                                             print("TOGGLE");
295                                                             // this.list
296                                                         
297                                                         
298                                                              
299                                                             var old = this.list.getValue(path, 1);
300                                                            // print(JSON.stringify(old));
301                                                             this.list.setValue(path, 1, old ? false : true)
302                                                             
303                                                             
304                                                             
305                                                             
306                                                         }
307                                                     },
308                                                     activatable : true
309                                                 }
310                                             ]
311                                         }
312                                     ]
313                                 }
314                             ]
315                         }
316                     ]
317                 }
318             ]
319         }
320     ]
321 });
322 Window.init();
323 XObject.cache['/Window'] = Window;