diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/dialogs/GUIDialogBoxBase.h | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/dialogs/GUIDialogBoxBase.h')
-rw-r--r-- | xbmc/dialogs/GUIDialogBoxBase.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/xbmc/dialogs/GUIDialogBoxBase.h b/xbmc/dialogs/GUIDialogBoxBase.h new file mode 100644 index 0000000..41ab31b --- /dev/null +++ b/xbmc/dialogs/GUIDialogBoxBase.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2005-2018 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +#include "guilib/GUIDialog.h" +#include "threads/CriticalSection.h" + +#include <vector> + +#define CONTROL_CHOICES_START 10 +#define CONTROL_NO_BUTTON CONTROL_CHOICES_START +#define CONTROL_YES_BUTTON CONTROL_CHOICES_START + 1 +#define CONTROL_CUSTOM_BUTTON CONTROL_CHOICES_START + 2 +#define CONTROL_PROGRESS_BAR 20 + +#define DIALOG_MAX_LINES 3 +#define DIALOG_MAX_CHOICES 3 + +class CVariant; + +class CGUIDialogBoxBase : + public CGUIDialog +{ +public: + CGUIDialogBoxBase(int id, const std::string &xmlFile); + ~CGUIDialogBoxBase(void) override; + bool OnMessage(CGUIMessage& message) override; + bool IsConfirmed() const; + void SetLine(unsigned int iLine, const CVariant& line); + void SetText(const CVariant& text); + void SetHeading(const CVariant& heading); + void SetChoice(int iButton, const CVariant &choice); +protected: + std::string GetDefaultLabel(int controlId) const; + virtual int GetDefaultLabelID(int controlId) const; + /*! \brief Get a localized string from a variant + If the variant is already a string we return directly, else if it's an integer we return the corresponding + localized string. + \param var the variant to localize. + */ + std::string GetLocalized(const CVariant &var) const; + + void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override; + void OnInitWindow() override; + void OnDeinitWindow(int nextWindowID) override; + + bool m_bConfirmed; + bool m_hasTextbox; + + // actual strings + CCriticalSection m_section; + std::string m_strHeading; + std::string m_text; + std::string m_strChoices[DIALOG_MAX_CHOICES]; +}; |