1 static DialogTemplateSelect _DialogTemplateSelect;
3 public class DialogTemplateSelect : Object
6 private DialogTemplateSelect _this;
8 public static DialogTemplateSelect singleton()
10 if (_DialogTemplateSelect == null) {
11 _DialogTemplateSelect= new DialogTemplateSelect();
13 return _DialogTemplateSelect;
15 public Xcls_combo combo;
16 public Xcls_cellrenderer cellrenderer;
17 public Xcls_model model;
18 public Xcls_combo combo;
19 public Xcls_cellrenderer cellrenderer;
20 public Xcls_model model;
25 public DialogTemplateSelect()
28 this.el = new Gtk.Dialog();
33 this.el.title = "Add an Object";
34 this.el.default_height = 200;
35 this.el.default_width = 400;
37 var child_0 = new Xcls_VBox2( _this );
39 this.el.get_content_area().add ( child_0.el );
40 var child_1 = new Xcls_Button12( _this );
42 this.el.add_action_widget ( child_1.el , 0 );
43 var child_2 = new Xcls_Button13( _this );
45 this.el.add_action_widget ( child_2.el , 1 );
46 var child_3 = new Xcls_Button14( _this );
48 this.el.add_action_widget ( child_3.el , 2 );
51 this.el.delete_event.connect( (self, event) =>{
57 // user defined functions
58 public JsRender.Node? show (Gtk.Window pwindow, Palete.Palete pal, JsRender.Node node) {
61 var opts = pal.listTemplates(node);
62 if (opts.length() < 1) {
66 this.el.set_attached_to( pwindow);
67 this.el.set_transient_for( pwindow);
69 //opts.unshift({ path: '' , name :'Just add Element' });
70 _this.model.loadData(opts);
71 _this.combo.el.set_active(0);
74 var res = this.el.run();
76 //var ix = _this.combo.el.get_active();
78 return null; // 0 = cancel.
81 return node; // 1 = just add it..
85 _this.combo.el.get_active_iter (out iter);
87 this.model.el.get_value (iter, 0, out vfname);
90 return pal.loadTemplate((string)vfname);
93 public class Xcls_VBox2 : Object
96 private DialogTemplateSelect _this;
102 public Xcls_VBox2(DialogTemplateSelect _owner )
105 this.el = new Gtk.VBox( true, 0 );
109 // set gobject values
110 var child_0 = new Xcls_HBox3( _this );
112 this.el.pack_start ( child_0.el , false,false,0 );
115 // user defined functions
117 public class Xcls_HBox3 : Object
120 private DialogTemplateSelect _this;
126 public Xcls_HBox3(DialogTemplateSelect _owner )
129 this.el = new Gtk.HBox( true, 0 );
133 // set gobject values
134 var child_0 = new Xcls_Label4( _this );
136 this.el.pack_start ( child_0.el , false,false );
137 var child_1 = new Xcls_combo( _this );
139 this.el.add ( child_1.el );
140 var child_2 = new Xcls_Label8( _this );
142 this.el.pack_start ( child_2.el , false,false );
143 var child_3 = new Xcls_combo( _this );
145 this.el.add ( child_3.el );
148 // user defined functions
150 public class Xcls_Label4 : Object
153 private DialogTemplateSelect _this;
159 public Xcls_Label4(DialogTemplateSelect _owner )
162 this.el = new Gtk.Label( "Select Template : " );
166 // set gobject values
169 // user defined functions
171 public class Xcls_combo : Object
173 public Gtk.ComboBox el;
174 private DialogTemplateSelect _this;
180 public Xcls_combo(DialogTemplateSelect _owner )
184 this.el = new Gtk.ComboBox();
188 // set gobject values
189 var child_0 = new Xcls_cellrenderer( _this );
191 this.el.pack_start ( child_0.el , true );
192 var child_1 = new Xcls_model( _this );
194 this.el.set_model ( child_1.el );
198 this.el.add_attribute(_this.cellrenderer.el , "markup", 1 );
201 // user defined functions
203 public class Xcls_cellrenderer : Object
205 public Gtk.CellRendererText el;
206 private DialogTemplateSelect _this;
212 public Xcls_cellrenderer(DialogTemplateSelect _owner )
215 _this.cellrenderer = this;
216 this.el = new Gtk.CellRendererText();
220 // set gobject values
223 // user defined functions
225 public class Xcls_model : Object
227 public Gtk.ListStore el;
228 private DialogTemplateSelect _this;
234 public Xcls_model(DialogTemplateSelect _owner )
238 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
242 // set gobject values
245 // user defined functions
246 public void loadData (GLib.List<string> data) {
251 /// el.append(out iter);
254 // el.set_value(iter, 0, "");
255 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
257 for (var i = 0; i < data.length();i++) {
261 var str = data.nth_data(i);
262 var fn = Path.get_basename (str);
263 fn.replace(".json", "");
265 el.set_value(iter, 0, str);
266 el.set_value(iter, 1, fn);
269 this.el.set_sort_column_id(1, Gtk.SortType.ASCENDING);
273 public class Xcls_Label8 : Object
276 private DialogTemplateSelect _this;
282 public Xcls_Label8(DialogTemplateSelect _owner )
285 this.el = new Gtk.Label( "Select Database Table : " );
289 // set gobject values
292 // user defined functions
294 public class Xcls_combo : Object
296 public Gtk.ComboBox el;
297 private DialogTemplateSelect _this;
303 public Xcls_combo(DialogTemplateSelect _owner )
307 this.el = new Gtk.ComboBox();
311 // set gobject values
312 var child_0 = new Xcls_cellrenderer( _this );
314 this.el.pack_start ( child_0.el , true );
315 var child_1 = new Xcls_model( _this );
317 this.el.set_model ( child_1.el );
321 this.el.add_attribute(_this.cellrenderer.el , "markup", 1 );
324 // user defined functions
326 public class Xcls_cellrenderer : Object
328 public Gtk.CellRendererText el;
329 private DialogTemplateSelect _this;
335 public Xcls_cellrenderer(DialogTemplateSelect _owner )
338 _this.cellrenderer = this;
339 this.el = new Gtk.CellRendererText();
343 // set gobject values
346 // user defined functions
348 public class Xcls_model : Object
350 public Gtk.ListStore el;
351 private DialogTemplateSelect _this;
357 public Xcls_model(DialogTemplateSelect _owner )
361 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
365 // set gobject values
368 // user defined functions
369 public void loadData (GLib.List<string> data) {
374 /// el.append(out iter);
377 // el.set_value(iter, 0, "");
378 // el.set_value(iter, 1, "aaa - Just add Element - aaa");
380 for (var i = 0; i < data.length();i++) {
384 var str = data.nth_data(i);
385 var fn = Path.get_basename (str);
386 fn.replace(".json", "");
388 el.set_value(iter, 0, str);
389 el.set_value(iter, 1, fn);
392 this.el.set_sort_column_id(1, Gtk.SortType.ASCENDING);
396 public class Xcls_Button12 : Object
398 public Gtk.Button el;
399 private DialogTemplateSelect _this;
405 public Xcls_Button12(DialogTemplateSelect _owner )
408 this.el = new Gtk.Button();
412 // set gobject values
413 this.el.label = "Cancel";
416 // user defined functions
418 public class Xcls_Button13 : Object
420 public Gtk.Button el;
421 private DialogTemplateSelect _this;
427 public Xcls_Button13(DialogTemplateSelect _owner )
430 this.el = new Gtk.Button();
434 // set gobject values
435 this.el.label = "Just add it";
438 // user defined functions
440 public class Xcls_Button14 : Object
442 public Gtk.Button el;
443 private DialogTemplateSelect _this;
449 public Xcls_Button14(DialogTemplateSelect _owner )
452 this.el = new Gtk.Button();
456 // set gobject values
457 this.el.label = "OK";
460 // user defined functions