Ember
Loading...
Searching...
No Matches
MainPanel.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include "Components/Panel.h"
11#include <wx/srchctrl.h>
12#include <wx/wx.h>
13
14namespace Ember {
15namespace Monitor {
16
20 public:
21 explicit MainPanel(wxWindow *parent);
22 ~MainPanel() override = default;
23
25 void SetTree(std::shared_ptr<Ember::Network::TCPTreeAdapter> adapter,
26 std::shared_ptr<Network::StateManager> stateManager);
28 void ClearTree();
29
32
33 // IStatusProvider
35 int GetNodeStatus(int64_t nodeId) const override;
37 bool IsNodeInExecutionPath(int64_t nodeId) const override;
39 void GetExecutionPathIds(std::set<int64_t> &outIds) const override;
40
41 using NodeSelectionCallback = std::function<void(EmberCore::ITreeNode *)>;
44
45 private:
46 void CreateLayout() override;
47 void OnSearchText(wxCommandEvent &event);
48 void OnSearchEnter(wxCommandEvent &event);
49 void OnSearchCancel(wxCommandEvent &event);
50 void NavigateToResult(size_t index);
51 void CollectSearchResults(const wxString &query);
52
54 wxSearchCtrl *m_searchCtrl = nullptr;
55 wxStaticText *m_searchStatus = nullptr;
56
57 std::vector<EmberCore::ITreeNode *> m_searchResults;
58 size_t m_searchIndex = 0;
59
60 std::shared_ptr<Ember::Network::TCPTreeAdapter> m_adapter;
61 std::shared_ptr<Network::StateManager> m_stateManager;
62};
63
64} // namespace Monitor
65} // namespace Ember
Abstract interface for tree nodes that can be visualized.
Definition ITreeNode.h:31
Interface for querying node status and execution path.
Base class for all panels with layout, theme, and state management.
Definition Panel.h:11
void OnSearchText(wxCommandEvent &event)
Definition MainPanel.cpp:40
bool IsNodeInExecutionPath(int64_t nodeId) const override
Returns true if the node is in the current execution path.
void NavigateToResult(size_t index)
Definition MainPanel.cpp:72
void ClearTree()
Clears the displayed tree.
MonitorTreeCanvas * GetTreeCanvas() const
Returns the tree canvas widget.
Definition MainPanel.h:31
std::shared_ptr< Ember::Network::TCPTreeAdapter > m_adapter
Definition MainPanel.h:60
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)
Definition MainPanel.cpp:93
void OnSearchEnter(wxCommandEvent &event)
Definition MainPanel.cpp:57
std::shared_ptr< Network::StateManager > m_stateManager
Definition MainPanel.h:61
MainPanel(wxWindow *parent)
Definition MainPanel.cpp:6
std::function< void(EmberCore::ITreeNode *)> NodeSelectionCallback
Definition MainPanel.h:41
wxStaticText * m_searchStatus
Definition MainPanel.h:55
void CreateLayout() override
Hook: creates the panel layout. Override to customize.
Definition MainPanel.cpp:8
int GetNodeStatus(int64_t nodeId) const override
Returns the status code for the given node.
std::vector< EmberCore::ITreeNode * > m_searchResults
Definition MainPanel.h:57
MonitorTreeCanvas * m_treeCanvas
Definition MainPanel.h:53
wxSearchCtrl * m_searchCtrl
Definition MainPanel.h:54
~MainPanel() override=default
void OnSearchCancel(wxCommandEvent &event)
Definition MainPanel.cpp:64
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.