#include "Win32WindowInterface.h"

#include "Win32Window.h"

#include <Windows.h>

#include "DesktopManager.h"
#include "DrawingContext.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(window);
    win32_window->CreateNative(context, desktopManager);
    win32_window->SetCmdShow(context->nCmdShow);
    window->setPlatformWindow(std::move(win32_window), nullptr, DrawingMode::GRAPH);
}

