InspectorBus.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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/EBus/EBus.h>
  10. #include <QtGlobal>
  11. #include <QString>
  12. QT_FORWARD_DECLARE_CLASS(QWidget)
  13. namespace EMStudio
  14. {
  15. class InspectorRequests
  16. : public AZ::EBusTraits
  17. {
  18. public:
  19. // Call in case a fully customized widget shall be shown in the inspector. The header widget will be shown above the given widget.
  20. // NOTE: The inspector will NOT take ownership of the widget and it is your responsibility to destruct it along with the owning plugin.
  21. virtual void UpdateWithHeader([[maybe_unused]] const QString& headerTitle, [[maybe_unused]] const QString& iconFilename, [[maybe_unused]] QWidget* widget) = 0;
  22. // Call in case a fully customized widget shall be shown in the inspector without the header.
  23. // NOTE: The inspector will NOT take ownership of the widget and it is your responsibility to destruct it along with the owning plugin.
  24. virtual void Update(QWidget* widget) = 0;
  25. // Call in case the objects to be inspected are reflected. This creates a card with a reflected property editor inside in the standard way for each object along with a header widget above.
  26. // Use this method whenever a single, reflected object shall be visible in the inspector.
  27. struct CardElement
  28. {
  29. void* m_object = nullptr;
  30. AZ::TypeId m_objectTypeId;
  31. QString m_cardName;
  32. QWidget* m_customWidget = nullptr;
  33. };
  34. virtual void UpdateWithRpe([[maybe_unused]] const QString& headerTitle, [[maybe_unused]] const QString& iconFilename, [[maybe_unused]] const AZStd::vector<CardElement>& cardElements) = 0;
  35. // Call in case the inspected object got removed or unselected. This will show the no selection widget in the inspector.
  36. virtual void Clear() = 0;
  37. // Clear the inspector and show the default no selection widget in case the given widget is currently shown.
  38. virtual void ClearIfShown(QWidget* widget) = 0;
  39. };
  40. using InspectorRequestBus = AZ::EBus<InspectorRequests>;
  41. class InspectorNotifications
  42. : public AZ::EBusTraits
  43. {
  44. public:
  45. };
  46. using InspectorNotificationBus = AZ::EBus<InspectorNotifications>;
  47. } // namespace EMStudio