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