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