EntityIdNodePropertyDisplay.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. class QEvent;
  10. #include <AzCore/Component/EntityBus.h>
  11. #include <AzToolsFramework/UI/PropertyEditor/PropertyEntityIdCtrl.hxx>
  12. #include <GraphCanvas/Components/NodePropertyDisplay/NodePropertyDisplay.h>
  13. #include <GraphCanvas/Components/NodePropertyDisplay/EntityIdDataInterface.h>
  14. #include <GraphCanvas/Components/MimeDataHandlerBus.h>
  15. namespace GraphCanvas
  16. {
  17. class GraphCanvasLabel;
  18. class EntityIdNodePropertyDisplay
  19. : public NodePropertyDisplay
  20. , public AZ::EntityBus::Handler
  21. {
  22. friend class EntityIdGraphicsEventFilter;
  23. public:
  24. AZ_CLASS_ALLOCATOR(EntityIdNodePropertyDisplay, AZ::SystemAllocator);
  25. EntityIdNodePropertyDisplay(EntityIdDataInterface* dataInterface);
  26. virtual ~EntityIdNodePropertyDisplay();
  27. // NodePropertyDisplay
  28. void RefreshStyle() override;
  29. void UpdateDisplay() override;
  30. QGraphicsLayoutItem* GetDisabledGraphicsLayoutItem() override;
  31. QGraphicsLayoutItem* GetDisplayGraphicsLayoutItem() override;
  32. QGraphicsLayoutItem* GetEditableGraphicsLayoutItem() override;
  33. ////
  34. // AZ::EntityBus
  35. void OnEntityNameChanged(const AZStd::string& name) override;
  36. ////
  37. // DataSlotNotifications
  38. void OnDragDropStateStateChanged(const DragDropState& dragState) override;
  39. ////
  40. protected:
  41. void ShowContextMenu(const QPoint&);
  42. private:
  43. void EditStart();
  44. void EditFinished();
  45. void SubmitValue();
  46. void SetupProxyWidget();
  47. void CleanupProxyWidget();
  48. EntityIdDataInterface* m_dataInterface;
  49. GraphCanvasLabel* m_disabledLabel;
  50. AzToolsFramework::PropertyEntityIdCtrl* m_propertyEntityIdCtrl;
  51. QGraphicsProxyWidget* m_proxyWidget;
  52. GraphCanvasLabel* m_displayLabel;
  53. };
  54. }