UiTestScrollBoxDataProviderComponent.h 2.4 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. #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_CE("UiDynamicContentProviderService"));
  35. }
  36. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  37. {
  38. incompatible.push_back(AZ_CRC_CE("UiDynamicContentProviderService"));
  39. }
  40. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  41. {
  42. required.push_back(AZ_CRC_CE("UiDynamicScrollBoxService"));
  43. required.push_back(AZ_CRC_CE("UiElementService"));
  44. required.push_back(AZ_CRC_CE("UiTransformService"));
  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. }