1 static DialogSaveTemplate _DialogSaveTemplate;
3 public class DialogSaveTemplate : Object
6 private DialogSaveTemplate _this;
8 public static DialogSaveTemplate singleton()
10 if (_DialogSaveTemplate == null) {
11 _DialogSaveTemplate= new DialogSaveTemplate();
13 return _DialogSaveTemplate;
15 public Xcls_name name;
18 public JsRender.Node data;
19 public Palete.Palete palete;
22 public DialogSaveTemplate()
25 this.el = new Gtk.Dialog();
30 this.el.default_height = 200;
31 this.el.default_width = 400;
33 var child_0 = new Xcls_Box2( _this );
35 this.el.get_content_area().append ( child_0.el );
36 var child_1 = new Xcls_Button5( _this );
38 this.el.add_action_widget ( child_1.el , 0 );
39 var child_2 = new Xcls_Button6( _this );
41 this.el.add_action_widget ( child_2.el , 1 );
44 this.el.close_request.connect( ( ) => {
46 this.el.response(Gtk.ResponseType.CANCEL);
50 this.el.response.connect( (response_id) => {
52 if (response_id < 1) {
57 var name = _this.name.el.get_text();
58 if (name.length < 1) {
59 Xcls_StandardErrorDialog.singleton().show(
61 "You must give the template a name. "
65 if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9. ]+$", name) )
67 Xcls_StandardErrorDialog.singleton().show(
69 "Template Name must contain only letters dots"
74 this.palete.saveTemplate(name, data);
83 // user defined functions
84 public void showIt (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {
87 this.el.set_transient_for(parent);
90 this.name.el.set_text("");
97 public class Xcls_Box2 : Object
100 private DialogSaveTemplate _this;
106 public Xcls_Box2(DialogSaveTemplate _owner )
109 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
113 // set gobject values
114 var child_0 = new Xcls_Label3( _this );
116 this.el.append ( child_0.el );
117 var child_1 = new Xcls_name( _this );
119 this.el.append ( child_1.el );
122 // user defined functions
124 public class Xcls_Label3 : Object
127 private DialogSaveTemplate _this;
133 public Xcls_Label3(DialogSaveTemplate _owner )
136 this.el = new Gtk.Label( "Name" );
140 // set gobject values
143 // user defined functions
146 public class Xcls_name : Object
149 private DialogSaveTemplate _this;
155 public Xcls_name(DialogSaveTemplate _owner )
159 this.el = new Gtk.Entry();
163 // set gobject values
166 // user defined functions
170 public class Xcls_Button5 : Object
172 public Gtk.Button el;
173 private DialogSaveTemplate _this;
179 public Xcls_Button5(DialogSaveTemplate _owner )
182 this.el = new Gtk.Button();
186 // set gobject values
187 this.el.label = "Cancel";
190 // user defined functions
193 public class Xcls_Button6 : Object
195 public Gtk.Button el;
196 private DialogSaveTemplate _this;
202 public Xcls_Button6(DialogSaveTemplate _owner )
205 this.el = new Gtk.Button();
209 // set gobject values
210 this.el.label = "OK";
213 // user defined functions