| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #include "BsEditorWidget.h"
- #include "BsGUIManager.h"
- #include "BsGUIWidget.h"
- #include "BsGUITexture.h"
- #include "BsGUISkin.h"
- #include "BsGUILayout.h"
- #include "BsEngineGUI.h"
- #include "BsGUIArea.h"
- #include "BsEditorWidgetContainer.h"
- #include "BsEditorWidgetManager.h"
- using namespace CamelotFramework;
- using namespace BansheeEngine;
- namespace BansheeEditor
- {
- EditorWidgetBase::EditorWidgetBase(const HString& displayName, const CM::String& name)
- :mDisplayName(displayName), mName(name), mParent(nullptr), mContent(nullptr)
- {
-
- }
- EditorWidgetBase::~EditorWidgetBase()
- {
- }
- void EditorWidgetBase::close()
- {
- EditorWidgetManager::instance().close(this);
- }
- void EditorWidgetBase::destroy(EditorWidgetBase* widget)
- {
- widget->~EditorWidgetBase();
- cm_free(widget);
- }
- void EditorWidgetBase::_setPosition(INT32 x, INT32 y)
- {
- if(mContent == nullptr)
- return;
- mContent->setPosition(x, y);
- }
- void EditorWidgetBase::_setSize(UINT32 width, UINT32 height)
- {
- if(mContent == nullptr)
- return;
- mContent->setSize(width, height);
- }
- void EditorWidgetBase::_changeParent(EditorWidgetContainer* parent)
- {
- if(mParent != parent)
- {
- if(parent != nullptr)
- {
- if(mContent == nullptr)
- mContent = GUIArea::create(parent->getParentWidget(), 0, 0, 0, 0, 10000);
- else
- mContent->changeParentWidget(&parent->getParentWidget());
- }
- else
- {
- if(mContent != nullptr)
- mContent->changeParentWidget(nullptr);
- }
- mParent = parent;
- }
- }
- void EditorWidgetBase::_disable()
- {
- mContent->disable();
- }
- void EditorWidgetBase::_enable()
- {
- mContent->enable();
- }
- GUIWidget& EditorWidgetBase::getParentWidget() const
- {
- return mParent->getParentWidget();
- }
- }
|