Clipboard.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 CRYINCLUDE_EDITOR_CLIPBOARD_H
  9. #define CRYINCLUDE_EDITOR_CLIPBOARD_H
  10. #pragma once
  11. #include "Include/EditorCoreAPI.h"
  12. #include <QTimer>
  13. class CImageEx;
  14. class QVariant;
  15. class QWidget;
  16. /** Use this class to put and get stuff from windows clipboard.
  17. */
  18. class EDITOR_CORE_API CClipboard
  19. {
  20. public:
  21. CClipboard(QWidget* parent);
  22. //! Put xml node into clipboard
  23. void Put(XmlNodeRef& node, const QString& title = QString());
  24. //! Get xml node to clipboard.
  25. XmlNodeRef Get() const;
  26. //! Put string into Windows clipboard.
  27. void PutString(const QString& text, const QString& title = QString());
  28. //! Get string from Windows clipboard.
  29. QString GetString() const;
  30. //! Return name of what is in clipboard now.
  31. QString GetTitle() const { return m_title; };
  32. //! Put image into Windows clipboard.
  33. void PutImage(const CImageEx& img);
  34. //! Get image from Windows clipboard.
  35. bool GetImage(CImageEx& img);
  36. //! Return true if clipboard is empty.
  37. bool IsEmpty() const;
  38. private:
  39. // Resolves the last request Put operation
  40. void SendPendingPut();
  41. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  42. static XmlNodeRef m_node;
  43. static QString m_title;
  44. static QVariant s_pendingPut;
  45. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  46. QWidget* m_parent;
  47. QTimer m_putDebounce;
  48. };
  49. #endif // CRYINCLUDE_EDITOR_CLIPBOARD_H