CommentNodeLayoutComponent.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <QGraphicsLinearLayout>
  10. #include <AzCore/Component/Component.h>
  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 comment node
  20. class CommentNodeLayoutComponent
  21. : public NodeLayoutComponent
  22. , public NodeNotificationBus::Handler
  23. , public StyleNotificationBus::Handler
  24. , public AZ::EntityBus::Handler
  25. {
  26. public:
  27. AZ_COMPONENT(CommentNodeLayoutComponent, "{6926658C-372A-43D5-8758-FB67DDE3D857}", NodeLayoutComponent);
  28. static void Reflect(AZ::ReflectContext*);
  29. static AZ::Entity* CreateCommentNodeEntity();
  30. CommentNodeLayoutComponent();
  31. ~CommentNodeLayoutComponent();
  32. // AZ::Component
  33. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
  34. {
  35. dependent.push_back(AZ_CRC("GraphCanvas_NodeLayoutSupportService", 0xa8b639be));
  36. dependent.push_back(AZ_CRC("GraphCanvas_CommentTextService", 0xb650db99));
  37. }
  38. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  39. {
  40. required.push_back(AZ_CRC("GraphCanvas_NodeService", 0xcc0f32cc));
  41. required.push_back(AZ_CRC("GraphCanvas_StyledGraphicItemService", 0xeae4cdf4));
  42. }
  43. void Init() override;
  44. void Activate() override;
  45. void Deactivate() override;
  46. ////
  47. // EntityBus
  48. void OnEntityExists(const AZ::EntityId& entityId) override;
  49. ////
  50. // StyleNotificationBus
  51. void OnStyleChanged() override;
  52. ////
  53. // NodeNotification
  54. void OnNodeActivated() override;
  55. ////
  56. protected:
  57. void UpdateLayoutParameters();
  58. Styling::StyleHelper m_style;
  59. QGraphicsLinearLayout* m_comment;
  60. };
  61. }