You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
/******************************************************************************
|
|
* File - panel_manager.h
|
|
* Author - Joey Pollack
|
|
* Date - 2022/02/07 (y/m/d)
|
|
* Mod Date - 2022/02/07 (y/m/d)
|
|
* Description - Manage the editor panels
|
|
******************************************************************************/
|
|
|
|
#ifndef PANEL_MANAGER_H_
|
|
#define PANEL_MANAGER_H_
|
|
|
|
#include <utils/op_res.h>
|
|
#include <dearimgui/imgui.h>
|
|
#include <gui/panel.h>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
struct ImGuiWindowClass;
|
|
|
|
namespace lunarium{
|
|
class IGraphics;
|
|
namespace editor
|
|
{
|
|
class Editor;
|
|
class PanelManager
|
|
{
|
|
|
|
public:
|
|
PanelManager();
|
|
OpRes Initialize(Editor* editor, std::string name, bool split_bottom = false);
|
|
void Shutdown();
|
|
|
|
// Panel interface
|
|
[[nodiscard]] OpRes AddPanel(gui::Panel* panel, uint32_t& id);
|
|
void OpenPanel(uint32_t id);
|
|
void ClosePanel(uint32_t id);
|
|
bool IsOpen(uint32_t id);
|
|
gui::Panel* GetPanel(uint32_t id);
|
|
const ImGuiWindowClass* GetWindowClass() const;
|
|
|
|
// Docking
|
|
bool IsBottomSplit() const;
|
|
void SetSplitBottom(bool split_bottom);
|
|
void ResetDocking();
|
|
|
|
void OnTick(double delta);
|
|
void MakeDockSpaces();
|
|
void RenderPanels();
|
|
|
|
private:
|
|
Editor* mpEditor;
|
|
std::string mName;
|
|
bool mSplitBottom; // If true the bottom dock node will also be split into left/right
|
|
bool mResetDockSpace;
|
|
std::vector<gui::Panel*> mPanels;
|
|
std::map<const char*, gui::Panel*> mPanelsByName;
|
|
unsigned int mDockSpaceID;
|
|
ImGuiWindowClass mWindowClass;
|
|
std::map<gui::PanelDockZone, unsigned int> mDockZoneIDs;
|
|
|
|
private:
|
|
void DestoryPanels();
|
|
|
|
|
|
};
|
|
}}
|
|
|
|
#endif // PANEL_MANAGER_H_
|