113536982aa486db1fca18201e36d04fcd26a2b6
[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                                                  this.el.set_visible_column(1);
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.ListStore,
151                                             id : "method-list-store",
152                                             init : function() 
153                                                     {
154                                                         XObject.prototype.init.call(this);
155                                                         this.el.set_column_types ( 6, [
156                                                             GObject.TYPE_STRING, 
157                                                             GObject.TYPE_BOOLEAN, 
158                                                             GObject.TYPE_STRING, 
159                                                             GObject.TYPE_STRING, 
160                                                             GObject.TYPE_STRING, 
161                                                             GObject.TYPE_STRING 
162                                                         ] );
163                                                         
164                                                     }
165                                         },
166                                         {
167                                             xtype: Gtk.TreeViewColumn,
168                                             title : "Methods",
169                                             expand : true,
170                                             items : [
171                                                 {
172                                                     xtype: Gtk.CellRendererText
173                                                 }
174                                             ]
175                                         },
176                                         {
177                                             xtype: Gtk.TreeViewColumn,
178                                             title : "Active",
179                                             items : [
180                                                 {
181                                                     xtype: Gtk.CellRendererToggle,
182                                                     listeners : {
183                                                         toggled : function (self, path) {
184                                                             print("TOGGLE");
185                                                             // this.list
186                                                         
187                                                         
188                                                              
189                                                             var old = this.list.getValue(path, 1);
190                                                            // print(JSON.stringify(old));
191                                                             this.list.setValue(path, 1, old ? false : true)
192                                                             
193                                                             
194                                                             
195                                                             
196                                                         }
197                                                     },
198                                                     activatable : true
199                                                 }
200                                             ]
201                                         }
202                                     ]
203                                 }
204                             ]
205                         },
206                         {
207                             xtype: Gtk.ScrolledWindow,
208                             items : [
209                                 {
210                                     xtype: Gtk.TreeView,
211                                     items : [
212                                         {
213                                             xtype: Gtk.ListStore,
214                                             id : "children-list-store",
215                                             init : function() 
216                                                     {
217                                                         XObject.prototype.init.call(this);
218                                                         this.el.set_column_types ( 6, [
219                                                             GObject.TYPE_STRING, 
220                                                             GObject.TYPE_BOOLEAN, 
221                                                             GObject.TYPE_STRING, 
222                                                             GObject.TYPE_STRING, 
223                                                             GObject.TYPE_STRING, 
224                                                             GObject.TYPE_STRING 
225                                                         ] );
226                                                         
227                                                     }
228                                         },
229                                         {
230                                             xtype: Gtk.TreeViewColumn,
231                                             title : "Child classes",
232                                             expand : true,
233                                             items : [
234                                                 {
235                                                     xtype: Gtk.CellRendererText
236                                                 }
237                                             ]
238                                         },
239                                         {
240                                             xtype: Gtk.TreeViewColumn,
241                                             title : "Active",
242                                             items : [
243                                                 {
244                                                     xtype: Gtk.CellRendererToggle,
245                                                     listeners : {
246                                                         toggled : function (self, path) {
247                                                             print("TOGGLE");
248                                                             // this.list
249                                                         
250                                                         
251                                                              
252                                                             var old = this.list.getValue(path, 1);
253                                                            // print(JSON.stringify(old));
254                                                             this.list.setValue(path, 1, old ? false : true)
255                                                             
256                                                             
257                                                             
258                                                             
259                                                         }
260                                                     },
261                                                     activatable : true
262                                                 }
263                                             ]
264                                         }
265                                     ]
266                                 }
267                             ]
268                         }
269                     ]
270                 }
271             ]
272         }
273     ]
274 });
275 Window.init();
276 XObject.cache['/Window'] = Window;