1#include "Panels/MainPanel.h"
9 wxBoxSizer *sizer =
new wxBoxSizer(wxVERTICAL);
11 wxPanel *searchBar =
new wxPanel(
this, wxID_ANY);
12 searchBar->SetBackgroundColour(wxColour(45, 45, 45));
13 wxBoxSizer *searchSizer =
new wxBoxSizer(wxHORIZONTAL);
15 m_searchCtrl =
new wxSearchCtrl(searchBar, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, -1));
16 m_searchCtrl->SetDescriptiveText(
"Search nodes... (Ctrl+F)");
22 searchSizer->Add(
m_searchCtrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3);
23 searchSizer->Add(
m_searchStatus, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
24 searchBar->SetSizer(searchSizer);
26 sizer->Add(searchBar, 0, wxEXPAND);
42 if (query.IsEmpty()) {
96 if (!tree || !tree->HasRootNode())
99 wxString lowerQuery = query.Lower();
101 wxString name = node->
GetName();
102 if (name.Lower().Contains(lowerQuery)) {
109 std::shared_ptr<Network::StateManager> stateManager) {
143 for (
auto id : path) {
155 outIds.insert(path.begin(), path.end());
Abstract interface for tree nodes that can be visualized.
virtual ITreeNode * GetParent() const =0
virtual bool AreChildrenVisible() const =0
virtual void SetChildrenVisible(bool visible)=0
virtual const String & GetName() const =0
Panel(wxWindow *parent, const wxString &name="Panel", long style=wxTAB_TRAVERSAL)
Constructs the panel with optional name and style.
void OnSearchText(wxCommandEvent &event)
bool IsNodeInExecutionPath(int64_t nodeId) const override
Returns true if the node is in the current execution path.
void NavigateToResult(size_t index)
void ClearTree()
Clears the displayed tree.
std::shared_ptr< Ember::Network::TCPTreeAdapter > m_adapter
void GetExecutionPathIds(std::set< int64_t > &outIds) const override
Fills outIds with node IDs in the execution path.
void SetTree(std::shared_ptr< Ember::Network::TCPTreeAdapter > adapter, std::shared_ptr< Network::StateManager > stateManager)
Loads the tree from the given adapter and state manager.
void CollectSearchResults(const wxString &query)
void OnSearchEnter(wxCommandEvent &event)
std::shared_ptr< Network::StateManager > m_stateManager
MainPanel(wxWindow *parent)
std::function< void(EmberCore::ITreeNode *)> NodeSelectionCallback
wxStaticText * m_searchStatus
void CreateLayout() override
Hook: creates the panel layout. Override to customize.
int GetNodeStatus(int64_t nodeId) const override
Returns the status code for the given node.
std::vector< EmberCore::ITreeNode * > m_searchResults
MonitorTreeCanvas * m_treeCanvas
wxSearchCtrl * m_searchCtrl
void OnSearchCancel(wxCommandEvent &event)
void SetNodeSelectionCallback(NodeSelectionCallback callback)
Registers a callback invoked when a node is selected in the tree.
Tree canvas with status-aware coloring and a connection info overlay.