var gdata = Palete.Gir.factoryFqn(this.project, this.node.fqn());
if (gdata == null || !gdata.inherits.contains("Gtk.Buildable")) {
switch(cls) {
- case "GtkColumnViewColumn": //exception to the rule..
- break;
+ //exception to the rule.. (must be buildable to work with glade?
+ case "GtkColumnViewColumn":
+ case "GtkNotebookPage":
+ break;
default:
return null;
}
var items = this.node.readItems();
for (var i = 0; i < items.size; i++ ) {
var cn = items.get(i);
- var child = this.create_element("child");
+
+ var childname = "child";
+ var pname = "";
+ if (cn.has("* prop")) { // && cn.get_prop("* prop").val == "child") {
+ childname = "property";
+ pname = cn.get_prop("* prop").val;
+ }
+
+ var child = this.create_element(childname);
+ if (pname != "") {
+ child->set_prop("name", pname);
+ }
+
if ((cls == "GtkWindow" || cls == "GtkApplicationWindow") && cn.fqn() == "Gtk.HeaderBar") {
child->set_prop("type", "label");
}
protected void addMyVars()
{
- GLib.debug("callinged addMhyVars");
+ GLib.debug("calling addMyVars");
this.addLine();
this.addLine(this.ipad + "// my vars (def)");
continue;
}
+ var isUser = prop.ptype == NodePropType.USER;
+ if (this.node.fqn() == "Gtk.NotebookPage") {
+ isUser= true;
+ }
// is it a class property...
- if (cls != null && cls.props.has_key(prop.name) && prop.ptype != NodePropType.USER) {
+ if (cls != null && cls.props.has_key(prop.name) && !isUser) {
continue;
}
v= v.down();
}
//FIXME -- check for raw string.. "string XXXX"
+ var is_raw = prop.ptype == NodePropType.RAW;
+ // what's the type.. - if it's a string.. then we quote it..
+ if (prop.rtype == "string" && !is_raw) {
+ v = "\"" + v.escape("") + "\"";
+ }
// if it's a string...
prop.start_line = this.cur_line;
GLib.debug("Skipping wrapped properties - could not find class %s" , this.node.fqn());
return;
}
+
+ if (this.node.fqn() == "Gtk.NotebookPage") {
+ return;
+ }
// what are the properties of this class???
this.addLine();
this.addLine(this.ipad + "// set gobject values");
protected void addChildren()
{
//code
+ GLib.debug("addChildren %s, %d", this.node.fqn(), (int)this.node.readItems().size);
if (this.node.readItems().size < 1) {
return;
}
var cols = this.node.has("* columns") ? int.max(1, int.parse(this.node.get_prop("* columns").val)) : 1;
var colpos = 0;
-
+ var nb_child = "";
+ var nb_tab = "";
+ var nb_menu = "";
+
foreach(var child in this.node.readItems()) {
continue;
}
// create the element..
+
// this is only needed if it does not have an ID???
var childname = this.addPropSet(child, child.has("id") ? child.get_prop("id").val : "") ;
if (!child.has("id") && this.this_el == "this.el.") {
this.addLine(this.ipad + childname +".ref();");
- }
+ }
if (child.has("* prop")) {
-
+ if (this.node.fqn() == "Gtk.NotebookPage") {
+ switch (child.get_prop("* prop").val) {
+ case "child":
+ nb_child = childname;
+ break;
+
+ case "tab":
+ nb_tab = childname;
+ break;
+
+ case "menu":
+ nb_menu = childname;
+ break;
+ }
+ continue;
+ }
// fixme special packing!??!?!
if (child.get_prop("* prop").val.contains("[]")) {
}
+
+ GLib.debug("got node %s with nb_child= %s", this.node.fqn() , nb_child);
+ if (this.node.fqn() == "Gtk.NotebookPage" && nb_child != "") {
+ if (nb_tab == "" && this.node.has("tab_label")) {
+ nb_tab = "new Gtk.Label(this.tab_label)";
+ }
+
+ if (nb_menu == "" && nb_tab == "") {
+ this.addLine(@"$(ipad)notebook.el.append_page( $(nb_child) );");
+ return;
+ }
+ if (nb_menu == "") {
+ this.addLine(@"$(ipad)notebook.el.append_page( $(nb_child) , $(nb_tab) );");
+ return;
+ }
+ this.addLine(@"$(ipad)notebook.el.append_page_menu( $(nb_child) , $(nb_tab), $(nb_menu) );");
+
+ }
+
}
+ /**
+ var childname = new Xcls_.... (....)
+
+ */
protected string addPropSet(Node child, string child_name)
- {
+ {
var xargs = "";
}
}
*/
+ if (child.fqn() == "Gtk.NotebookPage") {
+ xargs +=" , this";
+ }
this.addLine(this.ipad + @"$(prefix)new $cls( _this $xargs);" );
switch (this.node.fqn()) {
-
+
case "Gtk.Fixed":
return;
case "Gtk.Notebook": // use label
+ if (child.fqn() == "Gtk.NotebookPage") {
+ return;
+ }
var label = child.has("notebook_label") ? child.get_prop("notebook_label").val.escape() : "";
this.addLine(@"$(ipad)$(this_el)append_page( $(childname)$(el_name), new Gtk.Label(\"$(label)\");");
//for (var ari =0; ari < ar.length; ari++) {
// cargs += (ar[ari].trim().split(" ").pop();
// }
- }
+ }
+
if (this.depth < 1) {
var top = this.top as NodeToVala;
var tcls = top == null ? "???" : top.xcls;
// for sub classes = we passs the top level as _owner
+ if (this.node.fqn() == "Gtk.NotebookPage") {
+ cargs_str += ", " + this.node.parent.xvala_xcls + " notebook";
+ }
+
this.addLine(this.pad + "public " + this.xcls + "(" + tcls + " _owner " + cargs_str + ")");
this.addLine(this.pad + "{");
}
this.node.setLine(this.cur_line, "p", "* xtype");;
- // is the wrapped element a struct?
-
+
+ // Notebookpage is a fake element
+ // used to hold label and child...
+
+ // is the wrapped element a struct?
var ncls = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn());
if (ncls != null && ncls.nodetype == "Struct") {
// we can use regular setters to apply the values.
var args_str = "";
switch(this.node.fqn()) {
+
+ // GTK4
+ case "Gtk.NotebookPage":
+ return;
+
+
+
+
// FIXME -- these are all GTK3 - can be removed when I get rid of them..
case "Gtk.ComboBox":
var is_entry = this.node.has("has_entry") && this.node.get_prop("has_entry").val.down() == "true";