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