Ember
Loading...
Searching...
No Matches
TreeSelectorTab Class Reference

#include <TreeSelectorTab.h>

Inheritance diagram for TreeSelectorTab:
ITab

Classes

struct  FlatEntry
struct  TreeInfo

Public Types

enum class  SectionType { None , RootTrees , Subtrees }
using TreeSelectionCallback = std::function<void(const std::string &treeId)>

Public Member Functions

 TreeSelectorTab (wxWindow *parent, MainFrame *mainFrame=nullptr)
wxWindow * GetWidget () override
 Get the main widget for this tab.
wxString GetTitle () const override
 Get the display title for this tab.
wxString GetTabType () const override
 Get a unique identifier for this tab type.
void OnClosed () override
 Called when the tab is about to be closed/removed Use this for cleanup operations.
void OnActivated () override
 Called when the tab becomes the active/visible tab.
void UpdateTreeList (const std::map< std::string, std::shared_ptr< EmberCore::BehaviorTree > > &trees, const std::string &currentTreeId)
void SetCurrentTree (const std::string &treeId)
void ClearTreeList ()
void SetTreeSelectionCallback (TreeSelectionCallback callback)
const std::vector< FlatEntry > & GetFlatList () const
const std::string & GetCurrentTreeId () const
void ToggleCollapse (const std::string &treeId)
void ToggleSectionCollapse (SectionType section)
bool IsCollapsed (const std::string &treeId) const
bool IsSectionCollapsed (SectionType section) const
int GetToggleHitX (int depth, bool isCurrent) const
void ShowContextMenu (int itemIndex, const wxPoint &pos)
Public Member Functions inherited from ITab
virtual ~ITab ()=default
virtual wxBitmap GetIcon () const
 Get an optional icon for this tab.
virtual void Initialize ()
 Initialize the tab after construction Called once after the tab is created and configured.
virtual void Refresh ()
 Called when the tab should refresh its display This should update the tab's content to reflect current state.
virtual void OnDeactivated ()
 Called when the tab becomes inactive/hidden.
virtual bool IsValid () const
 Check if the tab is in a valid state.
virtual bool CanClose () const
 Check if this tab can be closed by the user.
virtual bool CanMove () const
 Check if this tab can be moved to other panels.
virtual wxString SerializeState () const
 Serialize the tab's current state to a string.
virtual void DeserializeState (const wxString &state)
 Restore the tab's state from serialized data.
virtual bool HasUnsavedChanges () const
 Check if this tab has unsaved changes.
virtual bool Save ()
 Save the tab's data (if applicable)
virtual bool SupportsOperation (const wxString &operation) const
 Check if this tab supports the given operation.
virtual bool ExecuteOperation (const wxString &operation, const wxString &parameter="")
 Execute a named operation on this tab.

Private Types

enum  {
  ID_LIST_BOX = wxID_HIGHEST + 1 , ID_SEARCH_CTRL , ID_COLLAPSE_ALL_BTN , ID_EXPAND_ALL_BTN ,
  ID_CTX_VIEW_CURRENT , ID_CTX_OPEN_NEW_SCENE , ID_CTX_EXPAND_ALL , ID_CTX_COLLAPSE_ALL
}

Private Member Functions

void CreateLayout ()
void CollectSubTreeRefs (EmberCore::Node *node, std::set< std::string > &refs) const
void BuildFlatList ()
void FlattenTree (const std::string &treeId, int depth, std::set< std::string > &visited, bool isLastChild, std::vector< bool > parentHasMore)
int FindItemByTreeId (const std::string &treeId) const
void OnSearchTextChanged (wxCommandEvent &event)
void OnTreeSelected (wxCommandEvent &event)
void OnContextViewInCurrent (wxCommandEvent &event)
void OnContextOpenNewScene (wxCommandEvent &event)
void OnContextExpandAll (wxCommandEvent &event)
void OnContextCollapseAll (wxCommandEvent &event)
void OnCollapseAll (wxCommandEvent &event)
void OnExpandAll (wxCommandEvent &event)
void CollapseAllTrees ()
void ExpandAllTrees ()
 wxDECLARE_EVENT_TABLE ()

Private Attributes

wxSearchCtrl * m_searchCtrl
wxButton * m_collapseAllBtn
wxButton * m_expandAllBtn
TreeListBox * m_listBox
wxStaticText * m_statusLabel
std::map< std::string, TreeInfo > m_treeInfoMap
std::vector< FlatEntry > m_flatList
std::set< std::string > m_collapsedTrees
bool m_rootSectionCollapsed
bool m_subtreesSectionCollapsed
std::string m_currentTreeId
std::string m_contextMenuTreeId
wxString m_searchFilter
MainFrame * m_mainFrame
TreeSelectionCallback m_selectionCallback

Detailed Description

Definition at line 22 of file TreeSelectorTab.h.

Member Typedef Documentation

◆ TreeSelectionCallback

using TreeSelectorTab::TreeSelectionCallback = std::function<void(const std::string &treeId)>

Definition at line 24 of file TreeSelectorTab.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_LIST_BOX 
ID_SEARCH_CTRL 
ID_COLLAPSE_ALL_BTN 
ID_EXPAND_ALL_BTN 
ID_CTX_VIEW_CURRENT 
ID_CTX_OPEN_NEW_SCENE 
ID_CTX_EXPAND_ALL 
ID_CTX_COLLAPSE_ALL 

Definition at line 122 of file TreeSelectorTab.h.

◆ SectionType

enum class TreeSelectorTab::SectionType
strong
Enumerator
None 
RootTrees 
Subtrees 

Definition at line 43 of file TreeSelectorTab.h.

Constructor & Destructor Documentation

◆ TreeSelectorTab()

TreeSelectorTab::TreeSelectorTab ( wxWindow * parent,
MainFrame * mainFrame = nullptr )

Definition at line 298 of file TreeSelectorTab.cpp.

Member Function Documentation

◆ BuildFlatList()

void TreeSelectorTab::BuildFlatList ( )
private

Definition at line 395 of file TreeSelectorTab.cpp.

◆ ClearTreeList()

void TreeSelectorTab::ClearTreeList ( )

Definition at line 642 of file TreeSelectorTab.cpp.

◆ CollapseAllTrees()

void TreeSelectorTab::CollapseAllTrees ( )
private

Definition at line 739 of file TreeSelectorTab.cpp.

◆ CollectSubTreeRefs()

void TreeSelectorTab::CollectSubTreeRefs ( EmberCore::Node * node,
std::set< std::string > & refs ) const
private

Definition at line 342 of file TreeSelectorTab.cpp.

◆ CreateLayout()

void TreeSelectorTab::CreateLayout ( )
private

Definition at line 306 of file TreeSelectorTab.cpp.

◆ ExpandAllTrees()

void TreeSelectorTab::ExpandAllTrees ( )
private

Definition at line 749 of file TreeSelectorTab.cpp.

◆ FindItemByTreeId()

int TreeSelectorTab::FindItemByTreeId ( const std::string & treeId) const
private

Definition at line 575 of file TreeSelectorTab.cpp.

◆ FlattenTree()

void TreeSelectorTab::FlattenTree ( const std::string & treeId,
int depth,
std::set< std::string > & visited,
bool isLastChild,
std::vector< bool > parentHasMore )
private

Definition at line 527 of file TreeSelectorTab.cpp.

◆ GetCurrentTreeId()

const std::string & TreeSelectorTab::GetCurrentTreeId ( ) const
inline

Definition at line 61 of file TreeSelectorTab.h.

◆ GetFlatList()

const std::vector< FlatEntry > & TreeSelectorTab::GetFlatList ( ) const
inline

Definition at line 60 of file TreeSelectorTab.h.

◆ GetTabType()

wxString TreeSelectorTab::GetTabType ( ) const
inlineoverridevirtual

Get a unique identifier for this tab type.

Returns
wxString Identifier like "Properties", "Logger", etc.

Implements ITab.

Definition at line 31 of file TreeSelectorTab.h.

◆ GetTitle()

wxString TreeSelectorTab::GetTitle ( ) const
inlineoverridevirtual

Get the display title for this tab.

Returns
wxString The title to show in the tab header

Implements ITab.

Definition at line 30 of file TreeSelectorTab.h.

◆ GetToggleHitX()

int TreeSelectorTab::GetToggleHitX ( int depth,
bool isCurrent ) const

Definition at line 632 of file TreeSelectorTab.cpp.

◆ GetWidget()

wxWindow * TreeSelectorTab::GetWidget ( )
inlineoverridevirtual

Get the main widget for this tab.

Returns
wxWindow* The widget that can be added to notebook pages

Implements ITab.

Definition at line 29 of file TreeSelectorTab.h.

◆ IsCollapsed()

bool TreeSelectorTab::IsCollapsed ( const std::string & treeId) const

Definition at line 602 of file TreeSelectorTab.cpp.

◆ IsSectionCollapsed()

bool TreeSelectorTab::IsSectionCollapsed ( SectionType section) const

Definition at line 623 of file TreeSelectorTab.cpp.

◆ OnActivated()

void TreeSelectorTab::OnActivated ( )
overridevirtual

Called when the tab becomes the active/visible tab.

Reimplemented from ITab.

Definition at line 660 of file TreeSelectorTab.cpp.

◆ OnClosed()

void TreeSelectorTab::OnClosed ( )
overridevirtual

Called when the tab is about to be closed/removed Use this for cleanup operations.

Reimplemented from ITab.

Definition at line 654 of file TreeSelectorTab.cpp.

◆ OnCollapseAll()

void TreeSelectorTab::OnCollapseAll ( wxCommandEvent & event)
private

Definition at line 735 of file TreeSelectorTab.cpp.

◆ OnContextCollapseAll()

void TreeSelectorTab::OnContextCollapseAll ( wxCommandEvent & event)
private

Definition at line 728 of file TreeSelectorTab.cpp.

◆ OnContextExpandAll()

void TreeSelectorTab::OnContextExpandAll ( wxCommandEvent & event)
private

Definition at line 721 of file TreeSelectorTab.cpp.

◆ OnContextOpenNewScene()

void TreeSelectorTab::OnContextOpenNewScene ( wxCommandEvent & event)
private

Definition at line 714 of file TreeSelectorTab.cpp.

◆ OnContextViewInCurrent()

void TreeSelectorTab::OnContextViewInCurrent ( wxCommandEvent & event)
private

Definition at line 701 of file TreeSelectorTab.cpp.

◆ OnExpandAll()

void TreeSelectorTab::OnExpandAll ( wxCommandEvent & event)
private

Definition at line 737 of file TreeSelectorTab.cpp.

◆ OnSearchTextChanged()

void TreeSelectorTab::OnSearchTextChanged ( wxCommandEvent & event)
private

Definition at line 674 of file TreeSelectorTab.cpp.

◆ OnTreeSelected()

void TreeSelectorTab::OnTreeSelected ( wxCommandEvent & event)
private

Definition at line 670 of file TreeSelectorTab.cpp.

◆ SetCurrentTree()

void TreeSelectorTab::SetCurrentTree ( const std::string & treeId)

Definition at line 637 of file TreeSelectorTab.cpp.

◆ SetTreeSelectionCallback()

void TreeSelectorTab::SetTreeSelectionCallback ( TreeSelectionCallback callback)
inline

Definition at line 41 of file TreeSelectorTab.h.

◆ ShowContextMenu()

void TreeSelectorTab::ShowContextMenu ( int itemIndex,
const wxPoint & pos )

Definition at line 679 of file TreeSelectorTab.cpp.

◆ ToggleCollapse()

void TreeSelectorTab::ToggleCollapse ( const std::string & treeId)

Definition at line 584 of file TreeSelectorTab.cpp.

◆ ToggleSectionCollapse()

void TreeSelectorTab::ToggleSectionCollapse ( SectionType section)

Definition at line 606 of file TreeSelectorTab.cpp.

◆ UpdateTreeList()

void TreeSelectorTab::UpdateTreeList ( const std::map< std::string, std::shared_ptr< EmberCore::BehaviorTree > > & trees,
const std::string & currentTreeId )

Definition at line 356 of file TreeSelectorTab.cpp.

◆ wxDECLARE_EVENT_TABLE()

TreeSelectorTab::wxDECLARE_EVENT_TABLE ( )
private

Member Data Documentation

◆ m_collapseAllBtn

wxButton* TreeSelectorTab::m_collapseAllBtn
private

Definition at line 98 of file TreeSelectorTab.h.

◆ m_collapsedTrees

std::set<std::string> TreeSelectorTab::m_collapsedTrees
private

Definition at line 112 of file TreeSelectorTab.h.

◆ m_contextMenuTreeId

std::string TreeSelectorTab::m_contextMenuTreeId
private

Definition at line 116 of file TreeSelectorTab.h.

◆ m_currentTreeId

std::string TreeSelectorTab::m_currentTreeId
private

Definition at line 115 of file TreeSelectorTab.h.

◆ m_expandAllBtn

wxButton* TreeSelectorTab::m_expandAllBtn
private

Definition at line 99 of file TreeSelectorTab.h.

◆ m_flatList

std::vector<FlatEntry> TreeSelectorTab::m_flatList
private

Definition at line 111 of file TreeSelectorTab.h.

◆ m_listBox

TreeListBox* TreeSelectorTab::m_listBox
private

Definition at line 100 of file TreeSelectorTab.h.

◆ m_mainFrame

MainFrame* TreeSelectorTab::m_mainFrame
private

Definition at line 119 of file TreeSelectorTab.h.

◆ m_rootSectionCollapsed

bool TreeSelectorTab::m_rootSectionCollapsed
private

Definition at line 113 of file TreeSelectorTab.h.

◆ m_searchCtrl

wxSearchCtrl* TreeSelectorTab::m_searchCtrl
private

Definition at line 97 of file TreeSelectorTab.h.

◆ m_searchFilter

wxString TreeSelectorTab::m_searchFilter
private

Definition at line 117 of file TreeSelectorTab.h.

◆ m_selectionCallback

TreeSelectionCallback TreeSelectorTab::m_selectionCallback
private

Definition at line 120 of file TreeSelectorTab.h.

◆ m_statusLabel

wxStaticText* TreeSelectorTab::m_statusLabel
private

Definition at line 101 of file TreeSelectorTab.h.

◆ m_subtreesSectionCollapsed

bool TreeSelectorTab::m_subtreesSectionCollapsed
private

Definition at line 114 of file TreeSelectorTab.h.

◆ m_treeInfoMap

std::map<std::string, TreeInfo> TreeSelectorTab::m_treeInfoMap
private

Definition at line 110 of file TreeSelectorTab.h.


The documentation for this class was generated from the following files: