7#include <wx/textctrl.h>
28 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_NONE), node_(node),
29 render_style_(style), interaction_state_(InteractionState::Normal), custom_size_(wxDefaultSize),
30 is_draggable_(true), is_highlighted_(false), animation_timer_(
nullptr), animation_phase_(0.0),
31 is_animating_(false), edit_control_(
nullptr) {
80 if (save_changes &&
node_) {
102 if (GetSize() != preferredSize) {
103 SetSize(preferredSize);
118 if (!text.IsEmpty()) {
121 wxSize textSize = dc.GetTextExtent(text);
124 size.y = std::max(size.y, textSize.y + 2 *
PADDING);
192 wxRect clientRect = GetClientRect();
251 if (event.LeftDown()) {
282 wxPoint currentPos =
event.GetPosition();
311 int keyCode =
event.GetKeyCode();
355 bgColor = wxColour(bgColor.Red(), bgColor.Green(), bgColor.Blue(), alpha);
358 dc.SetBrush(wxBrush(bgColor));
359 dc.SetPen(wxPen(bgColor));
360 dc.DrawRoundedRectangle(rect, 4);
366 dc.SetBrush(wxNullBrush);
368 dc.DrawRoundedRectangle(rect, 4);
374 dc.DrawBitmap(icon, icon_rect.GetTopLeft());
380 if (!text.IsEmpty()) {
383 dc.DrawLabel(text, text_rect, wxALIGN_CENTER);
393 wxColour statusColor;
397 statusColor = wxColour(0, 255, 0);
400 statusColor = wxColour(255, 0, 0);
403 statusColor = wxColour(255, 255, 0);
406 statusColor = wxColour(128, 128, 128);
410 dc.SetBrush(wxBrush(statusColor));
411 dc.SetPen(wxPen(statusColor));
412 wxPoint center(status_rect.x + status_rect.width / 2, status_rect.y + status_rect.height / 2);
413 dc.DrawCircle(center, 4);
419 dc.SetBrush(wxBrush(wxColour(0, 0, 255)));
420 dc.SetPen(wxPen(wxColour(0, 0, 255)));
422 for (
const wxPoint &point : points) {
423 dc.DrawCircle(point, 3);
429 wxRect rect = GetClientRect();
451 return wxRect(iconRect.GetRight() +
PADDING, contentRect.y, contentRect.width - iconRect.width -
PADDING,
461 return wxRect(contentRect.GetRight() - 10, contentRect.y, 10, 10);
465 std::vector<wxPoint> points;
466 wxRect rect = GetClientRect();
469 points.push_back(wxPoint(rect.width / 2, 0));
471 points.push_back(wxPoint(rect.width / 2, rect.height));
473 points.push_back(wxPoint(0, rect.height / 2));
475 points.push_back(wxPoint(rect.width, rect.height / 2));
484 return wxColour(240, 240, 255);
486 return wxColour(200, 200, 255);
488 return wxColour(255, 255, 200);
490 return wxColour(255, 240, 240);
492 return wxColour(255, 255, 255);
498 return wxColour(255, 165, 0);
507 return wxColour(mainPanelSettings.selectedNodeColor.r, mainPanelSettings.selectedNodeColor.g,
508 mainPanelSettings.selectedNodeColor.b);
510 return wxColour(mainPanelSettings.hoveredNodeColor.r, mainPanelSettings.hoveredNodeColor.g,
511 mainPanelSettings.hoveredNodeColor.b);
513 return wxColour(255, 165, 0);
515 return wxColour(128, 128, 128);
526 return wxColour(mainPanelSettings.selectedNodeTextColor.r, mainPanelSettings.selectedNodeTextColor.g,
527 mainPanelSettings.selectedNodeTextColor.b);
529 return wxColour(mainPanelSettings.hoveredNodeTextColor.r, mainPanelSettings.hoveredNodeTextColor.g,
530 mainPanelSettings.hoveredNodeTextColor.b);
532 return wxColour(0, 0, 0);
544 return "No EmberCore::Node";
547 return node_->GetName();
572 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
587 new wxTextCtrl(
this, wxID_ANY,
original_name_, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
596 edit_control_->Bind(wxEVT_KILL_FOCUS, [
this](wxFocusEvent &event) {
612 menu.Append(wxID_ANY,
"Edit",
"Edit node name");
613 menu.Append(wxID_ANY,
"Delete",
"Delete this node");
614 menu.AppendSeparator();
615 menu.Append(wxID_ANY,
"Properties",
"Show node properties");
617 PopupMenu(&menu, position);
BehaviorTreeProjectDialog::OnProjectNameChanged BehaviorTreeProjectDialog::OnRemoveFiles wxEND_EVENT_TABLE() BehaviorTreeProjectDialog
Represents a node in a behavior tree structure.
Status
Node status for runtime execution tracking.
AppPreferences & GetPreferences()
static AppPreferencesManager & GetInstance()
MainPanelSettings & GetMainPanelSettings()
Main types header for EmberCore.
wxBEGIN_EVENT_TABLE(LogTab, wxPanel) EVT_CHOICE(ID_LEVEL_FILTER
PerformancePanel::OnUpdateTimer EVT_PAINT(PerformancePanel::OnPaint) EVT_SIZE(PerformancePanel