1#ifndef YAZE_APP_EDITOR_SYSTEM_EDITOR_PANEL_H_
2#define YAZE_APP_EDITOR_SYSTEM_EDITOR_PANEL_H_
7#include <unordered_map>
107 virtual std::string
GetId()
const = 0;
139 virtual void Draw(
bool* p_open) = 0;
347 template <
typename T>
348 T&
GetCached(
const std::string& key, std::function<T()> compute) {
353 return std::any_cast<T&>(
cache_[key]);
379 std::unordered_map<std::string, std::any>
cache_;
Base interface for all logical panel components.
void InvalidateLazyInit()
Reset lazy init state so OnFirstDraw() runs again.
virtual void OnClose()
Called when panel is hidden.
virtual std::string GetId() const =0
Unique identifier for this panel.
bool IsCacheValid() const
Check if cache has been invalidated.
virtual bool CascadeCloseChildren() const
Whether closing this panel should close child panels.
virtual bool RequiresLazyInit() const
Whether this panel uses lazy initialization.
virtual bool IsVisibleByDefault() const
Whether this panel should be visible by default.
T & GetCached(const std::string &key, std::function< T()> compute)
Get or compute a cached value.
virtual std::string GetIcon() const =0
Material Design icon for this panel.
virtual ~EditorPanel()=default
void DrawWithLazyInit(bool *p_open)
Execute lazy initialization if needed, then call Draw()
virtual float GetPreferredWidth() const
Get preferred width for this panel (optional)
void ClearCache()
Clear all cached values (more aggressive than InvalidateCache)
void InvalidateCache()
Invalidate all cached computations.
virtual void OnFocus()
Called when panel receives focus.
virtual PanelScope GetScope() const
Get the registration scope for this panel.
virtual std::string GetDisabledTooltip() const
Get tooltip text when panel is disabled.
virtual int GetPriority() const
Get display priority for menu ordering.
virtual std::string GetShortcutHint() const
Get keyboard shortcut hint for display.
virtual std::string GetDisplayName() const =0
Human-readable name shown in menus and title bars.
virtual std::string GetParentPanelId() const
Get parent panel ID for cascade behavior.
virtual PanelContextScope GetContextScope() const
Optional context binding for this panel (room/selection/etc)
virtual PanelCategory GetPanelCategory() const
Get the lifecycle category for this panel.
virtual void OnFirstDraw()
Called once before the first Draw() in a session.
virtual void Draw(bool *p_open)=0
Draw the panel content.
std::unordered_map< std::string, std::any > cache_
virtual std::string GetEditorCategory() const =0
Editor category this panel belongs to.
virtual bool IsEnabled() const
Check if this panel is currently enabled.
virtual void OnOpen()
Called when panel becomes visible.
PanelCategory
Defines lifecycle behavior for editor panels.
@ Persistent
Always visible once shown.
@ EditorBound
Hidden when switching editors (default)
@ CrossEditor
User can pin to persist across editors.
PanelScope
Defines whether a panel is session-scoped or global.
PanelContextScope
Optional context binding for a panel's behavior within an editor.