/******************************************************************************
*	File		-	logGui.h
*	Author		-	Joey Pollack
*	Date		-	2021/09/09 (y/m/d)
*	Mod Date	-	2021/09/10 (y/m/d)
*	Description	-	A debug log window
******************************************************************************/

#ifndef LOG_GUI_H_
#define LOG_GUI_H_

#include <utils/opRes.h>
#include <vector>
#include <string>
#include <utils/logger.h>

namespace lunarium
{
    class LogGui;
    class GuiListener : public LogListener
    {
    public:
        GuiListener(LogGui* pGui, uint32_t acceptedLogLevels = LogLevel::ANY, uint32_t acceptedLogCategories = LogLevel::ANY, const char* myName = "Gui Listener");
		virtual bool Log(LogMessage& message);

    private:
        LogGui* mpGui;
    };

    class LogGui
    {
    public:
        static LogGui& GetInstance();
        static void FreeInstance();

        OpRes Initialize();
        void Show();
        void Clear();

        void SetShow(bool show);
        bool IsShown() const;

    private:
        static LogGui* mpInstance;
        bool mbShow;
        std::vector<std::string> mMsgHistory;
        friend GuiListener;
        GuiListener mListener;

        bool mbOglDebug;
        bool mbInfoVerbose;

    private:
        LogGui();
        LogGui(const LogGui&) = delete;
        const LogGui& operator=(const LogGui&) = delete;
    };
}

#endif // LOG_GUI_H_