int LayoutWidget::nChildren()
{
- // Hack: assume that any non-leaf nodes are widgets...
+ // Hack: assume that any non-leaf nodes but "hrule" and "vrule"
+ // are widgets...
int n = 0;
- for(int i=0; i<_prop->nChildren(); i++)
- if(_prop->getChild(i)->nChildren() != 0)
+ for(int i=0; i<_prop->nChildren(); i++) {
+ SGPropertyNode* p = _prop->getChild(i);
+ const char* name = p->getName();
+ if(p->nChildren() != 0 || !strcmp(name, "hrule")
+ || !strcmp(name, "vrule"))
n++;
+ }
return n;
}
int n = 0;
for(int i=0; i<_prop->nChildren(); i++) {
SGPropertyNode* p = _prop->getChild(i);
- if(p->nChildren() != 0) {
+ const char* name = p->getName();
+ if(p->nChildren() != 0 || !strcmp(name, "hrule")
+ || !strcmp(name, "vrule")) {
if(idx == n) return LayoutWidget(p);
n++;
}
if (eq(layout, "hbox" )) doHVBox(true, false);
else if(eq(layout, "vbox" )) doHVBox(true, true);
else if(eq(layout, "table")) doTable(true);
- } else if(isType("hrule"))
- doHVBox(true, false);
- else if(isType("vrule"))
- doHVBox(true, true);
+ }
}
// Convention: the "A" cooridinate refers to the major axis of the