PageRenderTime 36ms CodeModel.GetById 15ms app.highlight 16ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 9#pragma once
10
11/*!
12\file GUIDialog.h
13\brief
14*/
15
16#include "GUIWindow.h"
17#include "WindowIDs.h"
18
19#ifdef TARGET_WINDOWS_STORE
20#pragma pack(push, 8)
21#endif
22enum class DialogModalityType
23{
24  MODELESS,
25  MODAL
26};
27#ifdef TARGET_WINDOWS_STORE
28#pragma pack(pop)
29#endif
30
31/*!
32 \ingroup winmsg
33 \brief
34 */
35class CGUIDialog :
36      public CGUIWindow
37{
38public:
39  CGUIDialog(int id, const std::string &xmlFile, DialogModalityType modalityType = DialogModalityType::MODAL);
40  ~CGUIDialog(void) override;
41
42  bool OnAction(const CAction &action) override;
43  bool OnMessage(CGUIMessage& message) override;
44  void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
45  void Render() override;
46
47  void Open(const std::string &param = "");
48
49  bool OnBack(int actionID) override;
50
51  bool IsDialogRunning() const override { return m_active; };
52  bool IsDialog() const override { return true;};
53  bool IsModalDialog() const override { return m_modalityType == DialogModalityType::MODAL; };
54  virtual DialogModalityType GetModalityType() const { return m_modalityType; };
55
56  void SetAutoClose(unsigned int timeoutMs);
57  void ResetAutoClose(void);
58  void CancelAutoClose(void);
59  bool IsAutoClosed(void) const { return m_bAutoClosed; };
60  void SetSound(bool OnOff) { m_enableSound = OnOff; };
61  bool IsSoundEnabled() const override { return m_enableSound; };
62
63protected:
64  bool Load(TiXmlElement *pRootElement) override;
65  void SetDefaults() override;
66  void OnWindowLoaded() override;
67  using CGUIWindow::UpdateVisibility;
68  virtual void UpdateVisibility();
69
70  virtual void Open_Internal(const std::string &param = "");
71  virtual void Open_Internal(bool bProcessRenderLoop, const std::string &param = "");
72  void OnDeinitWindow(int nextWindowID) override;
73
74  void ProcessRenderLoop(bool renderOnly = false);
75
76  bool m_wasRunning; ///< \brief true if we were running during the last DoProcess()
77  bool m_autoClosing;
78  bool m_enableSound;
79  unsigned int m_showStartTime;
80  unsigned int m_showDuration;
81  bool m_bAutoClosed;
82  DialogModalityType m_modalityType;
83};