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