/******************************************************************************
*	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 "iPanel.h"

#include <dearimgui/imgui.h>

namespace lunarium
{
    Panel::Panel(PanelType type, bool isOpen)
        : mType(type), mIsOpen(isOpen)
    {

    }

    PanelType Panel::GetType() const
    {
        return mType;
    }
    
    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::UpdateMetaInfo()
    {
        ImVec2 p = ImGui::GetWindowPos();
        ImVec2 s = ImGui::GetWindowSize();

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