1#ifndef YAZE_APP_EDITOR_SYSTEM_EDITOR_PANEL_H_
2#define YAZE_APP_EDITOR_SYSTEM_EDITOR_PANEL_H_
7#include <unordered_map>
106 virtual std::string
GetId()
const = 0;
138 virtual void Draw(
bool* p_open) = 0;
378 template <
typename T>
379 T&
GetCached(
const std::string& key, std::function<T()> compute) {
384 return std::any_cast<T&>(
cache_[key]);
410 std::unordered_map<std::string, std::any>
cache_;
Base interface for all logical window content components.
virtual bool IsEnabled() const
Check if this panel is currently enabled.
virtual std::string GetWorkflowDescription() const
Optional workflow description for menus/command palette.
bool IsCacheValid() const
Check if cache has been invalidated.
virtual bool CascadeCloseChildren() const
Whether closing this panel should close child panels.
virtual std::string GetParentPanelId() const
Get parent panel ID for cascade behavior.
virtual std::string GetDisabledTooltip() const
Get tooltip text when panel is disabled.
std::unordered_map< std::string, std::any > cache_
virtual int GetWorkflowPriority() const
Optional workflow ordering priority (lower sorts first).
virtual bool IsVisibleByDefault() const
Whether this panel should be visible by default.
virtual bool PreferAutoHideTabBar() const
Whether the dock node hosting this panel should auto-hide its tab bar.
virtual std::string GetDisplayName() const =0
Human-readable name shown in menus and title bars.
virtual WindowLifecycle GetWindowLifecycle() const
Get the lifecycle category for this window.
void InvalidateCache()
Invalidate all cached computations.
virtual void OnOpen()
Called when panel becomes visible.
virtual std::string GetEditorCategory() const =0
Editor category this panel belongs to.
virtual int GetPriority() const
Get display priority for menu ordering.
virtual void OnClose()
Called when panel is hidden.
virtual void OnFirstDraw()
Called once before the first Draw() in a session.
virtual WindowScope GetScope() const
Get the registration scope for this window.
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 void OnFocus()
Called when panel receives focus.
virtual ~WindowContent()=default
virtual void Draw(bool *p_open)=0
Draw the panel content.
virtual float GetPreferredWidth() const
Get preferred width for this panel (optional)
virtual WindowContextScope GetContextScope() const
Optional context binding for this window (room/selection/etc)
virtual std::string GetWorkflowLabel() const
Optional workflow label for menus/command palette.
virtual bool RequiresLazyInit() const
Whether this panel uses lazy initialization.
void DrawWithLazyInit(bool *p_open)
Execute lazy initialization if needed, then call Draw()
virtual std::string GetId() const =0
Unique identifier for this panel.
virtual std::string GetWorkflowGroup() const
Optional workflow group for hack-centric actions.
void ClearCache()
Clear all cached values (more aggressive than InvalidateCache)
void InvalidateLazyInit()
Reset lazy init state so OnFirstDraw() runs again.
virtual std::string GetShortcutHint() const
Get keyboard shortcut hint for display.
WindowContextScope
Optional context binding for a window's behavior within an editor.
WindowLifecycle
Defines lifecycle behavior for editor windows.
@ EditorBound
Hidden when switching editors (default)
@ CrossEditor
User can pin to persist across editors.
WindowScope
Defines whether a window is session-scoped or global.