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             for (var c in this.data.methods) {
33                 ls.append( [ c , true ]);
34             };
35             
36             
37             
38         }
39     },
40     default_height : 500,
41     default_width : 600,
42     init : function() {
43         XObject.prototype.init.call(this);
44         this.el.show_all();
45     },
46     items : [
47         {
48             xtype: Gtk.VBox,
49             items : [
50                 {
51                     xtype: Gtk.HBox,
52                     pack : "pack_start,false,false",
53                     items : [
54                         {
55                             xtype: Gtk.Button,
56                             label : "Reset"
57                         }
58                     ]
59                 },
60                 {
61                     xtype: Gtk.HBox,
62                     items : [
63                         {
64                             xtype: Gtk.ScrolledWindow,
65                             items : [
66                                 {
67                                     xtype: Gtk.TreeView,
68                                     items : [
69                                         {
70                                             xtype: Gtk.TreeModelFilter,
71                                             items : [
72                                                 {
73                                                     xtype: Gtk.ListStore,
74                                                     id : "class-list-store",
75                                                     init : function() 
76                                                             {
77                                                                 XObject.prototype.init.call(this);
78                                                                 this.el.set_column_types ( 6, [
79                                                                     GObject.TYPE_STRING, 
80                                                                     GObject.TYPE_BOOLEAN, 
81                                                                     GObject.TYPE_STRING, 
82                                                                     GObject.TYPE_STRING, 
83                                                                     GObject.TYPE_STRING, 
84                                                                     GObject.TYPE_STRING 
85                                                                 ] );
86                                                                 
87                                                             },
88                                                     pack : false
89                                                 }
90                                             ]
91                                         },
92                                         {
93                                             xtype: Gtk.TreeViewColumn,
94                                             title : "Class",
95                                             expand : true,
96                                             items : [
97                                                 {
98                                                     xtype: Gtk.CellRendererText
99                                                 }
100                                             ]
101                                         },
102                                         {
103                                             xtype: Gtk.TreeViewColumn,
104                                             title : "Active",
105                                             items : [
106                                                 {
107                                                     xtype: Gtk.CellRendererToggle,
108                                                     listeners : {
109                                                         toggled : function (self, path) {
110                                                             print("TOGGLE");
111                                                             // this.list
112                                                         
113                                                         
114                                                              
115                                                             var old = this.list.getValue(path, 1);
116                                                            // print(JSON.stringify(old));
117                                                             this.list.setValue(path, 1, old ? false : true)
118                                                             
119                                                             
120                                                             
121                                                             
122                                                         }
123                                                     },
124                                                     activatable : true
125                                                 }
126                                             ]
127                                         }
128                                     ]
129                                 }
130                             ]
131                         },
132                         {
133                             xtype: Gtk.ScrolledWindow,
134                             items : [
135                                 {
136                                     xtype: Gtk.TreeView,
137                                     items : [
138                                         {
139                                             xtype: Gtk.ListStore,
140                                             id : "method-list-store",
141                                             init : function() 
142                                                     {
143                                                         XObject.prototype.init.call(this);
144                                                         this.el.set_column_types ( 6, [
145                                                             GObject.TYPE_STRING, 
146                                                             GObject.TYPE_BOOLEAN, 
147                                                             GObject.TYPE_STRING, 
148                                                             GObject.TYPE_STRING, 
149                                                             GObject.TYPE_STRING, 
150                                                             GObject.TYPE_STRING 
151                                                         ] );
152                                                         
153                                                     }
154                                         },
155                                         {
156                                             xtype: Gtk.TreeViewColumn,
157                                             title : "Methods",
158                                             expand : true,
159                                             items : [
160                                                 {
161                                                     xtype: Gtk.CellRendererText
162                                                 }
163                                             ]
164                                         },
165                                         {
166                                             xtype: Gtk.TreeViewColumn,
167                                             title : "Active",
168                                             items : [
169                                                 {
170                                                     xtype: Gtk.CellRendererToggle,
171                                                     listeners : {
172                                                         toggled : function (self, path) {
173                                                             print("TOGGLE");
174                                                             // this.list
175                                                         
176                                                         
177                                                              
178                                                             var old = this.list.getValue(path, 1);
179                                                            // print(JSON.stringify(old));
180                                                             this.list.setValue(path, 1, old ? false : true)
181                                                             
182                                                             
183                                                             
184                                                             
185                                                         }
186                                                     },
187                                                     activatable : true
188                                                 }
189                                             ]
190                                         }
191                                     ]
192                                 }
193                             ]
194                         },
195                         {
196                             xtype: Gtk.ScrolledWindow,
197                             items : [
198                                 {
199                                     xtype: Gtk.TreeView,
200                                     items : [
201                                         {
202                                             xtype: Gtk.ListStore,
203                                             id : "children-list-store",
204                                             init : function() 
205                                                     {
206                                                         XObject.prototype.init.call(this);
207                                                         this.el.set_column_types ( 6, [
208                                                             GObject.TYPE_STRING, 
209                                                             GObject.TYPE_BOOLEAN, 
210                                                             GObject.TYPE_STRING, 
211                                                             GObject.TYPE_STRING, 
212                                                             GObject.TYPE_STRING, 
213                                                             GObject.TYPE_STRING 
214                                                         ] );
215                                                         
216                                                     }
217                                         },
218                                         {
219                                             xtype: Gtk.TreeViewColumn,
220                                             title : "Child classes",
221                                             expand : true,
222                                             items : [
223                                                 {
224                                                     xtype: Gtk.CellRendererText
225                                                 }
226                                             ]
227                                         },
228                                         {
229                                             xtype: Gtk.TreeViewColumn,
230                                             title : "Active",
231                                             items : [
232                                                 {
233                                                     xtype: Gtk.CellRendererToggle,
234                                                     listeners : {
235                                                         toggled : function (self, path) {
236                                                             print("TOGGLE");
237                                                             // this.list
238                                                         
239                                                         
240                                                              
241                                                             var old = this.list.getValue(path, 1);
242                                                            // print(JSON.stringify(old));
243                                                             this.list.setValue(path, 1, old ? false : true)
244                                                             
245                                                             
246                                                             
247                                                             
248                                                         }
249                                                     },
250                                                     activatable : true
251                                                 }
252                                             ]
253                                         }
254                                     ]
255                                 }
256                             ]
257                         }
258                     ]
259                 }
260             ]
261         }
262     ]
263 });
264 Window.init();
265 XObject.cache['/Window'] = Window;