UiLayoutManager.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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/UiLayoutManagerBus.h>
  10. ////////////////////////////////////////////////////////////////////////////////////////////////////
  11. class UiLayoutManager
  12. : public UiLayoutManagerBus::Handler
  13. {
  14. public: // member functions
  15. UiLayoutManager(AZ::EntityId canvasEntityId);
  16. ~UiLayoutManager();
  17. // UiLayoutManagerBus interface implementation
  18. void MarkToRecomputeLayout(AZ::EntityId entityId) override;
  19. void MarkToRecomputeLayoutsAffectedByLayoutCellChange(AZ::EntityId entityId, bool isDefaultLayoutCell) override;
  20. void UnmarkAllLayouts() override;
  21. void RecomputeMarkedLayouts() override;
  22. void ComputeLayoutForElementAndDescendants(AZ::EntityId entityId) override;
  23. // ~UiLayoutManagerBus
  24. bool HasMarkedLayouts() const { return !m_elementsToRecomputeLayout.empty(); }
  25. private: // member functions
  26. AZ_DISABLE_COPY_MOVE(UiLayoutManager);
  27. void AddToRecomputeLayoutList(AZ::EntityId entityId);
  28. bool IsParentOfElement(AZ::EntityId checkParentEntity, AZ::EntityId checkChildEntity);
  29. private: // data
  30. //! Elements that need to recompute their layouts. Parents should be ahead of their children
  31. AZStd::list<AZ::EntityId> m_elementsToRecomputeLayout;
  32. };