PropertyHandlerOffset.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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/base.h>
  10. #include <AzCore/Memory/SystemAllocator.h>
  11. #include <LyShine/UiBase.h>
  12. #include <LyShine/Bus/UiTransform2dBus.h>
  13. #include "UIVectorPropertyHandlerBase.h"
  14. class PropertyHandlerOffset
  15. : public UIVectorPropertyHandlerBase< UiTransform2dInterface::Offsets>
  16. {
  17. public:
  18. AZ_CLASS_ALLOCATOR(PropertyHandlerOffset, AZ::SystemAllocator);
  19. PropertyHandlerOffset()
  20. : UIVectorPropertyHandlerBase(4, 2)
  21. {
  22. }
  23. AZ::u32 GetHandlerName(void) const override
  24. {
  25. return AZ_CRC("Offset", 0x590acad0);
  26. }
  27. bool IsDefaultHandler() const override
  28. {
  29. return true;
  30. }
  31. void ConsumeAttribute(AzQtComponents::VectorInput* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  32. void WriteGUIValuesIntoProperty(size_t index, AzQtComponents::VectorInput* GUI, UiTransform2dInterface::Offsets& instance, AzToolsFramework::InstanceDataNode* node) override;
  33. bool ReadValuesIntoGUI(size_t index, AzQtComponents::VectorInput* GUI, const UiTransform2dInterface::Offsets& instance, AzToolsFramework::InstanceDataNode* node) override;
  34. void GetLabels(UiTransform2dInterface::Anchors& anchors, AZStd::string* labelsOut);
  35. void SetLabels(AzQtComponents::VectorInput* ctrl,
  36. UiTransform2dInterface::Anchors& anchors);
  37. AZ::EntityId GetParentEntityId(AzToolsFramework::InstanceDataNode* node, size_t index);
  38. UiTransform2dInterface::Offsets InternalOffsetToDisplayedOffset(UiTransform2dInterface::Offsets internalOffset,
  39. const UiTransform2dInterface::Anchors& anchors,
  40. const AZ::Vector2& pivot);
  41. UiTransform2dInterface::Offsets DisplayedOffsetToInternalOffset(UiTransform2dInterface::Offsets displayedOffset,
  42. const UiTransform2dInterface::Anchors& anchors,
  43. const AZ::Vector2& pivot);
  44. static void Register();
  45. };