10#include <wx/srchctrl.h>
30 wxString
GetTitle()
const override {
return "Tree Selector"; }
31 wxString
GetTabType()
const override {
return "TreeSelector"; }
35 void UpdateTreeList(
const std::map<std::string, std::shared_ptr<EmberCore::BehaviorTree>> &trees,
36 const std::string ¤tTreeId);
75 void FlattenTree(
const std::string &treeId,
int depth, std::set<std::string> &visited,
bool isLastChild,
76 std::vector<bool> parentHasMore);
141 void OnDrawItem(wxDC &dc,
const wxRect &rect,
size_t n)
const override;
143 void OnDrawBackground(wxDC &dc,
const wxRect &rect,
size_t n)
const override;
Represents a complete behavior tree data structure.
Represents a node in a behavior tree structure.
Abstract interface for individual tabs that can be moved between panels.
Main application window for EmberForge.
TreeListBox(TreeSelectorTab *owner, wxWindow *parent, wxWindowID id)
void OnLeftDown(wxMouseEvent &event)
wxCoord OnMeasureItem(size_t n) const override
TreeSelectorTab * m_owner
void OnRightDown(wxMouseEvent &event)
void OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const override
void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const override
void ToggleCollapse(const std::string &treeId)
void OnActivated() override
Called when the tab becomes the active/visible tab.
bool m_subtreesSectionCollapsed
wxString GetTabType() const override
Get a unique identifier for this tab type.
void OnContextOpenNewScene(wxCommandEvent &event)
void OnContextExpandAll(wxCommandEvent &event)
wxButton * m_collapseAllBtn
std::string m_contextMenuTreeId
void OnExpandAll(wxCommandEvent &event)
wxString GetTitle() const override
Get the display title for this tab.
void OnSearchTextChanged(wxCommandEvent &event)
void FlattenTree(const std::string &treeId, int depth, std::set< std::string > &visited, bool isLastChild, std::vector< bool > parentHasMore)
bool m_rootSectionCollapsed
int GetToggleHitX(int depth, bool isCurrent) const
void SetCurrentTree(const std::string &treeId)
void OnClosed() override
Called when the tab is about to be closed/removed Use this for cleanup operations.
wxWindow * GetWidget() override
Get the main widget for this tab.
TreeSelectorTab(wxWindow *parent, MainFrame *mainFrame=nullptr)
const std::vector< FlatEntry > & GetFlatList() const
void OnContextCollapseAll(wxCommandEvent &event)
std::vector< FlatEntry > m_flatList
wxSearchCtrl * m_searchCtrl
wxButton * m_expandAllBtn
std::string m_currentTreeId
void SetTreeSelectionCallback(TreeSelectionCallback callback)
void OnTreeSelected(wxCommandEvent &event)
void UpdateTreeList(const std::map< std::string, std::shared_ptr< EmberCore::BehaviorTree > > &trees, const std::string ¤tTreeId)
void ShowContextMenu(int itemIndex, const wxPoint &pos)
std::set< std::string > m_collapsedTrees
void OnContextViewInCurrent(wxCommandEvent &event)
std::function< void(const std::string &treeId)> TreeSelectionCallback
TreeSelectionCallback m_selectionCallback
bool IsCollapsed(const std::string &treeId) const
void OnCollapseAll(wxCommandEvent &event)
void CollectSubTreeRefs(EmberCore::Node *node, std::set< std::string > &refs) const
int FindItemByTreeId(const std::string &treeId) const
void ToggleSectionCollapse(SectionType section)
std::map< std::string, TreeInfo > m_treeInfoMap
bool IsSectionCollapsed(SectionType section) const
const std::string & GetCurrentTreeId() const
wxStaticText * m_statusLabel
Main types header for EmberCore.
std::vector< bool > parentHasMore
std::set< std::string > subtreeRefs