/******************************************************************************
*	File		-	world_tree.h
*	Author		-	Joey Pollack
*	Date		-	2021/11/04 (y/m/d)
*	Mod Date	-	2021/11/04 (y/m/d)
*	Description	-	The tree view listing all objects in the world
******************************************************************************/

#ifndef WORLD_TREE_H_
#define WORLD_TREE_H_

#include <gui/panel.h>

namespace lunarium
{
    class World; 
    class Entity;

namespace editor
{
    class Editor;

    class WorldTree : public Panel
    {
    public:
        WorldTree(Editor* editor);

        void SetWorld(lunarium::World* pWorld);
        lunarium::World* GetWorld();

        void DoFrame();

    private:
        lunarium::World* mpWorld;
        Editor* mpEditor;
        Entity* mpSelectedEntity;
        bool mCMenuOpen;

        // Helpers
        void ShowEntity(Entity* pEnt);

        // Context menus
        void DoContextMenu();

        void HandlePopupEvents();
        void PopupNewEntity();
        void RecursiveEntDelete(Entity* pe);
    

    private: // POPUP ENUMS
        enum PopUp
        {
            NEW_ENTITY,
        };

        bool mNewChild;
        Entity* mParentEnt;
    };
}
}
#endif  // WORLD_TREE_H_