#pragma once

/*
	Application Framework
	by John Ryland
	Copyright (c) 2023
*/

////////////////////////////////////////////////////////////////////////////////////
//	Window

#include <cstdint>

namespace ApplicationFramework {

class IApplication;
class IWindow;

class Window
{
public:
    Window(IApplication& app, int width, int height, const char* title);
    virtual ~Window();

    virtual void Initialize() {}
    virtual void Shutdown() {}
    virtual void Update() {}

    virtual void OnEnter() {}
    virtual void OnLeave() {}
    virtual void OnFocusEnter() {}
    virtual void OnFocusLeave() {}
    virtual void OnMouseMove(double x, double y) {}
    virtual void OnMousePress(int button, int modifierKeys) {}
    virtual void OnMouseRelease(int button, int modifierKeys) {}
    virtual void OnMouseScroll(double xoffset, double yoffset) {}
    virtual void OnKeyPress(int keycode, int scancode, int modifierKeys) {}
    virtual void OnKeyRelease(int keycode, int scancode, int modifierKeys) {}
    virtual void OnKeyRepeat(int keycode, int scancode, int modifierKeys) {}
    virtual void OnTextEntered(unsigned int unicodeCodePoint) {}

    void Show();
    void SetPosition(uint32_t x, uint32_t y);
    void Position(uint32_t& x, uint32_t& y);
    void SetSize(uint32_t width, uint32_t height);
    void Size(uint32_t& width, uint32_t& height);
    void SetFocused();
    bool HasFocus();
    bool IsMinimized();
    void SetTitle(const char* str);
    void SetAlpha(float alpha);
    bool IsKeyPressed(int key);

//private:
    IApplication&  m_application;
    IWindow*       m_handle;
};

} // ApplicationFramework namespace
