![]() |
Ember
|
Base class for hierarchy tabs operating on ITreeNode. More...
#include <TreeHierarchyTab.h>
Public Types | |
| using | SelectionCallback = std::function<void(EmberCore::ITreeNode *)> |
| using | LayoutInvalidationCallback = std::function<void()> |
Public Member Functions | |
| TreeHierarchyTab (wxWindow *parent, const TreeHierarchyConfig &config={}) | |
| ~TreeHierarchyTab () override=default | |
| wxWindow * | GetWidget () override |
| Returns the wxWidgets window used as the tab content. | |
| wxString | GetTitle () const override |
| Returns the display title of the tab. | |
| wxString | GetTabType () const override |
| Returns the tab type identifier. | |
| void | SetTree (std::shared_ptr< EmberCore::ITreeStructure > tree) |
| Sets the tree structure to display. | |
| void | ClearTree () |
| Clears the tree and removes all items. | |
| void | RefreshTree () |
| Rebuilds the tree from the current structure. | |
| void | ExpandAll () |
| Expands all tree items. | |
| void | CollapseAll () |
| Collapses all tree items. | |
| void | SelectNodeById (size_t nodeId) |
| Selects the tree item with the given node ID. | |
| EmberCore::ITreeNode * | GetSelectedNode () const |
| Returns the currently selected node, or nullptr. | |
| void | SetSelectionCallback (SelectionCallback cb) |
| Sets callback invoked when selection changes. | |
| void | SetLayoutInvalidationCallback (LayoutInvalidationCallback cb) |
| Sets callback invoked when layout needs invalidation (e.g. canvas sync). | |
| const TreeHierarchyConfig & | GetConfig () const |
| Returns the current configuration. | |
| void | ApplyConfig (const TreeHierarchyConfig &config) |
| Applies new configuration and refreshes the tree. | |
| Public Member Functions inherited from ITab | |
| virtual | ~ITab ()=default |
| virtual wxBitmap | GetIcon () const |
| Returns the tab icon bitmap; defaults to null. | |
| virtual void | Initialize () |
| Called once when the tab is first created. | |
| virtual void | Refresh () |
| Refreshes the tab content. | |
| virtual void | OnActivated () |
| Called when the tab becomes active. | |
| virtual void | OnDeactivated () |
| Called when the tab becomes inactive. | |
| virtual void | OnClosed () |
| Called when the tab is closed. | |
| virtual bool | IsValid () const |
| Returns true if the tab is in a valid state. | |
| virtual bool | CanClose () const |
| Returns true if the tab can be closed. | |
| virtual bool | CanMove () const |
| Returns true if the tab can be moved/reordered. | |
| virtual wxString | SerializeState () const |
| Serializes tab state to a string for persistence. | |
| virtual void | DeserializeState (const wxString &state) |
| Restores tab state from a serialized string. | |
| virtual bool | HasUnsavedChanges () const |
| Returns true if the tab has unsaved changes. | |
| virtual bool | Save () |
| Saves the tab content; returns true on success. | |
| virtual bool | SupportsOperation (const wxString &operation) const |
| Returns true if the tab supports the given operation. | |
| virtual bool | ExecuteOperation (const wxString &operation, const wxString ¶meter="") |
| Executes an operation with optional parameter; returns true on success. | |
Protected Member Functions | |
| virtual wxString | GetNodeDisplayText (EmberCore::ITreeNode *node) const |
| Returns display text for a node; subclasses may override. | |
| virtual void | OnPopulateContextMenu (EmberCore::ITreeNode *node, wxMenu &menu) |
| Hook to populate context menu for a node. | |
| virtual void | OnContextMenuCommand (int id, EmberCore::ITreeNode *node) |
| Hook to handle context menu command. | |
| virtual void | OnNodeActivated (EmberCore::ITreeNode *node) |
| Hook called when a node is double-clicked/activated. | |
| virtual void | OnSelectionChanged (EmberCore::ITreeNode *node) |
| Called when selection changes; subclasses may override. | |
| virtual void | OnNodeExpanding (EmberCore::ITreeNode *node) |
| Called when a node is expanding; used for lazy loading. | |
| virtual void | OnNodeCollapsing (EmberCore::ITreeNode *node) |
| Called when a node is collapsing. | |
| wxTreeCtrl * | GetTreeCtrl () const |
| Returns the tree control widget. | |
| wxSearchCtrl * | GetSearchCtrl () const |
| Returns the search control widget. | |
| std::shared_ptr< EmberCore::ITreeStructure > | GetTree () const |
| Returns the current tree structure. | |
| EmberCore::ITreeNode * | GetNodeFromItem (const wxTreeItemId &item) const |
| Extracts ITreeNode from a tree item (or nullptr if DummyTreeItemData). | |
| wxTreeItemId | FindItemById (size_t nodeId, const wxTreeItemId &start=wxTreeItemId()) |
| Finds tree item by node ID, optionally starting from given item. | |
| wxTreeItemId | ExpandPathToNode (EmberCore::ITreeNode *node) |
| Expands path from root to node and returns its item ID. | |
| void | ScrollToItemHorizontally (const wxTreeItemId &item) |
| Scrolls horizontally so the item is visible. | |
| void | SelectRange (const wxTreeItemId &from, const wxTreeItemId &to) |
| Selects a range of items from from to to. | |
Protected Attributes | |
| TreeHierarchyConfig | m_config |
| wxTreeItemId | m_lastSelectedItem |
Private Types | |
| enum | { ID_TREE_CTRL = wxID_HIGHEST + 200 , ID_SEARCH_CTRL } |
Private Member Functions | |
| void | CreateLayout () |
| void | PopulateTree () |
| void | AddFilteredNodes (const wxTreeItemId &parentItem, EmberCore::ITreeNode *node) |
| void | AddChildrenToItem (const wxTreeItemId &parentItem, EmberCore::ITreeNode *node) |
| void | ExpandTreeToDepth (const wxTreeItemId &item, int remainingDepth) |
| void | ExpandTreeByVisibility (const wxTreeItemId &item) |
| void | OnTreeItemExpanding (wxTreeEvent &event) |
| void | OnTreeItemCollapsing (wxTreeEvent &event) |
| void | OnTreeSelectionChanged (wxTreeEvent &event) |
| void | OnTreeItemRightClick (wxTreeEvent &event) |
| void | OnTreeItemActivated (wxTreeEvent &event) |
| void | OnSearchTextChanged (wxCommandEvent &event) |
| void | OnSearchEnter (wxCommandEvent &event) |
| wxDECLARE_EVENT_TABLE () | |
Private Attributes | |
| wxSearchCtrl * | m_searchCtrl = nullptr |
| wxTreeCtrl * | m_treeCtrl = nullptr |
| wxBoxSizer * | m_mainSizer = nullptr |
| std::shared_ptr< EmberCore::ITreeStructure > | m_tree |
| wxString | m_searchFilter |
| SelectionCallback | m_selectionCallback |
| LayoutInvalidationCallback | m_layoutInvalidationCb |
| bool | m_isRefreshing = false |
Base class for hierarchy tabs operating on ITreeNode.
Provides the shared logic for tree display, lazy loading, search, expand/collapse, selection sync, and horizontal auto-scroll. Apps subclass and override virtual hooks for custom behaviour.
Definition at line 48 of file TreeHierarchyTab.h.
| using EmberUI::TreeHierarchyTab::LayoutInvalidationCallback = std::function<void()> |
Definition at line 51 of file TreeHierarchyTab.h.
| using EmberUI::TreeHierarchyTab::SelectionCallback = std::function<void(EmberCore::ITreeNode *)> |
Definition at line 50 of file TreeHierarchyTab.h.
|
private |
| Enumerator | |
|---|---|
| ID_TREE_CTRL | |
| ID_SEARCH_CTRL | |
Definition at line 151 of file TreeHierarchyTab.h.
|
explicit |
|
overridedefault |
|
private |
Definition at line 151 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 130 of file TreeHierarchyTab.cpp.
| void EmberUI::TreeHierarchyTab::ApplyConfig | ( | const TreeHierarchyConfig & | config | ) |
Applies new configuration and refreshes the tree.
Definition at line 58 of file TreeHierarchyTab.cpp.
| void EmberUI::TreeHierarchyTab::ClearTree | ( | ) |
Clears the tree and removes all items.
Definition at line 88 of file TreeHierarchyTab.cpp.
| void EmberUI::TreeHierarchyTab::CollapseAll | ( | ) |
Collapses all tree items.
Definition at line 229 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 25 of file TreeHierarchyTab.cpp.
| void EmberUI::TreeHierarchyTab::ExpandAll | ( | ) |
Expands all tree items.
Definition at line 227 of file TreeHierarchyTab.cpp.
|
protected |
Expands path from root to node and returns its item ID.
Definition at line 323 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 199 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 169 of file TreeHierarchyTab.cpp.
|
protected |
Finds tree item by node ID, optionally starting from given item.
Definition at line 301 of file TreeHierarchyTab.cpp.
|
inline |
Returns the current configuration.
Definition at line 83 of file TreeHierarchyTab.h.
|
protectedvirtual |
Returns display text for a node; subclasses may override.
Reimplemented in Ember::Monitor::MonitorHierarchyView.
Definition at line 264 of file TreeHierarchyTab.cpp.
|
protected |
Extracts ITreeNode from a tree item (or nullptr if DummyTreeItemData).
Definition at line 290 of file TreeHierarchyTab.cpp.
|
inlineprotected |
Returns the search control widget.
Definition at line 106 of file TreeHierarchyTab.h.
| EmberCore::ITreeNode * EmberUI::TreeHierarchyTab::GetSelectedNode | ( | ) | const |
Returns the currently selected node, or nullptr.
Definition at line 233 of file TreeHierarchyTab.cpp.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Returns the display title of the tab.
Implements ITab.
Definition at line 58 of file TreeHierarchyTab.h.
|
inlineprotected |
Returns the current tree structure.
Definition at line 108 of file TreeHierarchyTab.h.
|
inlineprotected |
Returns the tree control widget.
Definition at line 104 of file TreeHierarchyTab.h.
|
inlineoverridevirtual |
Returns the wxWidgets window used as the tab content.
Implements ITab.
Definition at line 57 of file TreeHierarchyTab.h.
|
inlineprotectedvirtual |
Hook to handle context menu command.
Reimplemented in EmberUI::NavigatorHierarchyView.
Definition at line 93 of file TreeHierarchyTab.h.
|
inlineprotectedvirtual |
Hook called when a node is double-clicked/activated.
Reimplemented in EmberUI::NavigatorHierarchyView.
Definition at line 95 of file TreeHierarchyTab.h.
|
protectedvirtual |
Called when a node is collapsing.
Reimplemented in Ember::Monitor::MonitorHierarchyView.
Definition at line 282 of file TreeHierarchyTab.cpp.
|
protectedvirtual |
Called when a node is expanding; used for lazy loading.
Reimplemented in Ember::Monitor::MonitorHierarchyView.
Definition at line 276 of file TreeHierarchyTab.cpp.
|
inlineprotectedvirtual |
Hook to populate context menu for a node.
Reimplemented in EmberUI::NavigatorHierarchyView.
Definition at line 91 of file TreeHierarchyTab.h.
|
private |
Definition at line 542 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 535 of file TreeHierarchyTab.cpp.
|
protectedvirtual |
Called when selection changes; subclasses may override.
Definition at line 270 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 528 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 480 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 451 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 511 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 492 of file TreeHierarchyTab.cpp.
|
private |
Definition at line 101 of file TreeHierarchyTab.cpp.
| void EmberUI::TreeHierarchyTab::RefreshTree | ( | ) |
Rebuilds the tree from the current structure.
Definition at line 94 of file TreeHierarchyTab.cpp.
|
protected |
Scrolls horizontally so the item is visible.
Definition at line 379 of file TreeHierarchyTab.cpp.
| void EmberUI::TreeHierarchyTab::SelectNodeById | ( | size_t | nodeId | ) |
Selects the tree item with the given node ID.
Definition at line 242 of file TreeHierarchyTab.cpp.
|
protected |
Selects a range of items from from to to.
Definition at line 403 of file TreeHierarchyTab.cpp.
|
inline |
Sets callback invoked when layout needs invalidation (e.g. canvas sync).
Definition at line 80 of file TreeHierarchyTab.h.
|
inline |
Sets callback invoked when selection changes.
Definition at line 78 of file TreeHierarchyTab.h.
| void EmberUI::TreeHierarchyTab::SetTree | ( | std::shared_ptr< EmberCore::ITreeStructure > | tree | ) |
Sets the tree structure to display.
Definition at line 79 of file TreeHierarchyTab.cpp.
|
private |
|
protected |
Definition at line 120 of file TreeHierarchyTab.h.
|
private |
Definition at line 149 of file TreeHierarchyTab.h.
|
protected |
Definition at line 121 of file TreeHierarchyTab.h.
|
private |
Definition at line 148 of file TreeHierarchyTab.h.
|
private |
Definition at line 142 of file TreeHierarchyTab.h.
|
private |
Definition at line 140 of file TreeHierarchyTab.h.
|
private |
Definition at line 145 of file TreeHierarchyTab.h.
|
private |
Definition at line 147 of file TreeHierarchyTab.h.
|
private |
Definition at line 144 of file TreeHierarchyTab.h.
|
private |
Definition at line 141 of file TreeHierarchyTab.h.