DebugAttachmentButton.hxx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifndef INC_DEBUGATTACHMENTBUTTON_H
  9. #define INC_DEBUGATTACHMENTBUTTON_H
  10. #if !defined(Q_MOC_RUN)
  11. #include <AzCore/base.h>
  12. #include <AzCore/Memory/SystemAllocator.h>
  13. #include "LUAContextControlMessages.h"
  14. #include <QPushButton>
  15. #include <QWidgetAction>
  16. #endif
  17. #pragma once
  18. namespace LUAEditor
  19. {
  20. enum DebugAttachmentState
  21. {
  22. DAS_UNATTACHED = 0,
  23. DAS_ATTACHED,
  24. DAS_REFUSED
  25. };
  26. class DebugAttachmentButton
  27. : public QPushButton
  28. , private Context_ControlManagement::Handler
  29. {
  30. Q_OBJECT
  31. public:
  32. AZ_CLASS_ALLOCATOR(DebugAttachmentButton, AZ::SystemAllocator);
  33. DebugAttachmentButton(QWidget *pParent = 0);
  34. virtual ~DebugAttachmentButton();
  35. // These come from the CONTEXT
  36. void OnDebuggerAttached();
  37. void OnDebuggerRefused();
  38. void OnDebuggerDetached();
  39. void OnTargetConnected(){}
  40. void OnTargetDisconnected(){}
  41. void OnTargetContextPrepared( AZStd::string &contextName ){(void)contextName;}
  42. virtual void paintEvent(QPaintEvent * /* event */);
  43. private:
  44. DebugAttachmentState m_State;
  45. void UpdateStatus( DebugAttachmentState newState );
  46. public slots:
  47. void OnClicked();
  48. };
  49. class DebugAttachmentButtonAction : public QWidgetAction
  50. {
  51. Q_OBJECT
  52. public:
  53. AZ_CLASS_ALLOCATOR(DebugAttachmentButtonAction,AZ::SystemAllocator,0);
  54. DebugAttachmentButtonAction(QObject *pParent); // create default action
  55. protected:
  56. virtual QWidget* createWidget(QWidget* pParent);
  57. };
  58. }
  59. #endif //INC_DEBUGATTACHMENTBUTTON_H