layout-props.cxx: hrule/vrule shall be accepted as widgets even if they
have no children (in which case they default to 1px thickness & stretch). This allows to just write <hrule/> instead of <hrule><dummy/></hrule>. One can still use <hrule><pref-height>3</pref-height></hrule>, of course. layout.cxx: drop silly do??Box calls for hrule/vrule (yes, I wrote that :-)
This commit is contained in:
parent
60516c8a3f
commit
f27d7b2340
2 changed files with 12 additions and 8 deletions
src/GUI
|
@ -42,11 +42,16 @@ LayoutWidget LayoutWidget::parent()
|
||||||
|
|
||||||
int LayoutWidget::nChildren()
|
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;
|
int n = 0;
|
||||||
for(int i=0; i<_prop->nChildren(); i++)
|
for(int i=0; i<_prop->nChildren(); i++) {
|
||||||
if(_prop->getChild(i)->nChildren() != 0)
|
SGPropertyNode* p = _prop->getChild(i);
|
||||||
|
const char* name = p->getName();
|
||||||
|
if(p->nChildren() != 0 || !strcmp(name, "hrule")
|
||||||
|
|| !strcmp(name, "vrule"))
|
||||||
n++;
|
n++;
|
||||||
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +62,9 @@ LayoutWidget LayoutWidget::getChild(int idx)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for(int i=0; i<_prop->nChildren(); i++) {
|
for(int i=0; i<_prop->nChildren(); i++) {
|
||||||
SGPropertyNode* p = _prop->getChild(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);
|
if(idx == n) return LayoutWidget(p);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,10 +185,7 @@ void LayoutWidget::layout(int x, int y, int w, int h)
|
||||||
if (eq(layout, "hbox" )) doHVBox(true, false);
|
if (eq(layout, "hbox" )) doHVBox(true, false);
|
||||||
else if(eq(layout, "vbox" )) doHVBox(true, true);
|
else if(eq(layout, "vbox" )) doHVBox(true, true);
|
||||||
else if(eq(layout, "table")) doTable(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
|
// Convention: the "A" cooridinate refers to the major axis of the
|
||||||
|
|
Loading…
Add table
Reference in a new issue