Pre-resize fillparent

This commit is contained in:
2018-08-13 22:22:10 -04:00
parent 58fa6f0503
commit 353dc21750
95 changed files with 478 additions and 437 deletions
@@ -2,7 +2,7 @@
using namespace GUIHelpers;
const RGBA& GUIHelpers::StringtoRGBA( const cString& colour )
const RGBA GUIHelpers::StringtoRGBA( const cString& colour )
{
RGBA rtn = DEFAULT;
cString check = colour.upper();
@@ -18,8 +18,6 @@ namespace GUIHelpers {
typedef struct SDL_Colour RGBA;
typedef struct SDL_Rect Area;
static const RGBA DEFAULT = { 0, 0, 0, 0 };
static const RGBA WHITE = { 255, 255, 255, 255 };
static const RGBA BLACK = { 0, 0, 0, 255 };
@@ -38,8 +36,9 @@ namespace GUIHelpers {
static const RGBA MAGENTA = { 255, 0, 255, 255 };
static const RGBA ROSE = { 255, 0, 128, 255 };
static const RGBA DEFAULT = WHITE;
const RGBA& StringtoRGBA(const cString& colour);
const RGBA StringtoRGBA(const cString& colour);
}/// END NAMESPACE DEFINITION GUIHelpers
#endif/// END IFNDEF _GUIUTILITY_HPP_
@@ -21,15 +21,15 @@ bool cObject::operator == (const cObject& other)
return false;
}
///Functions
/// Functions
///Sets
/// Sets
const void cObject::setID( const signed int id )
{
m_id = id;
}
///Gets
/// Gets
const signed int cObject::getID() const
{
return m_id;
@@ -13,9 +13,7 @@ cTexture::cTexture()
cTexture::~cTexture()
{}
///Functions
//private
/// Functions
SDL_Texture* cTexture::GenerateTexture( const SDL_Rect& dimensions, TextTypeEngine::cText* text /*= nullptr*/ )
{
SDL_Rect t = text->getWH();
@@ -18,7 +18,7 @@ namespace GUIHelpers {
cTexture();
~cTexture();
///Functions
/// Functions
SDL_Texture* GenerateTexture( const SDL_Rect& dimensions, TextTypeEngine::cText* text = nullptr );
private:
@@ -12,21 +12,15 @@ using UtilityEngine::cUtility;
cXMLoader::cXMLoader()
{
m_loadDef = false;
m_orientation = GUIHelpers::eOrientation::DEFAULT_ORIENTATION;
m_align = GUIHelpers::eAlign::DEFAULT_ALIGN;
m_layout = GUIHelpers::eLayout::DEFAULT_LAYOUT;
m_pos = { -1, -1 };
m_size = { -1, -1 };
m_pad = { -1, -1, -1, -1 };
}
: m_loadDef(false), m_debugXML(false), m_orientation(GUIHelpers::eOrientation::DEFAULT_ORIENTATION),
m_align(GUIHelpers::eAlign::DEFAULT_ALIGN), m_layout(GUIHelpers::eLayout::DEFAULT_LAYOUT), m_pos({ -1, -1 }),
m_size({ -1, -1 }), m_pad({ -1, -1, -1, -1 })
{}
cXMLoader::~cXMLoader()
{}
///Functions
/// Functions
void cXMLoader::Load( const cString& filename, const cString& dir /*= ""*/, GUIEngine::cWindow* parent /*= nullptr*/ )
{
cString file = dir + filename;
@@ -83,14 +77,17 @@ void cXMLoader::GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* p
tmp->Resize();
}
const cString& cXMLoader::GetAttribute( const tinyxml2::XMLElement& element, const cString& attribute ) const
const cString cXMLoader::GetAttribute( const tinyxml2::XMLElement& element, const cString& attribute ) const
{
cString rtn;
cString rtn = "";
const char* str = element.Attribute(attribute.c_str());
if ((str == nullptr) && (m_debugXML == true))
cUtility::Inst().Message("Error no attribute: " + attribute + " found in tag <" + element.Value() + ">");
else
rtn = str;
else {
if (str != nullptr)
rtn = str;
}
//rtn = str;
return rtn;
}
@@ -211,12 +208,12 @@ GUIEngine::cBoxSizer* cXMLoader::BoxSizerBuild(const tinyxml2::XMLElement& eleme
return rtn;
}
const cString& cXMLoader::getDir(const tinyxml2::XMLElement& element) const
const cString cXMLoader::getDir(const tinyxml2::XMLElement& element) const
{
return GetAttribute(element, "dir");
}
const cString& cXMLoader::getFileName(const tinyxml2::XMLElement& element) const
const cString cXMLoader::getFileName(const tinyxml2::XMLElement& element) const
{
return GetAttribute(element, "filename");
}
@@ -315,7 +312,7 @@ const GUIHelpers::eLayout cXMLoader::getLayout( const tinyxml2::XMLElement& elem
return rtn;
}
const GUIHelpers::Position& cXMLoader::getPosition( const tinyxml2::XMLElement& element ) const
const GUIHelpers::Position cXMLoader::getPosition( const tinyxml2::XMLElement& element ) const
{
GUIHelpers::Position rtn = { -1, -1 };
@@ -337,7 +334,7 @@ const GUIHelpers::Position& cXMLoader::getPosition( const tinyxml2::XMLElement&
return rtn;
}
const GUIHelpers::Size& cXMLoader::getSize( const tinyxml2::XMLElement& element ) const
const GUIHelpers::Size cXMLoader::getSize( const tinyxml2::XMLElement& element ) const
{
GUIHelpers::Size rtn = { -1, -1 };
@@ -359,7 +356,7 @@ const GUIHelpers::Size& cXMLoader::getSize( const tinyxml2::XMLElement& element
return rtn;
}
const GUIHelpers::Padding& cXMLoader::getPadding( const tinyxml2::XMLElement& element ) const
const GUIHelpers::Padding cXMLoader::getPadding( const tinyxml2::XMLElement& element ) const
{
GUIHelpers::Padding rtn = { -1, -1, -1, -1 };
@@ -385,12 +382,12 @@ const GUIHelpers::Padding& cXMLoader::getPadding( const tinyxml2::XMLElement& el
return rtn;
}
const cString& cXMLoader::getText( const tinyxml2::XMLElement& element ) const
const cString cXMLoader::getText( const tinyxml2::XMLElement& element ) const
{
return GetAttribute(element, "text");
}
const GUIHelpers::RGBA& cXMLoader::getColour( const tinyxml2::XMLElement& element ) const
const GUIHelpers::RGBA cXMLoader::getColour( const tinyxml2::XMLElement& element ) const
{
GUIHelpers::RGBA rtn = GUIHelpers::DEFAULT;
cString str = GetAttribute(element, "colour");
@@ -31,7 +31,7 @@ namespace GUIHelpers {
private:
void GetElement( tinyxml2::XMLElement& element, GUIEngine::cWindow* parent = nullptr ) const;
const cString& GetAttribute( const tinyxml2::XMLElement& element, const cString& attribute ) const;
const cString GetAttribute( const tinyxml2::XMLElement& element, const cString& attribute ) const;
void Include( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
void GUISetup( const tinyxml2::XMLElement& element ) const;
@@ -43,34 +43,34 @@ namespace GUIHelpers {
GUIEngine::cLabel* LabelBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
GUIEngine::cBoxSizer* BoxSizerBuild( const tinyxml2::XMLElement& element, GUIEngine::cWindow* parent ) const;
const cString& getDir( const tinyxml2::XMLElement& element ) const;
const cString& getFileName( const tinyxml2::XMLElement& element ) const;
const cString getDir( const tinyxml2::XMLElement& element ) const;
const cString getFileName( const tinyxml2::XMLElement& element ) const;
const unsigned long int getDebug( const tinyxml2::XMLElement& element ) const;
const bool cXMLoader::getDebugXML(const tinyxml2::XMLElement& element) const;
const signed long int getID( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::eOrientation getOrientation( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::eAlign getAlign( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::eLayout getLayout( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::Position& getPosition( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::Size& getSize( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::Padding& getPadding( const tinyxml2::XMLElement& element ) const;
const cString& getText( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::Position getPosition( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::Size getSize( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::Padding getPadding( const tinyxml2::XMLElement& element ) const;
const cString getText( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::RGBA& getColour( const tinyxml2::XMLElement& element ) const;
const GUIHelpers::RGBA getColour( const tinyxml2::XMLElement& element ) const;
const signed long int getFontSize( const tinyxml2::XMLElement& element ) const;
void LoadDefault() const;
private:
bool m_loadDef;// = false;
bool m_debugXML;
bool m_loadDef;/// = false;
bool m_debugXML;/// = false;
GUIHelpers::eOrientation m_orientation;// = GUIHelpers::eOrientation::DEFAULT_ORIENTATION;
GUIHelpers::eAlign m_align;// = GUIHelpers::eAlign::DEFAULT_ALIGN;
GUIHelpers::eLayout m_layout;// = GUIHelpers::eLayout::DEFAULT_LAYOUT;
GUIHelpers::Position m_pos;// = { -1, -1 };
GUIHelpers::Size m_size;// = { -1, -1 };
GUIHelpers::Padding m_pad;// = { -1, -1, -1, -1 };
GUIHelpers::eOrientation m_orientation;/// = GUIHelpers::eOrientation::DEFAULT_ORIENTATION;
GUIHelpers::eAlign m_align;/// = GUIHelpers::eAlign::DEFAULT_ALIGN;
GUIHelpers::eLayout m_layout;/// = GUIHelpers::eLayout::DEFAULT_LAYOUT;
GUIHelpers::Position m_pos;/// = { -1, -1 };
GUIHelpers::Size m_size;/// = { -1, -1 };
GUIHelpers::Padding m_pad;/// = { -1, -1, -1, -1 };
};/// END CLASS DEFINITION cXMLoader
}/// END NAMESPACE DEFINITION GUIHelpers
#endif/// END IFNDEF _CXMLOADER_HPP_