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;
@@ -55,17 +55,18 @@ const bool cGUI::Initialize( const cString& filename, const cString& dir /*= ""*
bool rtn = IsInit();
GUIHelpers::cXMLoader xml;
xml.Load(filename, dir);
rtn = xml.Load(filename, dir);
//GUIHelpers::cXMLoader::Inst().Load(filename, dir);
// if (rtn == false) {
// setFont( filename, dir, size );
// cUtility::Inst().Message("GUI initialized.");
// }
m_inited = rtn;
return rtn;
}
void cGUI::Event(const MathEngine::iVector2& location, const eGUIEventType& type)
void cGUI::Event( const MathEngine::iVector2& location, const eGUIEventType& type )
{
location;
type;
@@ -112,7 +113,7 @@ void cGUI::Display()
}
/// Sets
void cGUI::setDebugLevel(const unsigned long int debugLevel)
void cGUI::setDebugLevel( const unsigned long int debugLevel )
{
m_debugLevel = debugLevel;
}
@@ -36,6 +36,7 @@ namespace GUIEngine {
MouseButton3,
Keyboard
};
/// Functions
static cGUI& Inst();
static void Delete();
@@ -5,9 +5,9 @@ using GUIEngine::cLabel;
/*static*/ const cString cLabel::sNAME = "label";
/*static*/ const GUIHelpers::eLayout cLabel::sLAYOUT = GUIHelpers::eLayout::WRAP_CONTENT;
cLabel::cLabel(cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
cLabel::cLabel( cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/)
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{
mp_text = new TextTypeEngine::cText(label);
Create(parent, id, label, align, layout, pos, size, padding, name);
@@ -20,11 +20,13 @@ cLabel::cLabel(cWindow* parent, const signed int id, const cString& label /*= ""
}
/// Functions
void cLabel::Create(cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
void cLabel::Create( cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/)
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{
cWindow::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name);
if (layout == GUIHelpers::eLayout::DEFAULT_LAYOUT)
setLayout(sLAYOUT);
if (this->getParent() != nullptr) {
this->getParent()->AddChild(this);
}
@@ -54,12 +56,12 @@ void cLabel::GenerateTexture()
}
/// Sets
void cLabel::setFontColour(const GUIHelpers::RGBA& colour)
void cLabel::setFontColour( const GUIHelpers::RGBA& colour )
{
mp_text->setColour(colour);
}
void cLabel::setFontSize(const unsigned long int size)
void cLabel::setFontSize( const unsigned long int size )
{
mp_text->setSize(size);
SetSize();
@@ -71,7 +73,7 @@ void cLabel::setText(const cString& text)
SetSize();
}
void cLabel::setFont(const TextTypeEngine::cFont* font)
void cLabel::setFont( const TextTypeEngine::cFont* font )
{
mp_text->setFont((TextTypeEngine::cFont**)(&font));
}
@@ -113,7 +115,7 @@ const cString& cLabel::getText() const
// cWindow::RePos();
// }
/*virtual*/ void cLabel::RebuildLayout(const GUIHelpers::eLayout& layout)
/*virtual*/ void cLabel::RebuildLayout( const GUIHelpers::eLayout& layout )
{
SetSize();
}
@@ -19,15 +19,15 @@ namespace GUIEngine {
static const cString sNAME; /*= "label";*/
static const GUIHelpers::eLayout sLAYOUT;/* = GUIHelpers::eLayout::WRAP_CONTENT;*/
cLabel(cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN,
cLabel( cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN,
const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE,
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME);
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual ~cLabel();
/// Functions
void Create(cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN,
void Create( cWindow* parent, const signed int id, const cString& label = "", const GUIHelpers::eAlign& align = sALIGN,
const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE,
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME);
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual void Display();
@@ -49,13 +49,11 @@ namespace GUIEngine {
//virtual void Resize();
virtual void RebuildLayout(const GUIHelpers::eLayout& layout);
virtual void RebuildLayout( const GUIHelpers::eLayout& layout );
private:
void SetSize();
private:
VideoEngine::cSprite m_sprite;
TextTypeEngine::cText* mp_text;/// = nullptr
@@ -5,9 +5,9 @@ using GUIEngine::cLayout;
/*static*/ const cString cLayout::sNAME = "layout";
/*static*/ const GUIHelpers::eOrientation cLayout::sORIENTATION = GUIHelpers::eOrientation::VERTICAL;
cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
cLayout::cLayout( cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/)
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{
Create(parent, id, orientation, align, layout, pos, size, padding, name);
}
@@ -16,9 +16,9 @@ cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrient
{}
/// Functions
/*virtual*/ void cLayout::Create(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
/*virtual*/ void cLayout::Create( cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding/* = sPADDING*/, const cString& name /*= sNAME*/)
const GUIHelpers::Padding& padding/* = sPADDING*/, const cString& name /*= sNAME*/ )
{
GUIHelpers::eOrientation ori = orientation;
if (ori == GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
@@ -16,9 +16,9 @@ cPanel::cPanel( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, con
{}
/// Functions
/*virtual*/ void cPanel::Create(cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
/*virtual*/ void cPanel::Create( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/)
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/ )
{
padding;
cLayout::Create( parent, id, orientation, align, layout, pos, size, { 0,0,0,0 }, name );
@@ -1,22 +1,22 @@
#include "cBoxSizer.hpp"
#include "cSizer.hpp"
using GUIEngine::cBoxSizer;
using GUIEngine::cSizer;
/*static*/ const cString cBoxSizer::sNAME = "boxsizer";
/*static*/ GUIHelpers::Size cBoxSizer::sSIZE = { 5, 5 };
/*static*/ const cString cSizer::sNAME = "sizer";
/*static*/ GUIHelpers::Size cSizer::sSIZE = { 5, 5 };
cBoxSizer::cBoxSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/,
cSizer::cSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/,
const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/,
const cString& name /*= sNAME*/ )
{
Create(parent, id, align, layout, pos, size, padding, name);
}
/*virtual*/ cBoxSizer::~cBoxSizer()
/*virtual*/ cSizer::~cSizer()
{}
/// Functions
void cBoxSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/,
void cSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align /*= sALIGN*/, const GUIHelpers::eLayout& layout /*= sLAYOUT*/,
const GUIHelpers::Position& pos/* = sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/, const GUIHelpers::Padding& padding /*= sPADDING*/,
const cString& name /*= sNAME*/ )
{
@@ -29,12 +29,12 @@ void cBoxSizer::Create( cWindow* parent, const signed int id, const GUIHelpers::
}
}
/*virtual*/ const GUIHelpers::eType cBoxSizer::getType() const
/*virtual*/ const GUIHelpers::eType cSizer::getType() const
{
return GUIHelpers::eType::CBOXSIZER;
return GUIHelpers::eType::CSIZER;
}
/*virtual*/ const GUIHelpers::RGBA& cBoxSizer::getDebugColour() const
/*virtual*/ const GUIHelpers::RGBA& cSizer::getDebugColour() const
{
return GUIHelpers::CYAN;
}
@@ -1,5 +1,5 @@
#ifndef _CBOXSIZER_HPP_
#define _CBOXSIZER_HPP_
#ifndef _CSIZER_HPP_
#define _CSIZER_HPP_
/*** SDL Header Files ***/
#include <SDL.h>
@@ -20,16 +20,16 @@
using UtilityEngine::cString;
namespace GUIEngine {
class EXPORT_FROM_MYDLL cBoxSizer : public cWindow
class EXPORT_FROM_MYDLL cSizer : public cWindow
{
public:
static const cString sNAME; /*= "boxsizer";*/
static const cString sNAME; /*= "sizer";*/
static GUIHelpers::Size sSIZE; /*= { 5, 5 }*/
cBoxSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT,
cSizer( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT,
const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING,
const cString& name = sNAME );
virtual ~cBoxSizer();
virtual ~cSizer();
/// Functions
void Create( cWindow* parent, const signed int id, const GUIHelpers::eAlign& align = sALIGN, const GUIHelpers::eLayout& layout = sLAYOUT,
@@ -40,6 +40,6 @@ namespace GUIEngine {
virtual const GUIHelpers::RGBA& getDebugColour() const;
private:
private:
};/// END CLASS DEFINITION cBoxSizer
};/// END CLASS DEFINITION cSizer
}/// END NAMESPACE DEFINITION GUIEngine
#endif/// END IFNDEF _CBOXSIZER_HPP_
#endif/// END IFNDEF _CSIZER_HPP_
@@ -4,9 +4,9 @@ using GUIEngine::cTextButton;
/*static*/ const cString cTextButton::sNAME = "textButton";
cTextButton::cTextButton(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/,
cTextButton::cTextButton( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/,
const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/, const GUIHelpers::Position& pos /*= POSITION*/,
const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/)
const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/ )
: m_label(this, -1, text)
{
Create(parent, id, text, align, layout, pos, size, padding, name);
@@ -16,26 +16,26 @@ cTextButton::cTextButton(cWindow* parent, const signed int id, const cString& te
{}
///Functions
void cTextButton::Create(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/,
void cTextButton::Create( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/,
const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/, const GUIHelpers::Position& pos /*= POSITION*/,
const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/)
const GUIHelpers::Size& size /*= SIZE*/, const GUIHelpers::Padding& padding /*= PADDING*/, const cString& name /*= NAME*/ )
{
cButton::Create(parent, id, align, layout, pos, size, padding, name);
setText(text);
}
/// Sets
void cTextButton::setText(const cString& text)
void cTextButton::setText( const cString& text )
{
m_label.setText(text);
}
void cTextButton::setTextColour(const GUIHelpers::RGBA& colour)
void cTextButton::setTextColour( const GUIHelpers::RGBA& colour )
{
m_label.setFontColour(colour);
}
void cTextButton::setTextSize(const unsigned long int size)
void cTextButton::setTextSize( const unsigned long int size )
{
m_label.setSize(size);
}
@@ -28,15 +28,15 @@ namespace GUIEngine {
public:
static const cString sNAME; /*= "button";*/
cTextButton(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
cTextButton( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION,
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME);
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual ~cTextButton();
/// Functions
void Create(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
void Create( cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION,
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME);
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
/// Sets
void setText( const cString& text );
@@ -287,11 +287,50 @@ cWindow* cWindow::getParent()
return mp_parent;
}
const unsigned long int cWindow::getFillParentSize()
{
unsigned long int rtn = 0;
int count = 0;
GUIHelpers::Size size = getSize(false);
std::vector<cWindow*>::iterator it;
for (it = m_children.begin(); it < m_children.end(); it++) {
if ((*it)->getLayout() == GUIHelpers::eLayout::WRAP_CONTENT) {
size -= (*it)->getSize();
}
else {
count++;
}
}
switch (m_orientation) {
case GUIHelpers::eOrientation::VERTICAL:
rtn = size.y;
break;
case GUIHelpers::eOrientation::HORIZONTAL:
rtn = size.x;
break;
default:
break;
}
//if ((rtn % count) != 0)
rtn /= count;
return rtn;
}
/*virtual*/ const GUIHelpers::eType cWindow::getType() const
{
return GUIHelpers::eType::CWINDOW;
}
/// protected
/*virtual*/ void cWindow::Resize()
@@ -316,12 +355,19 @@ cWindow* cWindow::getParent()
mySize = mp_parent->getSize(false);
if (mp_parent->getType() == GUIHelpers::eType::CLAYOUT) {
if (mp_parent->getChildren().size() > 1)
unsigned long int fillSize = 0;
if (mp_parent->getChildren().size() > 1) {
fillSize = mp_parent->getFillParentSize();
mySize -= mp_parent->getChildrenSize(this);
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL)
}
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL) {
mySize.x = m_size.x;
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL)
mySize.y = fillSize;
}
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
mySize.y = m_size.y;
mySize.x = fillSize;
}
}
mySize.x -= m_padding.x + m_padding.w;
@@ -460,6 +506,10 @@ std::vector<cWindow*>& cWindow::getChildren()
}
/// private
void cWindow::Rebuild(cWindow * const parent, const GUIHelpers::eLayout & layout)
{
}
void cWindow::AddSize( const int x, const int y, GUIHelpers::Size& mySize ) const
{
int addFrom = x;
@@ -89,8 +89,12 @@ namespace GUIEngine {
cWindow* getParent();
const unsigned long int getFillParentSize();
virtual const GUIHelpers::eType getType() const;
virtual void Resize();
virtual void RebuildLayout( const GUIHelpers::eLayout& layout );