900a67196f15b79b9f08f35923dbc4043293e25a
[app.Builder.js] / src / Builder4 / GtkView.vala
1 static Xcls_GtkView  _GtkView;
2
3 public class Xcls_GtkView : Object 
4 {
5     public Gtk.VPaned el;
6     private Xcls_GtkView  _this;
7
8     public static Xcls_GtkView singleton()
9     {
10         if (_GtkView == null) {
11             _GtkView= new Xcls_GtkView();
12         }
13         return _GtkView;
14     }
15     public Xcls_view_layout view_layout;
16     public Xcls_container container;
17     public Xcls_compile_view compile_view;
18
19         // my vars (def)
20     public Gtk.Widget lastObj;
21     public int width;
22     public JsRender.JsRender file;
23     public int height;
24
25     // ctor 
26     public Xcls_GtkView()
27     {
28         _this = this;
29         this.el = new Gtk.VPaned();
30
31         // my vars (dec)
32         this.lastObj = null;
33         this.width = 0;
34         this.file = null;
35         this.height = 0;
36
37         // set gobject values
38         var child_0 = new Xcls_ScrolledWindow2( _this );
39         child_0.ref();
40         this.el.pack1 (  child_0.el , true,true );
41         var child_1 = new Xcls_compile_view( _this );
42         child_1.ref();
43         this.el.pack2 (  child_1.el , true,true );
44
45         // listeners 
46         this.el.size_allocate.connect( (aloc) => {
47         
48             this.width = aloc.width;
49             this.height =aloc.height;
50             });
51     }
52
53     // user defined functions 
54     public void createThumb () {
55         
56         
57         if (this.file == null) {
58             return;
59         }
60         var filename = this.file.getIconFileName(false);
61         
62         var  win = this.el.get_parent_window();
63         var width = win.get_width();
64         var height = win.get_height();
65     
66         Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
67     
68         screenshot.save(filename,"png");
69         return;
70         
71         
72         
73         
74         
75          
76         
77         // should we hold until it's printed...
78         
79           
80     
81         
82         
83     
84     
85         
86          
87     }
88     public void loadFile (JsRender.JsRender file) 
89     {
90         
91            // this.el.set_position((int)(this.el.max_position * 0.7));
92             this.el.set_position(this.el.max_position );
93             this.file = null;
94             
95             if (file.tree == null) {
96                 return;
97             }
98             this.file = file;
99             if (this.lastObj != null) {
100                 this.container.el.remove(this.lastObj);
101             }
102             
103             // hide the compile view at present..
104               
105             
106             var w = _this.el.get_allocated_width();
107             var h = _this.el.get_allocated_height();
108             
109             print("ALLOC SET SIZES %d, %d\n", w,h); 
110             
111             // set the container size min to 500/500 or 20 px less than max..
112             w = int.max (w-20, 500);
113             h = int.max (h-20, 500); 
114             
115             print("SET SIZES %d, %d\n", w,h);       
116             _this.container.el.set_size_request(w,h);
117             
118             _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.
119             var rgba = Gdk.RGBA ();
120             rgba.parse ("#ccc");
121             _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);
122             
123             
124         var x = new JsRender.NodeToGtk(file.tree);
125             var obj = x.munge() as Gtk.Widget;
126             this.lastObj = null;
127         if (obj == null) {
128                 return;
129         }
130         this.lastObj = obj;
131             
132             this.container.el.add(obj);
133             obj.show_all();
134             
135              
136             
137     }
138     public class Xcls_ScrolledWindow2 : Object 
139     {
140         public Gtk.ScrolledWindow el;
141         private Xcls_GtkView  _this;
142
143
144             // my vars (def)
145
146         // ctor 
147         public Xcls_ScrolledWindow2(Xcls_GtkView _owner )
148         {
149             _this = _owner;
150             this.el = new Gtk.ScrolledWindow( null, null );
151
152             // my vars (dec)
153
154             // set gobject values
155             var child_0 = new Xcls_view_layout( _this );
156             child_0.ref();
157             this.el.add (  child_0.el  );
158         }
159
160         // user defined functions 
161     }
162     public class Xcls_view_layout : Object 
163     {
164         public Gtk.Layout el;
165         private Xcls_GtkView  _this;
166
167
168             // my vars (def)
169
170         // ctor 
171         public Xcls_view_layout(Xcls_GtkView _owner )
172         {
173             _this = _owner;
174             _this.view_layout = this;
175             this.el = new Gtk.Layout( null, null );
176
177             // my vars (dec)
178
179             // set gobject values
180             var child_0 = new Xcls_container( _this );
181             child_0.ref();
182             this.el.put (  child_0.el , 10,10 );
183         }
184
185         // user defined functions 
186     }
187     public class Xcls_container : Object 
188     {
189         public Gtk.HBox el;
190         private Xcls_GtkView  _this;
191
192
193             // my vars (def)
194
195         // ctor 
196         public Xcls_container(Xcls_GtkView _owner )
197         {
198             _this = _owner;
199             _this.container = this;
200             this.el = new Gtk.HBox( true, 0 );
201
202             // my vars (dec)
203
204             // set gobject values
205         }
206
207         // user defined functions 
208     }
209     public class Xcls_compile_view : Object 
210     {
211         public Gtk.VBox el;
212         private Xcls_GtkView  _this;
213
214
215             // my vars (def)
216
217         // ctor 
218         public Xcls_compile_view(Xcls_GtkView _owner )
219         {
220             _this = _owner;
221             _this.compile_view = this;
222             this.el = new Gtk.VBox( false, 0 );
223
224             // my vars (dec)
225
226             // set gobject values
227             var child_0 = new Xcls_HBox6( _this );
228             child_0.ref();
229             this.el.pack_start (  child_0.el , false,false,0 );
230             var child_1 = new Xcls_HBox8( _this );
231             child_1.ref();
232             this.el.pack_start (  child_1.el , true,true,0 );
233         }
234
235         // user defined functions 
236     }
237     public class Xcls_HBox6 : Object 
238     {
239         public Gtk.HBox el;
240         private Xcls_GtkView  _this;
241
242
243             // my vars (def)
244
245         // ctor 
246         public Xcls_HBox6(Xcls_GtkView _owner )
247         {
248             _this = _owner;
249             this.el = new Gtk.HBox( true, 0 );
250
251             // my vars (dec)
252
253             // set gobject values
254             var child_0 = new Xcls_Button7( _this );
255             child_0.ref();
256             this.el.pack_start (  child_0.el , true,true,0 );
257         }
258
259         // user defined functions 
260     }
261     public class Xcls_Button7 : Object 
262     {
263         public Gtk.Button el;
264         private Xcls_GtkView  _this;
265
266
267             // my vars (def)
268
269         // ctor 
270         public Xcls_Button7(Xcls_GtkView _owner )
271         {
272             _this = _owner;
273             this.el = new Gtk.Button();
274
275             // my vars (dec)
276
277             // set gobject values
278             this.el.label = "Full Compile";
279         }
280
281         // user defined functions 
282     }
283     public class Xcls_HBox8 : Object 
284     {
285         public Gtk.HBox el;
286         private Xcls_GtkView  _this;
287
288
289             // my vars (def)
290
291         // ctor 
292         public Xcls_HBox8(Xcls_GtkView _owner )
293         {
294             _this = _owner;
295             this.el = new Gtk.HBox( true, 0 );
296
297             // my vars (dec)
298
299             // set gobject values
300             var child_0 = new Xcls_TreeView9( _this );
301             child_0.ref();
302             this.el.add (  child_0.el  );
303             var child_1 = new Xcls_ScrolledWindow13( _this );
304             child_1.ref();
305             this.el.pack_start (  child_1.el , true,true,0 );
306         }
307
308         // user defined functions 
309     }
310     public class Xcls_TreeView9 : Object 
311     {
312         public Gtk.TreeView el;
313         private Xcls_GtkView  _this;
314
315
316             // my vars (def)
317
318         // ctor 
319         public Xcls_TreeView9(Xcls_GtkView _owner )
320         {
321             _this = _owner;
322             this.el = new Gtk.TreeView();
323
324             // my vars (dec)
325
326             // set gobject values
327             var child_0 = new Xcls_ListStore10( _this );
328             child_0.ref();
329             this.el.set_model (  child_0.el  );
330             var child_1 = new Xcls_column( _this );
331             child_1.ref();
332         }
333
334         // user defined functions 
335     }
336     public class Xcls_ListStore10 : Object 
337     {
338         public Gtk.ListStore el;
339         private Xcls_GtkView  _this;
340
341
342             // my vars (def)
343
344         // ctor 
345         public Xcls_ListStore10(Xcls_GtkView _owner )
346         {
347             _this = _owner;
348             this.el = new Gtk.ListStore( 1,   typeof(string) );
349
350             // my vars (dec)
351
352             // set gobject values
353         }
354
355         // user defined functions 
356     }
357     public class Xcls_column : Object 
358     {
359         public Gtk.TreeViewColumn el;
360         private Xcls_GtkView  _this;
361
362
363             // my vars (def)
364
365         // ctor 
366         public Xcls_column(Xcls_GtkView _owner )
367         {
368             _this = _owner;
369             this.el = new Gtk.TreeViewColumn();
370
371             // my vars (dec)
372
373             // set gobject values
374             this.el.title = "Compile output";
375             var child_0 = new Xcls_CellRendererText12( _this );
376             child_0.ref();
377             this.el.pack_start (  child_0.el , false );
378         }
379
380         // user defined functions 
381     }
382     public class Xcls_CellRendererText12 : Object 
383     {
384         public Gtk.CellRendererText el;
385         private Xcls_GtkView  _this;
386
387
388             // my vars (def)
389
390         // ctor 
391         public Xcls_CellRendererText12(Xcls_GtkView _owner )
392         {
393             _this = _owner;
394             this.el = new Gtk.CellRendererText();
395
396             // my vars (dec)
397
398             // set gobject values
399         }
400
401         // user defined functions 
402     }
403     public class Xcls_ScrolledWindow13 : Object 
404     {
405         public Gtk.ScrolledWindow el;
406         private Xcls_GtkView  _this;
407
408
409             // my vars (def)
410
411         // ctor 
412         public Xcls_ScrolledWindow13(Xcls_GtkView _owner )
413         {
414             _this = _owner;
415             this.el = new Gtk.ScrolledWindow( null, null );
416
417             // my vars (dec)
418
419             // set gobject values
420             var child_0 = new Xcls_View14( _this );
421             child_0.ref();
422             this.el.add (  child_0.el  );
423         }
424
425         // user defined functions 
426     }
427     public class Xcls_View14 : Object 
428     {
429         public Gtk.SourceView el;
430         private Xcls_GtkView  _this;
431
432
433             // my vars (def)
434
435         // ctor 
436         public Xcls_View14(Xcls_GtkView _owner )
437         {
438             _this = _owner;
439             this.el = new Gtk.SourceView();
440
441             // my vars (dec)
442
443             // set gobject values
444             this.el.editable = false;
445             this.el.show_line_marks = true;
446             this.el.show_line_numbers = true;
447         }
448
449         // user defined functions 
450     }
451 }