11#include <wx/simplebook.h>
12#include <wx/srchctrl.h>
69 void OnDrawItem(wxDC &dc,
const wxRect &rect,
size_t n)
const override;
71 void OnDrawBackground(wxDC &dc,
const wxRect &rect,
size_t n)
const override;
85 void OnDrawItem(wxDC &dc,
const wxRect &rect,
size_t n)
const override;
87 void OnDrawBackground(wxDC &dc,
const wxRect &rect,
size_t n)
const override;
114 wxString
GetTitle()
const override {
return "Navigator"; }
120 void UpdateTreeList(
const std::map<std::string, std::shared_ptr<EmberCore::BehaviorTree>> &trees,
121 const std::string ¤tTreeId);
128 void SetBlackboards(
const std::map<std::string, std::shared_ptr<EmberCore::Blackboard>> &bbs);
133 void SetActiveTree(std::shared_ptr<EmberCore::ITreeStructure> tree,
const std::string &treeId);
204 void FlattenTree(
const std::string &treeId,
int depth, std::set<std::string> &visited,
bool isLastChild,
205 std::vector<bool> parentHasMore);
263 std::map<std::string, std::shared_ptr<EmberCore::Blackboard>>
m_blackboards;
Represents a complete behavior tree data structure.
Represents a blackboard containing multiple entries.
Abstract interface for tree nodes that can be visualized.
Abstract interface for tree structures that can be visualized.
Represents a node in a behavior tree structure.
TreeHierarchyTab subclass with context menu and node activation hooks.
std::function< void(EmberCore::ITreeNode *, wxMenu &)> ContextMenuPopulator
std::function< void(int, EmberCore::ITreeNode *)> ContextMenuHandler
NodeActivatedHandler m_activatedHandler
void SetContextMenuPopulator(ContextMenuPopulator cb)
Sets callback to populate context menu for a node.
void OnPopulateContextMenu(EmberCore::ITreeNode *node, wxMenu &menu) override
Hook to populate context menu for a node.
std::function< void(EmberCore::ITreeNode *)> NodeActivatedHandler
ContextMenuPopulator m_contextPopulator
void OnNodeActivated(EmberCore::ITreeNode *node) override
Hook called when a node is double-clicked/activated.
ContextMenuHandler m_contextHandler
void SetContextMenuHandler(ContextMenuHandler cb)
Sets callback to handle context menu command.
void SetNodeActivatedHandler(NodeActivatedHandler cb)
Sets callback invoked when a node is activated (double-click).
void OnContextMenuCommand(int id, EmberCore::ITreeNode *node) override
Hook to handle context menu command.
NavigatorHierarchyView(wxWindow *parent, const EmberUI::TreeHierarchyConfig &config)
Main navigator tab with tree list, hierarchy view, search, and breadcrumb navigation.
void ToggleCollapse(const std::string &treeId)
std::vector< SearchResult > m_searchResults
std::string m_contextMenuTreeId
EmberCore::Node * GetMutableNode(EmberCore::ITreeNode *inode) const
void SetEditingEnabled(bool enabled)
NavigatorCallbacks m_callbacks
void OnHierarchyContextCommand(int id, EmberCore::ITreeNode *node)
NavigatorHierarchyView * m_hierarchyView
const std::string & GetCurrentTreeId() const
wxStaticText * m_breadcrumbLabel
wxString GetTitle() const override
Returns the display title of the tab.
bool IsEditingEnabled() const
TreeSelectionCallback m_treeSelectionCallback
wxWindow * GetWidget() override
Returns the wxWidgets window used as the tab content.
void SetBlackboards(const std::map< std::string, std::shared_ptr< EmberCore::Blackboard > > &bbs)
std::function< void(EmberCore::ITreeNode *)> m_nodeSelectionCallback
std::string m_browsedTreeId
void ShowTreeContextMenu(int itemIndex, const wxPoint &pos)
bool m_mainTreeSectionCollapsed
std::vector< FlatEntry > m_flatList
void OnClosed() override
Called when the tab is closed.
void SetMainTreeId(const std::string &id)
wxString GetTabType() const override
Returns the tab type identifier.
SearchResultsListBox * m_searchListBox
wxStaticText * m_statusLabel
void OnTreeListContextExpand(wxCommandEvent &event)
bool IsCollapsed(const std::string &treeId) const
void PerformGlobalSearch(const wxString &query)
std::shared_ptr< EmberCore::ITreeStructure > m_activeTreeAdapter
ViewPage m_pageBeforeSearch
NavigatorTreeListBox * m_treeListBox
void OnTreeListContextBrowse(wxCommandEvent &event)
void SetCurrentTree(const std::string &treeId)
Sets the currently selected tree in the list.
void FlattenTree(const std::string &treeId, int depth, std::set< std::string > &visited, bool isLastChild, std::vector< bool > parentHasMore)
void OnHierarchySelectionChanged(EmberCore::ITreeNode *node)
bool IsSectionCollapsed(SectionType section) const
void SetNodeSelectionCallback(std::function< void(EmberCore::ITreeNode *)> cb)
void OnTreeListContextOpenNewScene(wxCommandEvent &event)
void SelectNodeById(size_t nodeId)
Selects the node with the given ID in the hierarchy.
std::map< std::string, std::shared_ptr< EmberCore::Blackboard > > m_blackboards
bool m_blackboardsSectionCollapsed
wxSearchCtrl * m_searchCtrl
const std::vector< FlatEntry > & GetFlatList() const
void SetTreeSelectionCallback(TreeSelectionCallback callback)
void CollectAllReachableSubtrees(const std::string &treeId, std::set< std::string > &reachable) const
void OnBackClicked(wxCommandEvent &event)
void OnActivated() override
Called when the tab becomes active.
void OnSearchEnter(wxCommandEvent &event)
void SetActiveTree(std::shared_ptr< EmberCore::ITreeStructure > tree, const std::string &treeId)
Sets the active tree for hierarchy view and drills into it.
const std::string & GetBrowsedTreeId() const
void OnSearchTextChanged(wxCommandEvent &event)
void OnHierarchyNodeActivated(EmberCore::ITreeNode *node)
void OnTreeListContextCollapse(wxCommandEvent &event)
std::function< void(const std::string &treeId)> TreeSelectionCallback
void UpdateTreeList(const std::map< std::string, std::shared_ptr< EmberCore::BehaviorTree > > &trees, const std::string ¤tTreeId)
Updates tree list from project trees and sets current tree.
void CollectSubTreeRefs(EmberCore::Node *node, std::set< std::string > &refs) const
bool IsActiveTree(const std::string &treeId) const
void SetBlackboardSelectionCallback(std::function< void(const std::string &)> cb)
void OnBlackboardClicked(const std::string &bbId)
wxPanel * m_breadcrumbPanel
void SetCallbacks(NavigatorCallbacks cb)
std::map< std::string, std::shared_ptr< EmberCore::BehaviorTree > > m_projectTrees
std::string m_currentTreeId
std::set< std::string > m_collapsedTrees
void NavigateBack()
Navigates back in breadcrumb history.
void OnHierarchyContextMenu(EmberCore::ITreeNode *node, wxMenu &menu)
NavigatorHierarchyView * GetHierarchyView() const
void DrillIntoTree(const std::string &treeId)
Drills into a subtree (updates breadcrumb and hierarchy).
int GetToggleHitX(int depth, bool isCurrent) const
std::map< std::string, TreeInfo > m_treeInfoMap
void OnTreeListContextViewInCurrent(wxCommandEvent &event)
void ToggleSectionCollapse(SectionType section)
virtual NavigatorHierarchyView * CreateHierarchyView(wxWindow *parent, const TreeHierarchyConfig &cfg)
NavigatorTab(wxWindow *parent)
void SetLayoutInvalidationCallback(std::function< void()> cb)
std::function< void(const std::string &)> m_blackboardSelectionCallback
const std::vector< SearchResult > & GetSearchResults() const
int FindItemByTreeId(const std::string &treeId) const
bool m_otherTreesSectionCollapsed
void ShowSearchContextMenu(int resultIndex, const wxPoint &pos)
Virtual list box for the tree list (main tree, other trees, blackboards).
void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const override
wxCoord OnMeasureItem(size_t n) const override
void OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const override
void OnLeftDown(wxMouseEvent &event)
void OnRightDown(wxMouseEvent &event)
NavigatorTreeListBox(NavigatorTab *owner, wxWindow *parent, wxWindowID id)
void OnLeftDClick(wxMouseEvent &event)
Virtual list box for search results (trees and nodes).
void OnLeftDClick(wxMouseEvent &event)
void OnRightDown(wxMouseEvent &event)
void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const override
void OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const override
wxCoord OnMeasureItem(size_t n) const override
SearchResultsListBox(NavigatorTab *owner, wxWindow *parent, wxWindowID id)
Base class for hierarchy tabs operating on ITreeNode.
Interface for tab-based UI components in the application.
Main types header for EmberCore.
Callbacks for navigator actions (view, refresh, center, open scene, close).
std::function< bool()> canViewInCurrentScene
std::function< void(EmberCore::ITreeNode *)> centerOnNode
std::function< void()> refreshVisualization
std::function< void()> onTabClosed
std::function< void(const std::string &)> openInNewScene
Flattened tree list entry for display in NavigatorTreeListBox.
std::vector< bool > parentHasMore
Search result (tree or node) for display in SearchResultsListBox.
std::set< std::string > subtreeRefs
Configuration for TreeHierarchyTab appearance and behavior.