![]() |
Ember
|
Custom widget for rendering and interacting with complete behavior trees. More...
#include <TreeWidget.h>
Public Types | |
| enum class | LayoutAlgorithm { Vertical , Horizontal , Radial , Compact , Manual } |
| Tree layout algorithms. More... | |
| enum class | InteractionMode { View , Select , Edit , Connect , Debug } |
| Tree interaction modes. More... | |
| using | NodeSelectionCallback = std::function<void(const std::vector<EmberCore::Node *> &)> |
| using | NodeEditCallback = std::function<void(EmberCore::Node *, const wxString &property, const wxString &value)> |
| using | TreeChangeCallback = std::function<void(const wxString &change_type)> |
Protected Member Functions | |
| virtual void | OnPaint (wxPaintEvent &event) |
| virtual void | OnSize (wxSizeEvent &event) |
| virtual void | OnEraseBackground (wxEraseEvent &event) |
| virtual void | OnMouseDown (wxMouseEvent &event) |
| virtual void | OnMouseUp (wxMouseEvent &event) |
| virtual void | OnMouseMove (wxMouseEvent &event) |
| virtual void | OnMouseWheel (wxMouseEvent &event) |
| virtual void | OnRightClick (wxContextMenuEvent &event) |
| virtual void | OnKeyDown (wxKeyEvent &event) |
| virtual void | OnChar (wxKeyEvent &event) |
| void | CalculateVerticalLayout () |
| void | CalculateHorizontalLayout () |
| void | CalculateRadialLayout () |
| void | CalculateCompactLayout () |
| void | UpdateScrollbars () |
| void | LayoutNodeVertical (EmberCore::Node *node, int x, int y, int level) |
| void | DrawBackground (wxDC &dc) |
| void | DrawGrid (wxDC &dc) |
| void | DrawConnections (wxDC &dc) |
| void | DrawConnection (wxDC &dc, EmberForge::NodeWidget *parent, EmberForge::NodeWidget *child) |
| void | DrawSelectionRect (wxDC &dc) |
| void | CreateNodeWidgets () |
| void | UpdateNodeWidgets () |
| void | DestroyNodeWidgets () |
| std::unique_ptr< EmberForge::NodeWidget > | CreateNodeWidget (EmberCore::Node *node) |
| EmberForge::NodeWidget * | HitTestNode (const wxPoint &point) const |
| EmberCore::Node * | HitTestConnection (const wxPoint &point) const |
| void | UpdateSelectionVisuals () |
| void | NotifySelectionChange () |
| wxSize | CalculateTreeSize () const |
| wxPoint | CalculateNodePosition (EmberCore::Node *node) const |
| void | PositionNodeWidgets () |
| wxPoint | TreeToScreen (const wxPoint &tree_point) const |
| wxPoint | ScreenToTree (const wxPoint &screen_point) const |
| wxRect | TreeToScreen (const wxRect &tree_rect) const |
| wxRect | ScreenToTree (const wxRect &screen_rect) const |
Private Member Functions | |
| void | InitializeWidget () |
| void | SetupEventHandlers () |
| void | UpdateViewSize () |
| void | ShowContextMenu (const wxPoint &position) |
| void | OnNodeClicked (EmberForge::NodeWidget *widget, EmberCore::Node *node) |
| void | OnNodeDoubleClicked (EmberForge::NodeWidget *widget, EmberCore::Node *node) |
| void | OnNodeDragged (EmberForge::NodeWidget *widget, const wxPoint &delta) |
| void | OnNodeEdited (EmberForge::NodeWidget *widget, const wxString &new_name) |
Static Private Attributes | |
| static constexpr double | MIN_ZOOM = 0.1 |
| static constexpr double | MAX_ZOOM = 5.0 |
| static const int | DEFAULT_NODE_SPACING_X = 120 |
| static const int | DEFAULT_NODE_SPACING_Y = 80 |
| static const int | DEFAULT_LEVEL_SPACING = 100 |
| static const int | GRID_SIZE = 20 |
Custom widget for rendering and interacting with complete behavior trees.
This widget provides a visual representation of an entire behavior tree with support for navigation, editing, layout management, and tree manipulation.
Definition at line 19 of file TreeWidget.h.
| using EmberForge::TreeWidget::NodeEditCallback = std::function<void(EmberCore::Node *, const wxString &property, const wxString &value)> |
Definition at line 125 of file TreeWidget.h.
| using EmberForge::TreeWidget::NodeSelectionCallback = std::function<void(const std::vector<EmberCore::Node *> &)> |
Definition at line 124 of file TreeWidget.h.
| using EmberForge::TreeWidget::TreeChangeCallback = std::function<void(const wxString &change_type)> |
Definition at line 126 of file TreeWidget.h.
|
strong |
Tree interaction modes.
| Enumerator | |
|---|---|
| View | |
| Select | |
| Edit | |
| Connect | |
| Debug | |
Definition at line 35 of file TreeWidget.h.
|
strong |
Tree layout algorithms.
| Enumerator | |
|---|---|
| Vertical | |
| Horizontal | |
| Radial | |
| Compact | |
| Manual | |
Definition at line 24 of file TreeWidget.h.
| EmberForge::TreeWidget::TreeWidget | ( | wxWindow * | parent, |
| std::shared_ptr< EmberCore::BehaviorTree > | tree = nullptr ) |
Constructor.
| parent | Parent window |
| tree | The behavior tree to display |
|
virtual |
Destructor.
Definition at line 40 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::AddNode | ( | std::unique_ptr< EmberCore::Node > | node, |
| EmberCore::Node * | parent ) |
Definition at line 323 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::AnimateToNode | ( | EmberCore::Node * | node | ) |
Definition at line 434 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::AutoFitLayout | ( | ) |
Definition at line 97 of file TreeWidget.cpp.
|
protected |
Definition at line 662 of file TreeWidget.cpp.
|
protected |
Definition at line 652 of file TreeWidget.cpp.
|
protected |
Definition at line 841 of file TreeWidget.cpp.
|
protected |
Definition at line 657 of file TreeWidget.cpp.
|
protected |
Definition at line 839 of file TreeWidget.cpp.
|
protected |
Definition at line 641 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::CanAddNode | ( | EmberCore::Node * | parent | ) | const |
Definition at line 319 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::CanMoveNode | ( | EmberCore::Node * | node, |
| EmberCore::Node * | new_parent ) const |
Definition at line 379 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::CenterOnNode | ( | EmberCore::Node * | node | ) |
Definition at line 292 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::CenterOnSelection | ( | ) |
Definition at line 304 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::CenterView | ( | ) |
Definition at line 310 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::ClearHighlights | ( | ) |
Definition at line 451 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::ClearSelection | ( | ) |
Definition at line 198 of file TreeWidget.cpp.
|
protected |
Definition at line 789 of file TreeWidget.cpp.
|
protected |
Definition at line 768 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::DeselectNode | ( | EmberCore::Node * | node | ) |
Definition at line 189 of file TreeWidget.cpp.
|
protected |
Definition at line 787 of file TreeWidget.cpp.
|
protected |
Definition at line 690 of file TreeWidget.cpp.
|
protected |
Definition at line 746 of file TreeWidget.cpp.
|
protected |
Definition at line 726 of file TreeWidget.cpp.
|
protected |
Definition at line 697 of file TreeWidget.cpp.
|
protected |
Definition at line 759 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::DuplicateSelectedNodes | ( | ) |
Definition at line 374 of file TreeWidget.cpp.
| wxBitmap EmberForge::TreeWidget::ExportAsImage | ( | const wxSize & | size = wxDefaultSize | ) | const |
Definition at line 471 of file TreeWidget.cpp.
| std::vector< NodeWidget * > EmberForge::TreeWidget::GetAllNodeWidgets | ( | ) | const |
Definition at line 154 of file TreeWidget.cpp.
|
inline |
Definition at line 57 of file TreeWidget.h.
|
inline |
Definition at line 67 of file TreeWidget.h.
|
inline |
Definition at line 61 of file TreeWidget.h.
| EmberForge::NodeWidget * EmberForge::TreeWidget::GetNodeWidget | ( | EmberCore::Node * | node | ) | const |
Definition at line 146 of file TreeWidget.cpp.
| EmberCore::Node * EmberForge::TreeWidget::GetSelectedNode | ( | ) | const |
Definition at line 219 of file TreeWidget.cpp.
| std::vector< EmberCore::Node * > EmberForge::TreeWidget::GetSelectedNodes | ( | ) | const |
Definition at line 221 of file TreeWidget.cpp.
| std::vector< EmberForge::NodeWidget * > EmberForge::TreeWidget::GetSelectedNodeWidgets | ( | ) | const |
Definition at line 162 of file TreeWidget.cpp.
|
inline |
Definition at line 89 of file TreeWidget.h.
|
inline |
Definition at line 58 of file TreeWidget.h.
| void EmberForge::TreeWidget::HighlightExecutionPath | ( | const std::vector< EmberCore::Node * > & | path | ) |
Definition at line 439 of file TreeWidget.cpp.
|
protected |
Definition at line 818 of file TreeWidget.cpp.
|
protected |
Definition at line 809 of file TreeWidget.cpp.
|
private |
Definition at line 906 of file TreeWidget.cpp.
|
protected |
Definition at line 668 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::LoadLayout | ( | const wxString & | filename | ) |
Definition at line 466 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::LoadPreferences | ( | ) |
Definition at line 962 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::MoveNode | ( | EmberCore::Node * | node, |
| EmberCore::Node * | new_parent ) |
Definition at line 383 of file TreeWidget.cpp.
|
protected |
Definition at line 832 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 638 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 513 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 621 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 518 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 575 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 549 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 584 of file TreeWidget.cpp.
|
private |
Definition at line 937 of file TreeWidget.cpp.
|
private |
Definition at line 941 of file TreeWidget.cpp.
|
private |
Definition at line 947 of file TreeWidget.cpp.
|
private |
Definition at line 955 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 486 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 619 of file TreeWidget.cpp.
|
protectedvirtual |
Definition at line 508 of file TreeWidget.cpp.
|
protected |
Definition at line 849 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::RefreshLayout | ( | ) |
Definition at line 69 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::RemoveSelectedNodes | ( | ) |
Definition at line 348 of file TreeWidget.cpp.
| bool EmberForge::TreeWidget::SaveLayout | ( | const wxString & | filename | ) | const |
Definition at line 461 of file TreeWidget.cpp.
|
protected |
Definition at line 886 of file TreeWidget.cpp.
|
protected |
Definition at line 899 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SelectAll | ( | ) |
Definition at line 206 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SelectNode | ( | EmberCore::Node * | node, |
| bool | add_to_selection = false ) |
Definition at line 173 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetBackgroundColor | ( | const wxColour & | color | ) |
Definition at line 419 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetBehaviorTree | ( | std::shared_ptr< EmberCore::BehaviorTree > | tree | ) |
Definition at line 48 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetConnectionStyle | ( | int | line_width, |
| const wxColour & | color ) |
Definition at line 413 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetConnectionsVisible | ( | bool | visible | ) |
Definition at line 429 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetGridVisible | ( | bool | visible | ) |
Definition at line 424 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetInteractionMode | ( | InteractionMode | mode | ) |
Definition at line 129 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetLayoutAlgorithm | ( | LayoutAlgorithm | algorithm | ) |
Definition at line 62 of file TreeWidget.cpp.
|
inline |
Definition at line 129 of file TreeWidget.h.
| void EmberForge::TreeWidget::SetNodeRenderStyle | ( | EmberForge::NodeWidget::RenderStyle | style | ) |
Definition at line 401 of file TreeWidget.cpp.
|
inline |
Definition at line 128 of file TreeWidget.h.
|
inline |
Definition at line 130 of file TreeWidget.h.
|
private |
Definition at line 913 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::SetZoomLevel | ( | double | zoom | ) |
Definition at line 283 of file TreeWidget.cpp.
|
private |
Definition at line 919 of file TreeWidget.cpp.
|
protected |
Definition at line 879 of file TreeWidget.cpp.
|
protected |
Definition at line 893 of file TreeWidget.cpp.
|
protected |
Definition at line 781 of file TreeWidget.cpp.
|
protected |
Definition at line 868 of file TreeWidget.cpp.
|
protected |
Definition at line 824 of file TreeWidget.cpp.
|
private |
Definition at line 917 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::ZoomIn | ( | ) |
Definition at line 223 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::ZoomOut | ( | ) |
Definition at line 225 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::ZoomToFit | ( | ) |
Definition at line 227 of file TreeWidget.cpp.
| void EmberForge::TreeWidget::ZoomToSelection | ( | ) |
Definition at line 246 of file TreeWidget.cpp.
|
private |
Definition at line 234 of file TreeWidget.h.
|
private |
Definition at line 212 of file TreeWidget.h.
|
private |
Definition at line 191 of file TreeWidget.h.
|
private |
Definition at line 214 of file TreeWidget.h.
|
private |
Definition at line 215 of file TreeWidget.h.
|
private |
Definition at line 217 of file TreeWidget.h.
|
staticprivate |
Definition at line 259 of file TreeWidget.h.
|
staticprivate |
Definition at line 257 of file TreeWidget.h.
|
staticprivate |
Definition at line 258 of file TreeWidget.h.
|
private |
Definition at line 222 of file TreeWidget.h.
|
private |
Definition at line 239 of file TreeWidget.h.
|
private |
Definition at line 213 of file TreeWidget.h.
|
staticprivate |
Definition at line 260 of file TreeWidget.h.
|
private |
Definition at line 216 of file TreeWidget.h.
|
private |
Definition at line 235 of file TreeWidget.h.
|
private |
Definition at line 193 of file TreeWidget.h.
|
private |
Definition at line 220 of file TreeWidget.h.
|
private |
Definition at line 221 of file TreeWidget.h.
|
private |
Definition at line 192 of file TreeWidget.h.
|
private |
Definition at line 229 of file TreeWidget.h.
|
staticconstexprprivate |
Definition at line 256 of file TreeWidget.h.
|
staticconstexprprivate |
Definition at line 255 of file TreeWidget.h.
|
private |
Definition at line 207 of file TreeWidget.h.
|
private |
Definition at line 231 of file TreeWidget.h.
|
private |
Definition at line 203 of file TreeWidget.h.
|
private |
Definition at line 227 of file TreeWidget.h.
|
private |
Definition at line 228 of file TreeWidget.h.
|
private |
Definition at line 196 of file TreeWidget.h.
|
private |
Definition at line 208 of file TreeWidget.h.
|
private |
Definition at line 197 of file TreeWidget.h.
|
private |
Definition at line 238 of file TreeWidget.h.
|
private |
Definition at line 224 of file TreeWidget.h.
|
private |
Definition at line 223 of file TreeWidget.h.
|
private |
Definition at line 240 of file TreeWidget.h.
|
private |
Definition at line 230 of file TreeWidget.h.
|
private |
Definition at line 202 of file TreeWidget.h.
|
private |
Definition at line 201 of file TreeWidget.h.
|
private |
Definition at line 209 of file TreeWidget.h.
|
private |
Definition at line 200 of file TreeWidget.h.
|
private |
Definition at line 206 of file TreeWidget.h.