Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Dialog.h
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#include "AddonClass.h"
12#include "AddonString.h"
13#include "Alternative.h"
14#include "ListItem.h"
15#include "dialogs/GUIDialogBoxBase.h"
16#include "dialogs/GUIDialogExtendedProgressBar.h"
17#include "dialogs/GUIDialogProgress.h"
18#include "swighelper.h"
19
20#include <string>
21#include <vector>
22
23namespace XBMCAddon
24{
25namespace xbmcgui
26{
27#ifndef SWIG
28// These constants are exposed to Python via SWIG_CONSTANT in ModuleXbmcgui.h.
29// Excluded from SWIG processing here to avoid Warning 302 redefinition.
30constexpr int INPUT_ALPHANUM{0};
31constexpr int INPUT_NUMERIC{1};
32constexpr int INPUT_DATE{2};
33constexpr int INPUT_TIME{3};
34constexpr int INPUT_IPADDRESS{4};
35constexpr int INPUT_PASSWORD{5};
36
37constexpr int PASSWORD_VERIFY{1};
38constexpr int ALPHANUM_HIDE_INPUT{2};
39#endif
40
51 class Dialog : public AddonClass
52 {
53 public:
54
55 inline Dialog() = default;
56 ~Dialog() override;
57
58#ifdef DOXYGEN_SHOULD_USE_THIS
98 yesno(...);
99#else
100 bool yesno(const String& heading,
101 const String& message,
102 const String& nolabel = emptyString,
103 const String& yeslabel = emptyString,
104 int autoclose = 0,
105 int defaultbutton = CONTROL_NO_BUTTON);
106#endif
107
108#ifdef DOXYGEN_SHOULD_USE_THIS
148#else
149 int yesnocustom(const String& heading,
150 const String& message,
151 const String& customlabel,
152 const String& nolabel = emptyString,
153 const String& yeslabel = emptyString,
154 int autoclose = 0,
155 int defaultbutton = CONTROL_NO_BUTTON);
156#endif
157
158#ifdef DOXYGEN_SHOULD_USE_THIS
181 info(...);
182#else
183 bool info(const ListItem* item);
184#endif
185
186#ifdef DOXYGEN_SHOULD_USE_THIS
215 select(...);
216#else
217 int select(const String& heading, const std::vector<Alternative<String, const ListItem* > > & list, int autoclose=0, int preselect=-1, bool useDetails=false);
218#endif
219
220#ifdef DOXYGEN_SHOULD_USE_THIS
243#else
244 int contextmenu(const std::vector<String>& list);
245#endif
246
247#ifdef DOXYGEN_SHOULD_USE_THIS
279#else
280 std::unique_ptr<std::vector<int> > multiselect(const String& heading, const std::vector<Alternative<String, const ListItem* > > & options, int autoclose=0, const std::vector<int>& preselect = std::vector<int>(), bool useDetails=false);
281#endif
282
283#ifdef DOXYGEN_SHOULD_USE_THIS
310 ok(...);
311#else
312 bool ok(const String& heading, const String& message);
313#endif
314
315#ifdef DOXYGEN_SHOULD_USE_THIS
342#else
343 void textviewer(const String& heading, const String& text, bool usemono = false);
344#endif
345
346#ifdef DOXYGEN_SHOULD_USE_THIS
402 browse(...);
403#else
404 Alternative<String, std::vector<String> > browse(int type, const String& heading, const String& shares,
405 const String& mask = emptyString, bool useThumbs = false,
406 bool treatAsFolder = false, const String& defaultt = emptyString,
407 bool enableMultiple = false);
408#endif
409
410#ifdef DOXYGEN_SHOULD_USE_THIS
463#else
464 String browseSingle(int type, const String& heading, const String& shares,
465 const String& mask = emptyString, bool useThumbs = false,
466 bool treatAsFolder = false,
467 const String& defaultt = emptyString );
468#endif
469
470#ifdef DOXYGEN_SHOULD_USE_THIS
519#else
520 std::vector<String> browseMultiple(int type, const String& heading, const String& shares,
521 const String& mask = emptyString, bool useThumbs = false,
522 bool treatAsFolder = false,
523 const String& defaultt = emptyString );
524#endif
525
526#ifdef DOXYGEN_SHOULD_USE_THIS
563#else
564 String numeric(int type, const String& heading, const String& defaultt = emptyString, bool bHiddenInput = false);
565#endif
566
567#ifdef DOXYGEN_SHOULD_USE_THIS
597#else
598 void notification(const String& heading, const String& message, const String& icon = emptyString, int time = 0, bool sound = true);
599#endif
600
601#ifdef DOXYGEN_SHOULD_USE_THIS
640 input(...);
641#else
642 String input(const String& heading,
643 const String& defaultt = emptyString,
644 int type = INPUT_ALPHANUM,
645 int option = 0,
646 int autoclose = 0);
647#endif
648
649#ifdef DOXYGEN_SHOULD_USE_THIS
695#else
696 String colorpicker(
697 const String& heading,
698 const String& selectedcolor = emptyString,
699 const String& colorfile = emptyString,
700 const std::vector<const ListItem*>& colorlist = std::vector<const ListItem*>());
701#endif
702
703 private:
704#ifndef DOXYGEN_SHOULD_SKIP_THIS
705 // used by both yesno() and yesnocustom()
706 int yesNoCustomInternal(const String& heading,
707 const String& message,
708 const String& nolabel,
709 const String& yeslabel,
710 const String& customlabel,
711 int autoclose,
712 int defaultbutton);
713#endif
714 };
716
724 class DialogProgress : public AddonClass
725 {
726 CGUIDialogProgress* dlg = nullptr;
727 bool open = false;
728
729 protected:
730 void deallocating() override;
731
732 public:
733
734 DialogProgress() = default;
735 ~DialogProgress() override;
736
737#ifdef DOXYGEN_SHOULD_USE_THIS
762 create(...);
763#else
764 void create(const String& heading, const String& message = emptyString);
765#endif
766
767#ifdef DOXYGEN_SHOULD_USE_THIS
790 update(...);
791#else
792 void update(int percent, const String& message = emptyString);
793#endif
794
795#ifdef DOXYGEN_SHOULD_USE_THIS
811 close(...);
812#else
813 void close();
814#endif
815
816#ifdef DOXYGEN_SHOULD_USE_THIS
835#else
836 bool iscanceled();
837#endif
838 };
839
841
849 class DialogProgressBG : public AddonClass
850 {
851 CGUIDialogExtendedProgressBar* dlg = nullptr;
852 CGUIDialogProgressBarHandle* handle = nullptr;
853 bool open = false;
854
855 protected:
856 void deallocating() override;
857
858 public:
859
860 DialogProgressBG() = default;
861 ~DialogProgressBG() override;
862
863#ifdef DOXYGEN_SHOULD_USE_THIS
886 create(...);
887#else
888 void create(const String& heading, const String& message = emptyString);
889#endif
890
891#ifdef DOXYGEN_SHOULD_USE_THIS
913 update(...);
914#else
915 void update(int percent = 0, const String& heading = emptyString, const String& message = emptyString);
916#endif
917
918#ifdef DOXYGEN_SHOULD_USE_THIS
934 close(...);
935#else
936 void close();
937#endif
938
939#ifdef DOXYGEN_SHOULD_USE_THIS
958#else
959 bool isFinished();
960#endif
961 };
963#ifndef DOXYGEN_SHOULD_SKIP_THIS
964 SWIG_CONSTANT2(int, DLG_YESNO_NO_BTN, CONTROL_NO_BUTTON);
965 SWIG_CONSTANT2(int, DLG_YESNO_YES_BTN, CONTROL_YES_BUTTON);
966 SWIG_CONSTANT2(int, DLG_YESNO_CUSTOM_BTN, CONTROL_CUSTOM_BUTTON);
967#endif
968} // namespace xbmcgui
969} // namespace XBMCAddon
Definition Dialog.h:52
Definition Dialog.h:725
Definition ListItem.h:54