| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include "BsEditorWindow.h"
- #include "BsEditorWidgetContainer.h"
- #include "BsEditorWindowManager.h"
- using namespace CamelotFramework;
- using namespace BansheeEngine;
- namespace BansheeEditor
- {
- EditorWindow::EditorWindow()
- :EditorWindowBase(), mWidgets(cm_new<EditorWidgetContainer>(mGUI.get()))
- {
- updateSize();
- mWidgets->onWidgetClosed.connect(boost::bind(&EditorWindow::widgetRemoved, this));
- }
- EditorWindow::~EditorWindow()
- {
- cm_delete(mWidgets);
- }
- void EditorWindow::movedOrResized()
- {
- EditorWindowBase::movedOrResized();
- updateSize();
- }
- void EditorWindow::updateSize()
- {
- mWidgets->setPosition(1, 1);
- UINT32 widgetWidth = (UINT32)std::max(0, (INT32)getWidth() - 2);
- UINT32 widgetHeight = (UINT32)std::max(0, (INT32)getHeight() - 2);
- mWidgets->setSize(widgetWidth, widgetHeight);
- }
- void EditorWindow::widgetRemoved()
- {
- if(mWidgets->getNumWidgets() == 0)
- close();
- }
- EditorWindow* EditorWindow::create()
- {
- return EditorWindowManager::instance().create();
- }
- }
|