Ember
Loading...
Searching...
No Matches
BehaviorTreeScene.h
Go to the documentation of this file.
1#pragma once
2
4#include "Core/Node.h"
5#include "Interfaces/IScene.h"
9#include <functional>
10#include <memory>
11#include <string>
12#include <vector>
13#include <wx/wx.h>
14
21class BehaviorTreeScene : public IScene {
22 public:
23 // Callback type for node selection events
24 using NodeSelectionCallback = std::function<void(EmberCore::ITreeNode *)>;
25
31 BehaviorTreeScene(wxWindow *parent, const wxString &title = "Behavior Tree");
32
33 virtual ~BehaviorTreeScene();
34
35 // IScene interface implementation
36 wxPanel *GetPanel() override { return m_panel; }
37 wxString GetTitle() const override { return m_title; }
38 wxString GetSceneType() const override { return "BehaviorTree"; }
39 void OnActivated() override;
40 void OnDeactivated() override;
41 void Refresh() override;
42 bool HasUnsavedChanges() const override { return m_hasUnsavedChanges; }
43 bool Save() override;
44
45 // Behavior tree specific methods
50 void SetBehaviorTree(std::shared_ptr<EmberCore::Node> root);
51
56 void SetBehaviorTree(std::shared_ptr<EmberCore::ITreeStructure> tree);
57
63
69
70 std::shared_ptr<EmberCore::ITreeStructure> GetTreeAdapter() const { return m_treeAdapter; }
72
77
82 void SetTitle(const wxString &title);
83
89
94 void SetCanvasBackgroundColor(const wxColour &color);
95
96 // Non-copyable
99
100 private:
101 void CreateLayout();
102
103 // UI components
104 wxPanel *m_panel;
106
107 // Data
108 std::shared_ptr<EmberCore::Node> m_behaviorTreeRoot; // Legacy storage for backward compatibility
109 std::shared_ptr<EmberCore::ITreeStructure> m_treeAdapter; // Adapter for abstraction layer
110 wxString m_title;
112
113 // Callbacks
115};
NodeSelectionCallback m_nodeSelectionCallback
EmberCore::ITreeStructure * GetAbstractedTree() const
Get the abstracted tree structure.
BehaviorTreeScene(wxWindow *parent, const wxString &title="Behavior Tree")
Construct a new BehaviorTreeScene.
std::shared_ptr< EmberCore::ITreeStructure > m_treeAdapter
wxString GetTitle() const override
Returns the display title of the scene.
wxPanel * GetPanel() override
Returns the wxPanel used as the scene content.
void OnDeactivated() override
Called when the scene becomes inactive.
void CreateSampleBehaviorTree()
Create a sample behavior tree for testing/demo purposes.
std::shared_ptr< EmberCore::Node > m_behaviorTreeRoot
BehaviorTreeScene(const BehaviorTreeScene &)=delete
void Refresh() override
Refreshes the scene content.
EmberCore::Node * GetBehaviorTree() const
Get the behavior tree root node (legacy interface)
bool HasUnsavedChanges() const override
Returns true if the scene has unsaved changes.
EmberForge::ForgeTreeCanvas * GetTreeVisualization() const
void SetNodeSelectionCallback(NodeSelectionCallback callback)
Set callback for node selection events.
void OnActivated() override
Called when the scene becomes active.
void SetTitle(const wxString &title)
Set the title of this scene.
BehaviorTreeScene & operator=(const BehaviorTreeScene &)=delete
std::shared_ptr< EmberCore::ITreeStructure > GetTreeAdapter() const
void SetCanvasBackgroundColor(const wxColour &color)
Set the canvas background color.
void SetBehaviorTree(std::shared_ptr< EmberCore::Node > root)
Set the behavior tree for this scene using legacy Node interface.
wxString GetSceneType() const override
Returns the scene type identifier.
EmberForge::ForgeTreeCanvas * m_treeVisualization
bool Save() override
Saves the scene content; returns true on success.
std::function< void(EmberCore::ITreeNode *)> NodeSelectionCallback
Abstract interface for tree nodes that can be visualized.
Definition ITreeNode.h:31
Abstract interface for tree structures that can be visualized.
Represents a node in a behavior tree structure.
Definition Node.h:20
Interface for scene-based UI components (e.g., views or screens).
Definition IScene.h:7