#include "WindowManager.h"

WindowManager::WindowManager()
    : mWindows()
{
    AddWindow(mt::Window::Create());
}

WindowManager::~WindowManager()
{

}

std::unique_ptr<WindowManager> WindowManager::Create()
{
    return std::make_unique<WindowManager>();
}

void WindowManager::OnPaintEvent(const PaintEvent* event)
{
    GetMainWindow()->OnPaint(event);
}

void WindowManager::OnMouseEvent(const MouseEvent* event)
{
    GetMainWindow()->OnMouseEvent(event);
}

void WindowManager::OnKeyboardEvent(const KeyboardEvent* event)
{
    GetMainWindow()->OnKeyboardEvent(event);
}

void WindowManager::AddWindow(WindowUPtr window)
{
    mWindows.push_back(std::move(window));
}

mt::Window* WindowManager::GetMainWindow() const
{
    if(mWindows.size()>0)
    {
        return mWindows[0].get();
    }
    else
    {
        return nullptr;
    }
}
