UiTestScrollBoxDataProviderComponent.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 <LyShine/Bus/UiDynamicScrollBoxBus.h>
  10. #include <AzCore/Component/Component.h>
  11. namespace LyShineExamples
  12. {
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////
  14. //! This component associates dynamic data with the dynamic scroll box in the UiComponents
  15. //! level
  16. class UiTestScrollBoxDataProviderComponent
  17. : public AZ::Component
  18. , public UiDynamicScrollBoxDataBus::Handler
  19. , public UiDynamicScrollBoxElementNotificationBus::Handler
  20. {
  21. public: // member functions
  22. AZ_COMPONENT(UiTestScrollBoxDataProviderComponent, "{C66A6BBF-D715-4876-8302-D452CC6975C8}", AZ::Component);
  23. UiTestScrollBoxDataProviderComponent();
  24. ~UiTestScrollBoxDataProviderComponent() override;
  25. // UiDynamicScrollBoxDataInterface
  26. virtual int GetNumElements() override;
  27. // ~UiDynamicScrollBoxDataInterface
  28. // UiDynamicScrollBoxElementNotifications
  29. virtual void OnElementBecomingVisible(AZ::EntityId entityId, int index) override;
  30. // ~UiDynamicScrollBoxElementNotifications
  31. protected: // static member functions
  32. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  33. {
  34. provided.push_back(AZ_CRC("UiDynamicContentProviderService", 0xe25f3f73));
  35. }
  36. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  37. {
  38. incompatible.push_back(AZ_CRC("UiDynamicContentProviderService", 0xe25f3f73));
  39. }
  40. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  41. {
  42. required.push_back(AZ_CRC("UiDynamicScrollBoxService", 0x11112f1a));
  43. required.push_back(AZ_CRC("UiElementService", 0x3dca7ad4));
  44. required.push_back(AZ_CRC("UiTransformService", 0x3a838e34));
  45. }
  46. static void Reflect(AZ::ReflectContext* context);
  47. protected: // member functions
  48. // AZ::Component
  49. void Activate() override;
  50. void Deactivate() override;
  51. // ~AZ::Component
  52. AZ_DISABLE_COPY_MOVE(UiTestScrollBoxDataProviderComponent);
  53. protected: // data
  54. };
  55. }