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