#include "Win32WindowInterface.h"

#include "Win32Window.h"

#include <Windows.h>

#include "DesktopManager.h"

#include "FileLogger.h"

Win32WindowInterface::Win32WindowInterface()
{

}

void Win32WindowInterface::Show(mt::Window* window)
{
    auto platformWindow = dynamic_cast<Win32Window*>(window->GetPlatformWindow());
    MLOG_INFO("Showing platform window: " << platformWindow->GetHandle());
    ::ShowWindow(platformWindow->GetHandle(), platformWindow->GetCmdShow());
}

void Win32WindowInterface::Add(mt::Window* window, DesktopManager* desktopManager)
{
    auto context = dynamic_cast<Win32ApplicationContext*>(desktopManager->GetMainApp()->GetApplicationContext());

    auto win32_window = Win32Window::Create();
    win32_window->CreateNative(context, desktopManager);
    win32_window->SetCmdShow(context->nCmdShow);
    window->SetPlatformWindow(std::move(win32_window));
}

