|
|
@@ -1,5 +1,8 @@
|
|
|
#include "BsGUIElementBase.h"
|
|
|
#include "BsGUILayout.h"
|
|
|
+#include "BsGUILayoutX.h"
|
|
|
+#include "BsGUILayoutY.h"
|
|
|
+#include "CmException.h"
|
|
|
|
|
|
using namespace CamelotFramework;
|
|
|
|
|
|
@@ -72,4 +75,72 @@ namespace BansheeEngine
|
|
|
child->_updateLayout(x, y, width, height, widgetDepth, areaDepth);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ GUILayout& GUIElementBase::addLayoutXInternal()
|
|
|
+ {
|
|
|
+ GUILayoutX* entry = cm_new<GUILayoutX, PoolAlloc>();
|
|
|
+
|
|
|
+ mChildren.push_back(entry);
|
|
|
+ markContentAsDirty();
|
|
|
+
|
|
|
+ return *entry;
|
|
|
+ }
|
|
|
+
|
|
|
+ GUILayout& GUIElementBase::addLayoutYInternal()
|
|
|
+ {
|
|
|
+ GUILayoutY* entry = cm_new<GUILayoutY, PoolAlloc>();
|
|
|
+
|
|
|
+ mChildren.push_back(entry);
|
|
|
+ markContentAsDirty();
|
|
|
+
|
|
|
+ return *entry;
|
|
|
+ }
|
|
|
+
|
|
|
+ void GUIElementBase::removeLayoutInternal(GUILayout& layout)
|
|
|
+ {
|
|
|
+ bool foundElem = false;
|
|
|
+ for(auto iter = mChildren.begin(); iter != mChildren.end(); ++iter)
|
|
|
+ {
|
|
|
+ GUIElementBase* child = *iter;
|
|
|
+
|
|
|
+ if(child->_getType() == GUIElementBase::Type::Layout && child == &layout)
|
|
|
+ {
|
|
|
+ cm_delete<PoolAlloc>(child);
|
|
|
+
|
|
|
+ mChildren.erase(iter);
|
|
|
+ foundElem = true;
|
|
|
+ markContentAsDirty();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!foundElem)
|
|
|
+ CM_EXCEPT(InvalidParametersException, "Provided element is not a part of this layout.");
|
|
|
+ }
|
|
|
+
|
|
|
+ GUILayout& GUIElementBase::insertLayoutXInternal(UINT32 idx)
|
|
|
+ {
|
|
|
+ if(idx < 0 || idx >= (UINT32)mChildren.size())
|
|
|
+ CM_EXCEPT(InvalidParametersException, "Index out of range: " + toString(idx) + ". Valid range: 0 .. " + toString((UINT32)mChildren.size()));
|
|
|
+
|
|
|
+ GUILayoutX* entry = cm_new<GUILayoutX, PoolAlloc>();
|
|
|
+
|
|
|
+ mChildren.insert(mChildren.begin() + idx, entry);
|
|
|
+ markContentAsDirty();
|
|
|
+
|
|
|
+ return *entry;
|
|
|
+ }
|
|
|
+
|
|
|
+ GUILayout& GUIElementBase::insertLayoutYInternal(UINT32 idx)
|
|
|
+ {
|
|
|
+ if(idx < 0 || idx >= (UINT32)mChildren.size())
|
|
|
+ CM_EXCEPT(InvalidParametersException, "Index out of range: " + toString(idx) + ". Valid range: 0 .. " + toString((UINT32)mChildren.size()));
|
|
|
+
|
|
|
+ GUILayoutY* entry = cm_new<GUILayoutY, PoolAlloc>();
|
|
|
+
|
|
|
+ mChildren.insert(mChildren.begin() + idx, entry);
|
|
|
+ markContentAsDirty();
|
|
|
+
|
|
|
+ return *entry;
|
|
|
+ }
|
|
|
}
|