/xbmc/guilib/GUIDialog.h

http://github.com/xbmc/xbmc · C Header · 83 lines · 54 code · 14 blank · 15 comment · 1 complexity · ba70f3384c4d1706e64d07cf7aabc99d MD5 · raw file

  1. /*
  2. * Copyright (C) 2005-2018 Team Kodi
  3. * This file is part of Kodi - https://kodi.tv
  4. *
  5. * SPDX-License-Identifier: GPL-2.0-or-later
  6. * See LICENSES/README.md for more information.
  7. */
  8. #pragma once
  9. /*!
  10. \file GUIDialog.h
  11. \brief
  12. */
  13. #include "GUIWindow.h"
  14. #include "WindowIDs.h"
  15. #ifdef TARGET_WINDOWS_STORE
  16. #pragma pack(push, 8)
  17. #endif
  18. enum class DialogModalityType
  19. {
  20. MODELESS,
  21. MODAL
  22. };
  23. #ifdef TARGET_WINDOWS_STORE
  24. #pragma pack(pop)
  25. #endif
  26. /*!
  27. \ingroup winmsg
  28. \brief
  29. */
  30. class CGUIDialog :
  31. public CGUIWindow
  32. {
  33. public:
  34. CGUIDialog(int id, const std::string &xmlFile, DialogModalityType modalityType = DialogModalityType::MODAL);
  35. ~CGUIDialog(void) override;
  36. bool OnAction(const CAction &action) override;
  37. bool OnMessage(CGUIMessage& message) override;
  38. void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
  39. void Render() override;
  40. void Open(const std::string &param = "");
  41. bool OnBack(int actionID) override;
  42. bool IsDialogRunning() const override { return m_active; };
  43. bool IsDialog() const override { return true;};
  44. bool IsModalDialog() const override { return m_modalityType == DialogModalityType::MODAL; };
  45. virtual DialogModalityType GetModalityType() const { return m_modalityType; };
  46. void SetAutoClose(unsigned int timeoutMs);
  47. void ResetAutoClose(void);
  48. void CancelAutoClose(void);
  49. bool IsAutoClosed(void) const { return m_bAutoClosed; };
  50. void SetSound(bool OnOff) { m_enableSound = OnOff; };
  51. bool IsSoundEnabled() const override { return m_enableSound; };
  52. protected:
  53. bool Load(TiXmlElement *pRootElement) override;
  54. void SetDefaults() override;
  55. void OnWindowLoaded() override;
  56. using CGUIWindow::UpdateVisibility;
  57. virtual void UpdateVisibility();
  58. virtual void Open_Internal(const std::string &param = "");
  59. virtual void Open_Internal(bool bProcessRenderLoop, const std::string &param = "");
  60. void OnDeinitWindow(int nextWindowID) override;
  61. void ProcessRenderLoop(bool renderOnly = false);
  62. bool m_wasRunning; ///< \brief true if we were running during the last DoProcess()
  63. bool m_autoClosing;
  64. bool m_enableSound;
  65. unsigned int m_showStartTime;
  66. unsigned int m_showDuration;
  67. bool m_bAutoClosed;
  68. DialogModalityType m_modalityType;
  69. };