xbmc
GUIDialog.h
Go to the documentation of this 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 
16 #include "GUIWindow.h"
17 #include "WindowIDs.h"
18 
19 #ifdef TARGET_WINDOWS_STORE
20 #pragma pack(push, 8)
21 #endif
22 enum class DialogModalityType
23 {
24  MODELESS,
25  MODAL
26 };
27 #ifdef TARGET_WINDOWS_STORE
28 #pragma pack(pop)
29 #endif
30 
35 class CGUIDialog :
36  public CGUIWindow
37 {
38 public:
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  void Open(bool bProcessRenderLoop, const std::string& param = "");
49 
50  bool OnBack(int actionID) override;
51 
52  bool IsDialogRunning() const override { return m_active; }
53  bool IsDialog() const override { return true; }
54  bool IsModalDialog() const override { return m_modalityType == DialogModalityType::MODAL; }
55  virtual DialogModalityType GetModalityType() const { return m_modalityType; }
56 
57  void SetAutoClose(unsigned int timeoutMs);
58  void ResetAutoClose(void);
59  void CancelAutoClose(void);
60  bool IsAutoClosed(void) const { return m_bAutoClosed; }
61  void SetSound(bool OnOff) { m_enableSound = OnOff; }
62  bool IsSoundEnabled() const override { return m_enableSound; }
63 
64 protected:
65  bool Load(TiXmlElement *pRootElement) override;
66  void SetDefaults() override;
67  void OnWindowLoaded() override;
68  using CGUIWindow::UpdateVisibility;
69  virtual void UpdateVisibility();
70 
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;
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 };
bool m_wasRunning
true if we were running during the last DoProcess()
Definition: GUIDialog.h:76
class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:22
Definition: GUIDialog.h:35
Definition: GUIMessage.h:365
Definition: GUIWindow.h:58