InterpreterWidget.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #if !defined(Q_MOC_RUN)
  10. #include <AzCore/PlatformDef.h>
  11. #include <AzCore/std/smart_ptr/unique_ptr.h>
  12. #include <AzQtComponents/Components/StyledDialog.h>
  13. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  14. #include <Editor/Framework/Interpreter.h>
  15. #include <QtWidgets/QWidget>
  16. #endif
  17. namespace AzToolsFramework
  18. {
  19. class ReflectedPropertyEditor;
  20. class InstanceDataNode;
  21. }
  22. namespace AZ
  23. {
  24. class SerializeContext;
  25. }
  26. namespace Ui
  27. {
  28. class InterpreterWidget;
  29. }
  30. namespace ScriptCanvasEditor
  31. {
  32. class Configuration;
  33. /// <summary>
  34. /// Reusable Editor Widget that provides an editable [Configuration](@ref Configuration) and control for an
  35. /// [Interpreter](@ref Interpreter). This allows developers to place the widget in almost any tool to provide in-place access to
  36. /// executing ScriptCanvas graphs.
  37. /// </summary>
  38. class InterpreterWidget final
  39. : public AzQtComponents::StyledDialog
  40. , public AzToolsFramework::IPropertyEditorNotify
  41. {
  42. Q_OBJECT
  43. public:
  44. AZ_TYPE_INFO(InterpreterWidget, "{3D2FAD9B-47C0-494A-9BE0-57C14820B40F}");
  45. AZ_CLASS_ALLOCATOR(InterpreterWidget, AZ::SystemAllocator);
  46. static void Reflect(AZ::ReflectContext* context);
  47. explicit InterpreterWidget(QWidget* parent = nullptr);
  48. ~InterpreterWidget() override;
  49. private:
  50. Interpreter m_interpreter;
  51. Ui::InterpreterWidget* m_view = nullptr;
  52. AZ::EventHandler<const Interpreter&> m_onIterpreterStatusChanged;
  53. AZ::EventHandler<const Configuration&> m_handlerSourceCompiled;
  54. void OnButtonStartPressed();
  55. void OnButtonStopPressed();
  56. void OnInterpreterStatusChanged(const Interpreter&);
  57. // IPropertyEditorNotify ...
  58. void AfterPropertyModified(AzToolsFramework::InstanceDataNode*) {}
  59. void BeforePropertyModified(AzToolsFramework::InstanceDataNode*) {}
  60. void RequestPropertyContextMenu(AzToolsFramework::InstanceDataNode*, const QPoint&) {}
  61. void SealUndoStack() {}
  62. void SetPropertyEditingActive(AzToolsFramework::InstanceDataNode*) {}
  63. void SetPropertyEditingComplete(AzToolsFramework::InstanceDataNode*) {}
  64. // ... IPropertyEditorNotify
  65. };
  66. }