BoxSizer to Sizer

This commit is contained in:
2018-08-15 22:04:06 -04:00
parent 353dc21750
commit bd3c111fa1
67 changed files with 369 additions and 308 deletions
@@ -21,20 +21,22 @@ cXMLoader::~cXMLoader()
{}
/// Functions
void cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIEngine::cWindow* parent /*= nullptr*/ )
const bool cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIEngine::cWindow* parent /*= nullptr*/ )
{
bool rtn = false;
cString file = dir + filename;
tinyxml2::XMLDocument doc;
if (doc.LoadFile(file.c_str()) != tinyxml2::XMLError::XML_NO_ERROR)
cUtility::Inst().Message("Could not load file. " + file + " Error='" + doc.ErrorName() + "'.");
else {
rtn = true;
tinyxml2::XMLElement* element = doc.FirstChildElement();
if (element == nullptr)
cUtility::Inst().Message("No tag found.");
else {
//OK check for defaults
/// OK check for defaults
tinyxml2::XMLElement* defaultEl = element->FirstChildElement("default");
if (defaultEl != nullptr)
Default(*defaultEl);
@@ -44,7 +46,7 @@ void cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIE
GetElement(*element, parent);
}
}
return rtn;
}
void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent /*= nullptr*/ ) const
@@ -62,8 +64,8 @@ void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* p
tmp = LayoutBuild(element, parent);
if (name == "label")
tmp = LabelBuild(element, parent);
if (name == "boxsizer")
tmp = BoxSizerBuild(element, parent);
if (name == "sizer")
tmp = SizerBuild(element, parent);
tinyxml2::XMLElement* child = element.FirstChildElement();
if (child != nullptr)
@@ -191,7 +193,7 @@ GUIEngine::cLabel* cXMLoader::LabelBuild( const tinyxml2::XMLElement& element, G
return rtn;
}
GUIEngine::cBoxSizer* cXMLoader::BoxSizerBuild(const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent) const
GUIEngine::cSizer* cXMLoader::SizerBuild(const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent) const
{
signed long int id = getID(element);
//GUIHelpers::eOrientation orientation = getOrientation(element);
@@ -203,7 +205,7 @@ GUIEngine::cBoxSizer* cXMLoader::BoxSizerBuild(const tinyxml2::XMLElement& eleme
cString txt = getText(element);
GUIEngine::cBoxSizer* rtn = new GUIEngine::cBoxSizer(parent, id, align, layout, pos, size, pad);
GUIEngine::cSizer* rtn = new GUIEngine::cSizer(parent, id, align, layout, pos, size, pad);
return rtn;
}
@@ -384,7 +386,8 @@ const GUIHelpers::Padding cXMLoader::getPadding( const tinyxml2::XMLElement& ele
const cString cXMLoader::getText( const tinyxml2::XMLElement& element ) const
{
return GetAttribute(element, "text");
//return GetAttribute(element, "text");
return element.GetText();
}
const GUIHelpers::RGBA cXMLoader::getColour( const tinyxml2::XMLElement& element ) const