2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# JsRender.NodeProp? prop" : "",
8 "* ctor" : "new Gtk.Popover()",
9 "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
10 "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
11 "JsRender.Node node" : "",
12 "Xcls_MainWindow mainwindow" : "null",
13 "bool autohide" : true,
15 "bool is_new" : false,
16 "id" : "PopoverProperty",
20 "* pack" : "set_child",
21 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
22 "bool homogeneous" : false,
26 "bool show_title_buttons" : false,
31 "* prop" : "title_widget",
33 "string label" : "Add / Edit property",
41 "bool show_row_separators" : true,
42 "bool show_separators" : true,
52 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp));",
57 "\tthis.el.append( new JsRender.NodeProp.prop(\"\"));",
58 "\tthis.el.append( new JsRender.NodeProp.raw(\"\"));",
59 "\tthis.el.append( new JsRender.NodeProp.valamethod(\"\"));",
60 "\tthis.el.append( new JsRender.NodeProp.special(\"\"));\t",
61 "\tthis.el.append( new JsRender.NodeProp.listener(\"\"));\t\t",
62 "\tthis.el.append( new JsRender.NodeProp.user(\"\"));\t",
63 "\tthis.el.append( new JsRender.NodeProp.sig(\"\"));\t",
74 "xtype" : "SingleSelection"
78 "* pack" : "append_column",
87 " \tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child(); ",
88 " \tvar np = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
92 "\tlbl.label = np.ptype.to_name();",
101 "\tvar label = new Gtk.Label(\"\");",
102 "\tlabel.xalign = 0;",
104 "\t((Gtk.ListItem)listitem).set_child(label);",
105 "\t((Gtk.ListItem)listitem).activatable = false;",
111 "xtype" : "SignalListItemFactory"
114 "string title" : "Property Type",
115 "xtype" : "ColumnViewColumn"
118 "xtype" : "ColumnView",
119 "| JsRender.NodePropType getValue" : [
122 "\tvar li = (JsRender.NodeProp) _this.pmodel.el.get_item(",
123 "\t\t_this.pselmodel.el.get_selected()",
125 "\treturn li.ptype;",
129 "| void setValue" : [
130 "(JsRender.NodePropType pt) ",
132 " \tfor (var i = 0; i < _this.pmodel.el.n_items; i++) {",
133 "\t \tvar li = (JsRender.NodeProp) _this.pmodel.el.get_item(i);",
134 " \t\tif (li.ptype == pt) {",
135 " \t\t\t_this.pselmodel.el.set_selected(i);",
139 "\tGLib.debug(\"failed to set selected ptype\");",
140 "\t_this.pselmodel.el.set_selected(0);",
147 "Gtk.Align halign" : "Gtk.Align.START",
148 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
149 "int margin_top" : 12,
150 "label" : "Type or Return Type",
163 "Gtk.Align halign" : "Gtk.Align.START",
164 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
165 "int margin_top" : 12,
167 "tooltip_text" : "center, north, south, east, west",
182 " _this.error.setError(\"\");",
183 "\tvar val = _this.kname.el.get_text().strip(); ",
184 "\tif (val.length < 1) {",
185 "\t\t_this.error.setError(\"Name can not be empty\");",
192 "xtype" : "EventControllerFocus"
198 "(keyval, keycode, state) => {",
200 " _this.error.setError(\"\");",
201 "\tvar val = _this.kname.el.get_text().strip(); ",
202 "\tif (val.length < 1) {",
203 "\t\t_this.error.setError(\"Name can not be empty\");",
210 "xtype" : "EventControllerKey"
218 "Gtk.Align halign" : "Gtk.Align.START",
219 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
220 "bool use_markup" : true,
222 "int margin_top" : 0,
223 "label" : "<span color=\"red\">Error Message</span>",
224 "tooltip_text" : "center, north, south, east, west",
227 "| void setError" : [
229 "\tif (err == \"\") {",
230 "\t\tthis.el.label = \"\";",
234 "\t\tthis.el.label = \"<span color=\\\"red\\\">\" + err + \"</span>\";",
242 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
244 "int margin_top" : 20,
248 "bool always_show_image" : true,
249 "bool hexpand" : true,
253 "\t_this.prop = null;",
254 "\t_this.is_new = false;",
255 "\t_this.kname.el.set_text(\"Cancel\");",
256 "\t_this.el.hide();",
261 "string label" : "Cancel",
266 "bool always_show_image" : true,
267 "bool hexpand" : true,
271 "\t// check if text is not empty..",
272 "\tif ( _this.kname.el.get_text().strip().length < 1) {",
274 "\t\t// error should already be showing?",
278 "\t// since we can't add listeners?!?!?",
279 "\t// only check props.",
280 "\t// check if property already exists in node.\t",
283 "\tvar prop = new JsRender.NodeProp(",
284 "\t\t_this.kname.el.get_text().strip(),",
285 "\t\t_this.ptype.getValue(),",
286 "\t\t_this.ktype.el.get_text().strip(),",
287 "\t\t_this.prop.val",
290 "\tif (_this.node.props.has_key(prop.to_index_key())) {",
291 "\t\t_this.error.setError(\"Property already exists\");",
297 "\t_this.node.add_prop(prop);",
299 "\t_this.prop = null; // skip checks..",
300 "\t_this.is_new = false;",
301 "\t_this.el.hide();",
303 "\t_this.mainwindow.windowstate.left_props.view.editProp(prop);",
310 "string label" : "Add Property",
324 " \tGLib.debug(\"popover closed\");",
325 "\tif (_this.is_new) {",
326 "\t\t// dont allow hiding if we are creating a new one.",
327 "\t\t// on.hide will reshow it.",
330 "\tif (_this.prop == null) {",
331 "\t\t// hide and dont update.",
334 "\tif (this.kname.el.get_text().strip().length < 1) {",
341 " \tthis.updateProp();",
351 " \tGLib.debug(\"popover hidden\");",
352 "\tif (_this.is_new || this.kname.el.get_text().strip().length < 1) {",
353 "\t\t// dont allow hiding if we are creating a new one.",
354 "\t\tGLib.debug(\"prevent hiding as its new or text is empty\"); ",
355 "\t\tthis.el.show();",
363 "string key_type" : "",
364 "string old_keyname" : "",
368 "\tGtk.Widget btn, ",
369 "\tJsRender.Node node, ",
370 "\tJsRender.NodeProp prop, ",
372 "\tbool is_new = false",
377 "\tthis.is_new = is_new; ",
378 "\tvar pref = is_new ? \"Add \" : \"Modify \";",
379 "\tif (prop.ptype == JsRender.NodePropType.LISTENER) {",
380 "\t\tthis.headertitle.el.label = pref + \"Event Listener\"; // cant really happen yet?",
382 "\t\tthis.headertitle.el.label = pref + \"Property\";",
384 "\tthis.prop = prop;",
385 "\tthis.node = node;",
387 "\t_this.kname.el.set_text(prop.name);",
388 "\t_this.ktype.el.set_text(prop.rtype);",
390 " \t_this.ptype.setValue(prop.ptype);",
391 "\t// does node have this property...",
394 "\t_this.node = node;",
395 "\t//console.log('show all');",
397 "\tGLib.debug(\"set parent = %s\", btn.get_type().name());",
398 "\tvar par = btn.get_parent();",
400 "\tif (par == null) {",
401 "\t\tGLib.debug(\"parent of that is null - not showing\");",
404 "\tif (this.el.parent == null) {",
405 "\t\tthis.el.set_parent(btn);",
407 "\tvar r = Gdk.Rectangle() {",
408 "\t\t\tx = btn.get_width(), // align left...",
413 "\t//Gtk.Allocation rect;",
414 "\t//btn.get_allocation(out rect);",
415 " this.el.set_pointing_to(r);",
421 "\t\t r = Gdk.Rectangle() {",
422 "\t\t\tx = btn.get_width(), // align left...",
427 "\t\tthis.el.set_pointing_to( r);",
432 "\t//this.el.set_position(Gtk.PositionType.TOP);",
434 "\t// window + header?",
435 "\t GLib.debug(\"SHOWALL - POPIP\\n\");",
437 "\tthis.kname.el.grab_focus();",
438 "\tthis.buttonbar.el.hide();",
439 "\tif (this.is_new) {",
440 "\t\tthis.buttonbar.el.show();",
442 "\tthis.error.setError(\"\");",
444 "\t//this.success = c.success;",
448 "| void updateProp" : [
450 " \tGLib.debug(\"updateProp called\");",
454 "\t_this.prop.name = this.kname.el.get_text().strip();",
455 "\t_this.prop.ptype = this.ptype.getValue();",
456 "\t_this.prop.rtype = this.ktype.el.get_text().strip();",
464 "name" : "PopoverProperty"