Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / WindowRightPalete.vala
1 /* -- to compile
2 valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
3     /tmp/WindowRightPalete.vala  -o /tmp/WindowRightPalete
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_RightPalete();
11     WindowRightPalete.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16
17
18 public static Xcls_RightPalete  WindowRightPalete;
19
20 public class Xcls_RightPalete
21 {
22     public Gtk.VBox el;
23     private static Xcls_RightPalete  _this;
24
25     public Xcls_buttonbar buttonbar;
26     public Xcls_viewbox viewbox;
27     public Xcls_model model;
28     public Xcls_txtrender txtrender;
29
30         // my vars
31     public signal void drag_end();
32     public Project.Project provider;
33
34         // ctor 
35     public Xcls_RightPalete()
36     {
37         this.el = new Gtk.VBox( true, 0 );
38         _this = this;
39         WindowRightPalete = this;
40
41         // my vars
42
43         // set gobject values
44         var child_0 = new Xcls_buttonbar();
45         this.el.add (  child_0.el  );
46         var child_1 = new Xcls_viewbox();
47         this.el.add (  child_1.el  );
48     }
49
50     // userdefined functions 
51
52     // skip .signal:void:drag_end() - already used 
53
54     // skip .Project.Project:provider - already used 
55
56     // skip id - not pipe 
57
58     // skip pack - not pipe 
59
60     // skip xtype - not pipe 
61     public void hide () {
62             
63               _this.buttonbar.el.show();
64               _this.viewbox.el.hide();
65           //    print("TRIED TO HIDE");
66         }
67     public void showfunction() {
68             _this.buttonbar.el.hide();
69             _this.viewbox.el.show();
70            // this.get('model').expanded();
71                     
72         }
73
74     // skip |xns - no return type
75
76     // skip items - not pipe 
77
78     // skip xvala_cls - not pipe 
79
80     // skip xvala_xcls - not pipe 
81
82     // skip xvala_id - not pipe 
83     public class Xcls_buttonbar
84     {
85         public Gtk.VBox el;
86
87             // my vars
88
89             // ctor 
90         public Xcls_buttonbar()
91         {
92             this.el = new Gtk.VBox( true, 0 );
93             _this.buttonbar = this;
94
95             // my vars
96
97             // set gobject values
98             var child_0 = new Xcls_Button3();
99             this.el.pack_start (  child_0.el , false,true );
100             var child_1 = new Xcls_Label5();
101             this.el.add (  child_1.el  );
102         }
103
104         // userdefined functions 
105
106         // skip |xns - no return type
107
108         // skip xtype - not pipe 
109
110         // skip pack - not pipe 
111
112         // skip id - not pipe 
113
114         // skip items - not pipe 
115
116         // skip xvala_cls - not pipe 
117
118         // skip xvala_xcls - not pipe 
119
120         // skip xvala_id - not pipe 
121     }
122     public class Xcls_Button3
123     {
124         public Gtk.Button el;
125
126             // my vars
127
128             // ctor 
129         public Xcls_Button3()
130         {
131             this.el = new Gtk.Button();
132
133             // my vars
134
135             // set gobject values
136             var child_0 = new Xcls_Image4();
137             this.el.add (  child_0.el  );
138
139             // listeners 
140             this.el.clicked.connect(   (self) => {
141                 _this..show();
142             } );
143         }
144
145         // userdefined functions 
146
147         // skip listeners - not pipe 
148
149         // skip pack - not pipe 
150
151         // skip xtype - not pipe 
152
153         // skip |xns - no return type
154
155         // skip items - not pipe 
156
157         // skip xvala_cls - not pipe 
158
159         // skip xvala_xcls - not pipe 
160
161         // skip xvala_id - not pipe 
162     }
163     public class Xcls_Image4
164     {
165         public Gtk.Image el;
166
167             // my vars
168
169             // ctor 
170         public Xcls_Image4()
171         {
172             this.el = new Gtk.Image();
173
174             // my vars
175
176             // set gobject values
177             this.el.icon_size = Gtk.IconSize.MENU;
178             this.el.stock = Gtk.STOCK_GOTO_FIRST;
179         }
180
181         // userdefined functions 
182
183         // skip |xns - no return type
184
185         // skip xtype - not pipe 
186
187         // skip pack - not pipe 
188
189         // skip |stock - already used 
190
191         // skip |icon_size - already used 
192
193         // skip xvala_cls - not pipe 
194
195         // skip xvala_xcls - not pipe 
196
197         // skip xvala_id - not pipe 
198     }
199     public class Xcls_Label5
200     {
201         public Gtk.Label el;
202
203             // my vars
204
205             // ctor 
206         public Xcls_Label5()
207         {
208             this.el = new Gtk.Label( "Palete" );
209
210             // my vars
211
212             // set gobject values
213             this.el.angle = 270;
214
215             // listeners 
216             this.el.enter_notify_event.connect(  (self, event) => {
217                 RightPalete.show();
218                 return false;
219             } );
220         }
221
222         // userdefined functions 
223
224         // skip listeners - not pipe 
225
226         // skip angle - already used 
227
228         // skip label - already used 
229
230         // skip pack - not pipe 
231
232         // skip xtype - not pipe 
233
234         // skip |init - already used 
235
236         // skip |xns - no return type
237
238         // skip xvala_cls - not pipe 
239
240         // skip xvala_xcls - not pipe 
241
242         // skip xvala_id - not pipe 
243     }
244     public class Xcls_viewbox
245     {
246         public Gtk.VBox el;
247
248             // my vars
249
250             // ctor 
251         public Xcls_viewbox()
252         {
253             this.el = new Gtk.VBox( true, 0 );
254             _this.viewbox = this;
255
256             // my vars
257
258             // set gobject values
259             var child_0 = new Xcls_HBox7();
260             this.el.pack_start (  child_0.el , false,true );
261             var child_1 = new Xcls_ScrolledWindow11();
262             this.el.add (  child_1.el  );
263         }
264
265         // userdefined functions 
266
267         // skip |xns - no return type
268
269         // skip xtype - not pipe 
270
271         // skip pack - not pipe 
272
273         // skip id - not pipe 
274
275         // skip items - not pipe 
276
277         // skip xvala_cls - not pipe 
278
279         // skip xvala_xcls - not pipe 
280
281         // skip xvala_id - not pipe 
282     }
283     public class Xcls_HBox7
284     {
285         public Gtk.HBox el;
286
287             // my vars
288
289             // ctor 
290         public Xcls_HBox7()
291         {
292             this.el = new Gtk.HBox( true, 0 );
293
294             // my vars
295
296             // set gobject values
297             var child_0 = new Xcls_Label8();
298             this.el.add (  child_0.el  );
299             var child_1 = new Xcls_Button9();
300             this.el.pack_start (  child_1.el , false,true );
301         }
302
303         // userdefined functions 
304
305         // skip |xns - no return type
306
307         // skip xtype - not pipe 
308
309         // skip pack - not pipe 
310
311         // skip items - not pipe 
312
313         // skip xvala_cls - not pipe 
314
315         // skip xvala_xcls - not pipe 
316
317         // skip xvala_id - not pipe 
318     }
319     public class Xcls_Label8
320     {
321         public Gtk.Label el;
322
323             // my vars
324
325             // ctor 
326         public Xcls_Label8()
327         {
328             this.el = new Gtk.Label( "Palete" );
329
330             // my vars
331
332             // set gobject values
333         }
334
335         // userdefined functions 
336
337         // skip |xns - no return type
338
339         // skip xtype - not pipe 
340
341         // skip pack - not pipe 
342
343         // skip label - already used 
344
345         // skip xvala_cls - not pipe 
346
347         // skip xvala_xcls - not pipe 
348
349         // skip xvala_id - not pipe 
350     }
351     public class Xcls_Button9
352     {
353         public Gtk.Button el;
354
355             // my vars
356
357             // ctor 
358         public Xcls_Button9()
359         {
360             this.el = new Gtk.Button();
361
362             // my vars
363
364             // set gobject values
365             var child_0 = new Xcls_Image10();
366             this.el.add (  child_0.el  );
367
368             // listeners 
369             this.el.clicked.connect( function (self) {
370                 _this.RightPalete.hide();
371             } );
372         }
373
374         // userdefined functions 
375
376         // skip listeners - not pipe 
377
378         // skip pack - not pipe 
379
380         // skip xtype - not pipe 
381
382         // skip |xns - no return type
383
384         // skip items - not pipe 
385
386         // skip xvala_cls - not pipe 
387
388         // skip xvala_xcls - not pipe 
389
390         // skip xvala_id - not pipe 
391     }
392     public class Xcls_Image10
393     {
394         public Gtk.Image el;
395
396             // my vars
397
398             // ctor 
399         public Xcls_Image10()
400         {
401             this.el = new Gtk.Image();
402
403             // my vars
404
405             // set gobject values
406             this.el.icon_size = Gtk.IconSize.MENU;
407             this.el.stock = Gtk.STOCK_GOTO_LAST;
408         }
409
410         // userdefined functions 
411
412         // skip |xns - no return type
413
414         // skip xtype - not pipe 
415
416         // skip pack - not pipe 
417
418         // skip |stock - already used 
419
420         // skip |icon_size - already used 
421
422         // skip xvala_cls - not pipe 
423
424         // skip xvala_xcls - not pipe 
425
426         // skip xvala_id - not pipe 
427     }
428     public class Xcls_ScrolledWindow11
429     {
430         public Gtk.ScrolledWindow el;
431
432             // my vars
433
434             // ctor 
435         public Xcls_ScrolledWindow11()
436         {
437             this.el = new Gtk.ScrolledWindow( null, null );
438
439             // my vars
440
441             // set gobject values
442             this.el.shadow_type = Gtk.ShadowType.IN;
443             var child_0 = new Xcls_TreeView12();
444             this.el.add (  child_0.el  );
445         }
446
447         // userdefined functions 
448
449         // skip pack - not pipe 
450
451         // skip xtype - not pipe 
452
453         // skip |init - already used 
454
455         // skip |shadow_type - already used 
456
457         // skip |xns - no return type
458
459         // skip items - not pipe 
460
461         // skip xvala_cls - not pipe 
462
463         // skip xvala_xcls - not pipe 
464
465         // skip xvala_id - not pipe 
466     }
467     public class Xcls_TreeView12
468     {
469         public Gtk.TreeView el;
470
471             // my vars
472         public GLib.List dropList;
473         public string dragData;
474
475             // ctor 
476         public Xcls_TreeView12()
477         {
478             this.el = new Gtk.TreeView();
479
480             // my vars
481
482             // set gobject values
483             this.el.enable_tree_lines = true;
484             this.el.headers_visible = false;
485             var child_0 = new Xcls_model();
486             this.el.set_model (  child_0.el  );
487             var child_1 = new Xcls_TreeViewColumn14();
488             this.el.append_column (  child_1.el  );
489
490             // listeners 
491             this.el.drag_begin.connect(   ( ctx) => {
492                 // we could fill this in now...
493             //        Seed.print('SOURCE: drag-begin');
494                     
495                     
496                     
497                     Gtk.TreeIter iter;
498                     var s = _this.selection;
499                     
500                     s.get_selected(_this.model.el, out iter);
501                     var path = _this.model.el.get_path(iter);
502                     
503                     /// pix is a surface..
504                     var pix = this.el.create_row_drag_icon ( path);
505                         
506                             
507                     Gtk.drag_set_icon_surface (ctx, pix);
508                     Glib.Value val;
509                     
510             
511                     _this.model.el.get_value(iter, 0, out value);
512                     if (_this.provider == null) {
513                         return false;
514                     }
515                     //if (!this.get('/RightPalete').provider) {
516                     //    return false;
517                     //}
518                     this.dropList = _this.provider.getDropList((string)value);
519                     this.dragData = (string) value;
520                      
521                     
522                     return true;
523             } );
524             this.el.drag_data_get.connect(   (drag_context, selection_data, info, time) => {
525                 //Seed.print('Palete: drag-data-get: ' + target_type);
526                     if (this.el.dragData.length > 0 ) {
527                         selection_data.set_text(this.dragData ,this.dragData.length);
528                     }
529                     
530                     
531                     //this.el.dragData = "TEST from source widget";
532                     
533                     
534             } );
535             this.el.drag_end.connect( ( drag_context)  => {
536                 //Seed.print('SOURCE: drag-end');
537                 
538                 this.dragData = "";
539                 this.dropList = null;
540                 _this.drag_end(); // call signal..
541                 //this.get('/LeftTree.view').highlight(false);
542                 return true;
543             } );
544             this.el.button_press_event.connect(  ( event) => {
545             
546              // if (!this.get('/Editor').save()) {
547              //     // popup!! - click handled.. 
548             //      return true;
549             //        }
550                 return false;
551             } );
552         }
553
554         // userdefined functions 
555
556         // skip listeners - not pipe 
557
558         // skip .GLib.List:dropList - already used 
559
560         // skip .string:dragData - already used 
561
562         // skip pack - not pipe 
563
564         // skip xtype - not pipe 
565
566         // skip |enable_tree_lines - already used 
567
568         // skip |headers_visible - already used 
569
570         // skip |init - already used 
571
572         // skip |xns - no return type
573
574         // skip items - not pipe 
575
576         // skip xvala_cls - not pipe 
577
578         // skip xvala_xcls - not pipe 
579
580         // skip xvala_id - not pipe 
581     }
582     public class Xcls_model
583     {
584         public Gtk.ListStore el;
585
586             // my vars
587
588             // ctor 
589         public Xcls_model()
590         {
591             this.el = new Gtk.ListStore( 2, "typeof(string),typeof(string)" );
592             _this.model = this;
593
594             // my vars
595
596             // set gobject values
597         }
598
599         // userdefined functions 
600
601         // skip columns - already used 
602
603         // skip id - not pipe 
604
605         // skip n_columns - already used 
606
607         // skip pack - not pipe 
608
609         // skip xtype - not pipe 
610         public void load (GLib.List<string> tr, Gtk.TreeIter? iter)
611             {
612                 if (iter == null) {
613                     this.el.clear();
614                 }
615                 //console.log('Project tree load: ' + tr.length);
616             
617                 Gtk.TreeIter citer;
618                 //this.insert(citer,iter,0);
619                 for(var i =0 ; i < tr.length(); i++) {
620                     if (iter == null) {
621                         
622                         this.el.append(out citer);   
623                     } else {
624                         this.el.insert(out citer,iter,-1);
625                     }
626                     
627                     var r = tr.nth_data(i);
628                     //Seed.print(r);
629                     this.el.set_value(citer, 0,   r ); // title 
630                     
631                     //this.el.set_value(citer, 1,  new GObject.Value( r)); //id
632                     //if (r.cn && r.cn.length) {
633                     //    this.load(r.cn, citer);
634                     //}
635                 }
636                 
637                 
638             }
639         public string getValue (Gtk.TreeIter iter, int col)  {
640                 GLib.Value gval;
641                  this.el.get_value(iter, col , out gval);
642                 return  (string)gval;
643                 
644                 
645             }
646
647         // skip |xns - no return type
648
649         // skip xvala_cls - not pipe 
650
651         // skip xvala_xcls - not pipe 
652
653         // skip xvala_id - not pipe 
654     }
655     public class Xcls_TreeViewColumn14
656     {
657         public Gtk.TreeViewColumn el;
658
659             // my vars
660
661             // ctor 
662         public Xcls_TreeViewColumn14()
663         {
664             this.el = new Gtk.TreeViewColumn();
665
666             // my vars
667
668             // set gobject values
669             var child_0 = new Xcls_txtrender();
670             this.el.pack_start (  child_0.el  );
671         }
672
673         // userdefined functions 
674
675         // skip pack - not pipe 
676
677         // skip xtype - not pipe 
678
679         // skip |init - already used 
680
681         // skip |xns - no return type
682
683         // skip items - not pipe 
684
685         // skip xvala_cls - not pipe 
686
687         // skip xvala_xcls - not pipe 
688
689         // skip xvala_id - not pipe 
690     }
691     public class Xcls_txtrender
692     {
693         public Gtk.CellRendererText el;
694
695             // my vars
696
697             // ctor 
698         public Xcls_txtrender()
699         {
700             this.el = new Gtk.CellRendererText();
701             _this.txtrender = this;
702
703             // my vars
704
705             // set gobject values
706         }
707
708         // userdefined functions 
709
710         // skip id - not pipe 
711
712         // skip pack - not pipe 
713
714         // skip xtype - not pipe 
715
716         // skip |xns - no return type
717
718         // skip xvala_cls - not pipe 
719
720         // skip xvala_xcls - not pipe 
721
722         // skip xvala_id - not pipe 
723     }
724 }