Ember
Loading...
Searching...
No Matches
EmberUI::NavigatorHierarchyView Class Reference

TreeHierarchyTab subclass with context menu and node activation hooks. More...

#include <NavigatorTab.h>

Inheritance diagram for EmberUI::NavigatorHierarchyView:
EmberUI::TreeHierarchyTab ITab Ember::Monitor::MonitorHierarchyView

Public Types

using ContextMenuPopulator = std::function<void(EmberCore::ITreeNode *, wxMenu &)>
using ContextMenuHandler = std::function<void(int, EmberCore::ITreeNode *)>
using NodeActivatedHandler = std::function<void(EmberCore::ITreeNode *)>
Public Types inherited from EmberUI::TreeHierarchyTab
using SelectionCallback = std::function<void(EmberCore::ITreeNode *)>
using LayoutInvalidationCallback = std::function<void()>

Public Member Functions

 NavigatorHierarchyView (wxWindow *parent, const EmberUI::TreeHierarchyConfig &config)
void SetContextMenuPopulator (ContextMenuPopulator cb)
 Sets callback to populate context menu for a node.
void SetContextMenuHandler (ContextMenuHandler cb)
 Sets callback to handle context menu command.
void SetNodeActivatedHandler (NodeActivatedHandler cb)
 Sets callback invoked when a node is activated (double-click).
Public Member Functions inherited from EmberUI::TreeHierarchyTab
 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::ITreeNodeGetSelectedNode () 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 TreeHierarchyConfigGetConfig () 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 &parameter="")
 Executes an operation with optional parameter; returns true on success.

Protected Member Functions

void OnPopulateContextMenu (EmberCore::ITreeNode *node, wxMenu &menu) override
 Hook to populate context menu for a node.
void OnContextMenuCommand (int id, EmberCore::ITreeNode *node) override
 Hook to handle context menu command.
void OnNodeActivated (EmberCore::ITreeNode *node) override
 Hook called when a node is double-clicked/activated.
Protected Member Functions inherited from EmberUI::TreeHierarchyTab
virtual wxString GetNodeDisplayText (EmberCore::ITreeNode *node) const
 Returns display text for a node; subclasses may override.
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::ITreeStructureGetTree () const
 Returns the current tree structure.
EmberCore::ITreeNodeGetNodeFromItem (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.

Private Attributes

ContextMenuPopulator m_contextPopulator
ContextMenuHandler m_contextHandler
NodeActivatedHandler m_activatedHandler

Additional Inherited Members

Protected Attributes inherited from EmberUI::TreeHierarchyTab
TreeHierarchyConfig m_config
wxTreeItemId m_lastSelectedItem

Detailed Description

TreeHierarchyTab subclass with context menu and node activation hooks.

Definition at line 37 of file NavigatorTab.h.

Member Typedef Documentation

◆ ContextMenuHandler

Definition at line 40 of file NavigatorTab.h.

◆ ContextMenuPopulator

Definition at line 39 of file NavigatorTab.h.

◆ NodeActivatedHandler

Definition at line 41 of file NavigatorTab.h.

Constructor & Destructor Documentation

◆ NavigatorHierarchyView()

EmberUI::NavigatorHierarchyView::NavigatorHierarchyView ( wxWindow * parent,
const EmberUI::TreeHierarchyConfig & config )

Definition at line 23 of file NavigatorTab.cpp.

Member Function Documentation

◆ OnContextMenuCommand()

void EmberUI::NavigatorHierarchyView::OnContextMenuCommand ( int id,
EmberCore::ITreeNode * node )
overrideprotectedvirtual

Hook to handle context menu command.

Reimplemented from EmberUI::TreeHierarchyTab.

Definition at line 31 of file NavigatorTab.cpp.

◆ OnNodeActivated()

void EmberUI::NavigatorHierarchyView::OnNodeActivated ( EmberCore::ITreeNode * node)
overrideprotectedvirtual

Hook called when a node is double-clicked/activated.

Reimplemented from EmberUI::TreeHierarchyTab.

Definition at line 36 of file NavigatorTab.cpp.

◆ OnPopulateContextMenu()

void EmberUI::NavigatorHierarchyView::OnPopulateContextMenu ( EmberCore::ITreeNode * node,
wxMenu & menu )
overrideprotectedvirtual

Hook to populate context menu for a node.

Reimplemented from EmberUI::TreeHierarchyTab.

Definition at line 26 of file NavigatorTab.cpp.

◆ SetContextMenuHandler()

void EmberUI::NavigatorHierarchyView::SetContextMenuHandler ( ContextMenuHandler cb)
inline

Sets callback to handle context menu command.

Definition at line 48 of file NavigatorTab.h.

◆ SetContextMenuPopulator()

void EmberUI::NavigatorHierarchyView::SetContextMenuPopulator ( ContextMenuPopulator cb)
inline

Sets callback to populate context menu for a node.

Definition at line 46 of file NavigatorTab.h.

◆ SetNodeActivatedHandler()

void EmberUI::NavigatorHierarchyView::SetNodeActivatedHandler ( NodeActivatedHandler cb)
inline

Sets callback invoked when a node is activated (double-click).

Definition at line 50 of file NavigatorTab.h.

Member Data Documentation

◆ m_activatedHandler

NodeActivatedHandler EmberUI::NavigatorHierarchyView::m_activatedHandler
private

Definition at line 60 of file NavigatorTab.h.

◆ m_contextHandler

ContextMenuHandler EmberUI::NavigatorHierarchyView::m_contextHandler
private

Definition at line 59 of file NavigatorTab.h.

◆ m_contextPopulator

ContextMenuPopulator EmberUI::NavigatorHierarchyView::m_contextPopulator
private

Definition at line 58 of file NavigatorTab.h.


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