#include "BsGUIPanelContainer.h" #include "BsGUIArea.h" #include "BsGUILayout.h" #include "BsGUIWidget.h" #include "BsScriptGUIArea.h" namespace BansheeEngine { GUIPanelContainer::GUIPanelContainer(const PrivatelyConstruct& dummy, const ScriptGUIPanel& guiPanel, const GUILayoutOptions& layoutOptions) :GUIElementContainer(layoutOptions), mGUIPanel(&guiPanel) { } GUIPanelContainer::~GUIPanelContainer() { } GUIPanelContainer* GUIPanelContainer::create(const ScriptGUIPanel& guiPanel, const GUIOptions& layoutOptions) { return bs_new(PrivatelyConstruct(), guiPanel, GUILayoutOptions::create(layoutOptions)); } GUIPanelContainer* GUIPanelContainer::create(const ScriptGUIPanel& guiPanel) { return bs_new(PrivatelyConstruct(), guiPanel, GUILayoutOptions::create()); } void GUIPanelContainer::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height, RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth) { const Vector areas = mGUIPanel->getAreas(); for (auto& scriptArea : areas) { GUIArea* area = scriptArea->getInternalValue(); if (area->x() != x || area->y() != y) area->setPosition(x, y); if (area->width() != width || area->height() != height) area->setSize(width, height); // We want to force the layout update right away otherwise it might get delayed until next frame. // (Since we are currently in a middle of a layout update its possible this area was already processed) area->_update(); } } Vector2I GUIPanelContainer::_getOptimalSize() const { return Vector2I(0, 0); } const String& GUIPanelContainer::getGUITypeName() { static String typeName = "GUIAreaContainer"; return typeName; } }