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