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
@@ -19,7 +19,7 @@ namespace GUIHelpers {
CWINDOW,
CPANEL,
CLAYOUT,
CBOXSIZER,
CSIZER,
CBUTTON,
CTEXTBUTTON,
CLABEL,
@@ -13,7 +13,7 @@ cObject::cObject( const signed int id )
/*virtual*/ cObject::~cObject()
{}
bool cObject::operator == (const cObject& other)
bool cObject::operator == ( const cObject& other )
{
if (m_id == other.getID())
return true;
@@ -14,7 +14,7 @@ namespace GUIHelpers {
cObject( const signed int id );
virtual ~cObject();
bool operator == (const cObject& other);
bool operator == ( const cObject& other );
///Functions
@@ -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
@@ -14,7 +14,7 @@
#include "../cPanel.hpp"
#include "../cLayout.hpp"
#include "../cLabel.hpp"
#include "../cBoxSizer.hpp"
#include "../cSizer.hpp"
#include "../../UtilityEngine/cString.hpp"
@@ -27,7 +27,7 @@ namespace GUIHelpers {
cXMLoader();
~cXMLoader();
void Load( const cString& filename, const cString& dir = "", GUIEngine::cWindow* parent = nullptr );
const bool Load( const cString& filename, const cString& dir = "", GUIEngine::cWindow* parent = nullptr );
private:
void GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent = nullptr ) const;
@@ -41,7 +41,7 @@ namespace GUIHelpers {
GUIEngine::cPanel* PanelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cLayout* LayoutBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cLabel* LabelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cBoxSizer* BoxSizerBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cSizer* SizerBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
const cString getDir( const tinyxml2::XMLElement& element ) const;
const cString getFileName( const tinyxml2::XMLElement& element ) const;