NodeGroupLayoutComponent.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #include <AzCore/Component/Component.h>
  10. #include <QGraphicsLinearLayout>
  11. #include <Components/Nodes/NodeLayoutComponent.h>
  12. #include <GraphCanvas/Components/Nodes/NodeLayoutBus.h>
  13. #include <GraphCanvas/Components/Nodes/NodeTitleBus.h>
  14. #include <GraphCanvas/Components/StyleBus.h>
  15. #include <GraphCanvas/Styling/StyleHelper.h>
  16. class QGraphicsGridLayout;
  17. namespace GraphCanvas
  18. {
  19. //! Lays out the parts of the Node Group node
  20. class NodeGroupLayoutComponent
  21. : public NodeLayoutComponent
  22. , protected NodeNotificationBus::Handler
  23. , protected StyleNotificationBus::Handler
  24. {
  25. public:
  26. AZ_COMPONENT(NodeGroupLayoutComponent, "{0DD4204A-8A75-48C1-AA91-9878BCB0C4D0}", NodeLayoutComponent);
  27. static void Reflect(AZ::ReflectContext*);
  28. static AZ::Entity* CreateNodeGroupEntity();
  29. NodeGroupLayoutComponent();
  30. ~NodeGroupLayoutComponent() override;
  31. // AZ::Component
  32. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
  33. {
  34. dependent.push_back(AZ_CRC_CE("GraphCanvas_NodeLayoutSupportService"));
  35. dependent.push_back(AZ_CRC_CE("GraphCanvas_CommentTextService"));
  36. }
  37. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  38. {
  39. required.push_back(AZ_CRC_CE("GraphCanvas_NodeService"));
  40. required.push_back(AZ_CRC_CE("GraphCanvas_StyledGraphicItemService"));
  41. }
  42. ////
  43. protected:
  44. // StyleNotificationBus::Handler
  45. void OnStyleChanged() override;
  46. ////
  47. // AZ::Component
  48. void Init() override;
  49. void Activate() override;
  50. void Deactivate() override;
  51. ////
  52. // NodeNotification
  53. void OnNodeActivated() override;
  54. ////
  55. void UpdateLayoutParameters();
  56. Styling::StyleHelper m_style;
  57. QGraphicsLinearLayout* m_comment;
  58. };
  59. }