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