ExpandCollapseToggler.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. #if !defined(Q_MOC_RUN)
  10. #include <QAbstractButton>
  11. #include <QImage>
  12. #include <SceneAPI/SceneUI/SceneUIConfiguration.h>
  13. #endif
  14. class QPaintEvent;
  15. namespace AZ
  16. {
  17. namespace SceneAPI
  18. {
  19. namespace SceneUI
  20. {
  21. /**
  22. ExpandCollapseToggler - Button that shows expand & collapse images and aliases
  23. "checked" state & signals with "Expanded" functions & signals
  24. **/
  25. class SCENE_UI_API ExpandCollapseToggler : public QAbstractButton
  26. {
  27. Q_OBJECT
  28. public:
  29. explicit ExpandCollapseToggler(QWidget* parent = nullptr);
  30. ~ExpandCollapseToggler() override = default;
  31. void SetExpanded(bool isExpanded);
  32. bool IsExpanded() const;
  33. signals:
  34. void ExpandedChanged(bool isExpanded);
  35. protected:
  36. QSize sizeHint() const override;
  37. void paintEvent(QPaintEvent* evt) override;
  38. const QImage* CurrentTargetImage() const;
  39. protected:
  40. QImage m_expandActionImage;
  41. QImage m_collapseActionImage;
  42. };
  43. } // SceneUI
  44. } // SceneAPI
  45. } // AZ