Overview
EmberForge's user interface is built on a flexible panel and tab system that allows users to customize their workspace. This document explains the component hierarchy and how the pieces fit together.
Component Hierarchy
App (wxApp)
└── MainFrame (wxFrame)
├── wxAuiManager (docking system)
│ ├── LeftSidePanel
│ │ └── wxAuiNotebook
│ │ ├── FileExplorerTab
│ │ └── SceneHierarchyTab
│ ├── MainPanel (center)
│ │ └── SceneContainer
│ │ └── BehaviorTreeScene
│ │ └── TreeVisualization
│ ├── RightSidePanel
│ │ └── wxAuiNotebook
│ │ └── PropertiesTab
│ └── BottomPanel
│ └── wxAuiNotebook
│ └── LogTab
└── Menu/Toolbar
All panels implement the IPanel interface:
public:
virtual wxWindow* GetWindow() = 0;
};
Abstract interface for all panels in the Ember application.
virtual wxString GetPanelType() const =0
Get a unique identifier for this panel type.
virtual void Refresh()
Called when the panel should refresh its display This should update the panel's content to reflect cu...
virtual void OnActivated()
Called when the panel becomes visible/active.
virtual void OnDeactivated()
Called when the panel becomes hidden/inactive.
virtual wxString GetTitle() const =0
Get the display title for this panel.
Panel Base Class
The Panel base class provides common functionality:
| Method | Purpose |
| CreateLayout() | Set up panel UI (virtual) |
| ApplyTheme() | Apply color theme |
| Refresh() | Refresh panel content |
| Save() / Load() | Serialize/deserialize state |
SidePanel extends Panel for side dock panels with tab support:
public:
int GetActiveTabIndex();
protected:
virtual void CreateToolbar();
virtual bool ShouldShowToolbar() const;
};
std::unique_ptr< ITab > ITabPtr
Smart pointer type for ITab instances.
Base implementation of IPanel interface.
Base class for sidebar panels with shared tab management backend.
ITabPtr RemoveTab(int index)
Remove a tab by index.
int AddTab(ITabPtr tab)
Add a tab to this panel.
virtual void CreateNotebook()
bool SetActiveTab(int index)
Set the active tab by index.
ITab * GetTab(int index) const
Get a tab by index.
Concrete Panels
Tab System
ITab Interface
Tabs are content components within panels:
public:
virtual wxBitmap
GetIcon()
const = 0;
};
Abstract interface for individual tabs that can be moved between panels.
virtual void OnDeactivated()
Called when the tab becomes inactive/hidden.
virtual bool CanMove() const
Check if this tab can be moved to other panels.
virtual bool CanClose() const
Check if this tab can be closed by the user.
virtual wxBitmap GetIcon() const
Get an optional icon for this tab.
virtual wxString GetTitle() const =0
Get the display title for this tab.
virtual wxWindow * GetWidget()=0
Get the main widget for this tab.
virtual void OnActivated()
Called when the tab becomes the active/visible tab.
virtual void OnClosed()
Called when the tab is about to be closed/removed Use this for cleanup operations.
virtual wxString GetTabType() const =0
Get a unique identifier for this tab type.
virtual void Refresh()
Called when the tab should refresh its display This should update the tab's content to reflect curren...
virtual bool IsValid() const
Check if the tab is in a valid state.
virtual void Initialize()
Initialize the tab after construction Called once after the tab is created and configured.
Tab Implementations
| Tab | Purpose | Features |
| FileExplorerTab | Browse project files | Tree/grid view, drag-drop, search |
| SceneHierarchyTab | Navigate tree structure | Node selection, expand/collapse |
| PropertiesTab | Edit node properties | Property grid, blackboard editing |
| LogTab | Display log messages | Filtering, search, virtual list |
| ToolTab | Tool palette | (Future: node creation tools) |
TabFactory
Creates tabs by type name:
auto& factory = EmberForge::TabFactory::GetInstance();
auto tab = factory.CreateTab("FileExplorer", parentWindow);
auto types = factory.GetAvailableTabTypes();
TabContainer
Manages a collection of tabs:
class TabContainer {
public:
void RemoveTab(int index);
void CloseTab(int index);
void SetTabTitle(int index, const wxString& title);
void SetTabState(int index, TabState state);
void SetTabActivatedCallback(Callback cb);
void SetTabClosedCallback(Callback cb);
};
Scene System
Scenes are visual content areas in the MainPanel:
public:
};
Abstract interface for different scene types in the MainPanel.
virtual bool HasUnsavedChanges() const
Check if this scene has unsaved changes.
virtual void OnActivated()
Called when this scene becomes the active tab.
virtual wxString GetSceneType() const =0
Get a unique identifier for this scene type.
virtual void Refresh()
Called when the scene should refresh its display.
virtual wxString GetTitle() const =0
Get the display title for this scene.
virtual wxPanel * GetPanel()=0
Get the main panel widget for this scene.
virtual bool Save()
Save the scene (if applicable)
virtual void OnDeactivated()
Called when this scene is no longer the active tab.
The primary scene type for visualizing behavior trees:
public:
void SetTreeStructure(std::shared_ptr<ITreeStructure> tree);
void UpdateTreeSelector(const std::vector<std::string>& names,
const std::string& current);
void SetTreeSelectionCallback(TreeSelectionCallback cb);
};
Scene implementation for behavior tree visualization.
void SetNodeSelectionCallback(NodeSelectionCallback callback)
Set callback for node selection events.
void SetBehaviorTree(std::shared_ptr< EmberCore::Node > root)
Set the behavior tree for this scene using legacy Node interface.
std::function< void(EmberCore::ITreeNode *)> NodeSelectionCallback
SceneContainer
Manages multiple scenes with tabs:
class SceneContainer {
public:
int AddScene(std::unique_ptr<IScene> scene);
void RemoveScene(int index);
void SuspendInactiveScenes();
void ResumeAllScenes();
void SetSceneActivatedCallback(Callback cb);
void SetSceneDeactivatedCallback(Callback cb);
};
TreeVisualization
Canvas component for rendering behavior trees:
class TreeVisualization : public wxPanel {
public:
void SetTreeStructure(std::shared_ptr<ITreeStructure> tree);
void SetZoom(float zoom);
void CenterView();
void FitToWindow();
void SelectNode(ITreeNode* node);
void ClearSelection();
void SetConfig(const VisualizationConfig& config);
};
Dialogs
Common Dialogs
Dialog Pattern
Dialogs typically follow this pattern:
if (dlg.ShowModal() == wxID_OK) {
}
Preferences dialog for configuring EmberForge application settings.
Event Flow
Node Selection
User clicks node in TreeVisualization
│
▼
TreeVisualization::OnMouseDown()
│
▼
NodeSelectionCallback invoked
│
▼
MainFrame::OnNodeSelected()
│
├─► SceneHierarchyTab::SelectNode()
│
└─► PropertiesTab::SetSelectedNode()
File Open
User selects File > Open
│
▼
MainFrame::OnFileOpen()
│
▼
wxFileDialog for file selection
│
▼
LibXMLBehaviorTreeParser::ParseFile()
│
▼
MainFrame::LoadBehaviorTree()
│
├─► Create DirectTreeAdapter
│
├─► BehaviorTreeScene::SetTreeStructure()
│
└─► Update hierarchy and properties
Layout Management
EmberForge uses wxAuiManager for dockable panels:
m_auiManager.SetManagedWindow(this);
m_auiManager.AddPane(m_leftPanel, wxAuiPaneInfo()
.Left()
.Caption("Explorer")
.MinSize(200, -1)
.BestSize(250, -1));
m_auiManager.AddPane(m_mainPanel, wxAuiPaneInfo()
.CenterPane()
.Caption("Scene"));
m_auiManager.Update();
Saving/Restoring Layout
wxString layout = m_auiManager.SavePerspective();
prefs.SetString("window/layout", layout);
wxString layout = prefs.GetString("window/layout", "");
if (!layout.empty()) {
m_auiManager.LoadPerspective(layout);
}
Theming
Panels and tabs support theming through AppPreferences:
auto& prefs = AppPreferencesManager::GetInstance();
wxColour bg = prefs.GetPanelBackgroundColor();
wxColour fg = prefs.GetPanelForegroundColor();
SetBackgroundColour(bg);
SetForegroundColour(fg);
}
void Refresh() override
Called when the panel should refresh its display This should update the panel's content to reflect cu...
virtual void ApplyTheme()
Apply current theme to the panel Called when theme changes.
See Also