X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2Flayout-props.cxx;h=09764096ca0f2cfc0ec26afda7f0e3ca074d4aec;hb=474789269b7656509f62339c17e62a55b6157d43;hp=68574045d6a8be933ef2dde7869dba1880ff13d4;hpb=eeeee3a53eaf9ae51af307ca64f78530d1df0ff6;p=flightgear.git diff --git a/src/GUI/layout-props.cxx b/src/GUI/layout-props.cxx index 68574045d..09764096c 100644 --- a/src/GUI/layout-props.cxx +++ b/src/GUI/layout-props.cxx @@ -1,5 +1,10 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include +#include #include "layout.hxx" @@ -38,11 +43,16 @@ LayoutWidget LayoutWidget::parent() 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; } @@ -53,7 +63,9 @@ LayoutWidget LayoutWidget::getChild(int idx) 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++; } @@ -71,9 +83,9 @@ int LayoutWidget::getNum(const char* f) return _prop->getIntValue(f); } -bool LayoutWidget::getBool(const char* f) +bool LayoutWidget::getBool(const char* f, bool dflt) { - return _prop->getBoolValue(f); + return _prop->getBoolValue(f, dflt); } const char* LayoutWidget::getStr(const char* f)