/******************************************************************************
*	File		-	iPanel.cpp
*	Author		-	Joey Pollack
*	Date		-	2021/11/01 (y/m/d)
*	Mod Date	-	2021/11/01 (y/m/d)
*	Description	-	Base class for all editor panels
******************************************************************************/

#include "panel.h"

#include "dearimgui/imgui.h"

namespace lunarium
{
namespace gui
{
    Panel::Panel(std::string name, PanelDockZone dock_zone, bool isOpen)
        : mIsOpen(isOpen), mPanelName(name), mDockZone(dock_zone)
    {

    }

    Panel::~Panel()
    {
        
    }

    const char* Panel::GetName() const
    {
        return mPanelName.c_str();
    }

    PanelDockZone Panel::GetDockZone() const
    {
        return mDockZone;
    }

    void Panel::SetOpen(bool isOpen)
    {   
        mIsOpen = isOpen;
    }

    bool Panel::IsOpen()
    {
        return mIsOpen;
    }

    
    void Panel::GetPosition(int& x, int& y) const
    {
        x = mX;
        y = mY;
    }

    void Panel::GetSize(int& w, int& h) const
    {
        w = mWidth;
        h = mHeight;
    }
    
    void Panel::Update(float dt)
    {
        
    }

    void Panel::UpdateMetaInfo()
    {
        ImVec2 p = ImGui::GetWindowPos();
        ImVec2 s = ImGui::GetWindowSize();

        mX = p.x;
        mY = p.y;
        mWidth = s.x;
        mHeight = s.y;
    }
}
}