ImGuiMessageBox.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 <AzFramework/Windowing/WindowBus.h>
  10. struct ImGuiContext;
  11. namespace AtomSampleViewer
  12. {
  13. //! Shows a simple message or confirmation dialog.
  14. class ImGuiMessageBox
  15. {
  16. public:
  17. void OpenPopupMessage(AZStd::string title, AZStd::string message);
  18. void OpenPopupConfirmation(AZStd::string title, AZStd::string message, AZStd::function<void()> okAction, AZStd::string okButton = "OK", AZStd::string cancelButton = "Cancel");
  19. void TickPopup();
  20. private:
  21. enum class Type
  22. {
  23. Ok,
  24. OkCancel
  25. } m_type;
  26. enum class State
  27. {
  28. Closed,
  29. Opening,
  30. Open
  31. };
  32. AZStd::string m_title;
  33. AZStd::string m_message;
  34. AZStd::string m_okButtonLabel;
  35. AZStd::string m_cancelButtonLabel;
  36. AZStd::function<void()> m_okAction;
  37. State m_state = State::Closed;
  38. };
  39. } // namespace AtomSampleViewer