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{
27constexpr int INPUT_ALPHANUM{0};
28constexpr int INPUT_NUMERIC{1};
29constexpr int INPUT_DATE{2};
30constexpr int INPUT_TIME{3};
31constexpr int INPUT_IPADDRESS{4};
32constexpr int INPUT_PASSWORD{5};
33
34constexpr int PASSWORD_VERIFY{1};
35constexpr int ALPHANUM_HIDE_INPUT{2};
36
47 class Dialog : public AddonClass
48 {
49 public:
50
51 inline Dialog() = default;
52 ~Dialog() override;
53
54#ifdef DOXYGEN_SHOULD_USE_THIS
94 yesno(...);
95#else
96 bool yesno(const String& heading,
97 const String& message,
98 const String& nolabel = emptyString,
99 const String& yeslabel = emptyString,
100 int autoclose = 0,
101 int defaultbutton = CONTROL_NO_BUTTON);
102#endif
103
104#ifdef DOXYGEN_SHOULD_USE_THIS
144#else
145 int yesnocustom(const String& heading,
146 const String& message,
147 const String& customlabel,
148 const String& nolabel = emptyString,
149 const String& yeslabel = emptyString,
150 int autoclose = 0,
151 int defaultbutton = CONTROL_NO_BUTTON);
152#endif
153
154#ifdef DOXYGEN_SHOULD_USE_THIS
177 info(...);
178#else
179 bool info(const ListItem* item);
180#endif
181
182#ifdef DOXYGEN_SHOULD_USE_THIS
211 select(...);
212#else
213 int select(const String& heading, const std::vector<Alternative<String, const ListItem* > > & list, int autoclose=0, int preselect=-1, bool useDetails=false);
214#endif
215
216#ifdef DOXYGEN_SHOULD_USE_THIS
239#else
240 int contextmenu(const std::vector<String>& list);
241#endif
242
243#ifdef DOXYGEN_SHOULD_USE_THIS
275#else
276 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);
277#endif
278
279#ifdef DOXYGEN_SHOULD_USE_THIS
306 ok(...);
307#else
308 bool ok(const String& heading, const String& message);
309#endif
310
311#ifdef DOXYGEN_SHOULD_USE_THIS
338#else
339 void textviewer(const String& heading, const String& text, bool usemono = false);
340#endif
341
342#ifdef DOXYGEN_SHOULD_USE_THIS
398 browse(...);
399#else
400 Alternative<String, std::vector<String> > browse(int type, const String& heading, const String& shares,
401 const String& mask = emptyString, bool useThumbs = false,
402 bool treatAsFolder = false, const String& defaultt = emptyString,
403 bool enableMultiple = false);
404#endif
405
406#ifdef DOXYGEN_SHOULD_USE_THIS
459#else
460 String browseSingle(int type, const String& heading, const String& shares,
461 const String& mask = emptyString, bool useThumbs = false,
462 bool treatAsFolder = false,
463 const String& defaultt = emptyString );
464#endif
465
466#ifdef DOXYGEN_SHOULD_USE_THIS
515#else
516 std::vector<String> browseMultiple(int type, const String& heading, const String& shares,
517 const String& mask = emptyString, bool useThumbs = false,
518 bool treatAsFolder = false,
519 const String& defaultt = emptyString );
520#endif
521
522#ifdef DOXYGEN_SHOULD_USE_THIS
559#else
560 String numeric(int type, const String& heading, const String& defaultt = emptyString, bool bHiddenInput = false);
561#endif
562
563#ifdef DOXYGEN_SHOULD_USE_THIS
593#else
594 void notification(const String& heading, const String& message, const String& icon = emptyString, int time = 0, bool sound = true);
595#endif
596
597#ifdef DOXYGEN_SHOULD_USE_THIS
636 input(...);
637#else
638 String input(const String& heading,
639 const String& defaultt = emptyString,
640 int type = INPUT_ALPHANUM,
641 int option = 0,
642 int autoclose = 0);
643#endif
644
645#ifdef DOXYGEN_SHOULD_USE_THIS
691#else
692 String colorpicker(
693 const String& heading,
694 const String& selectedcolor = emptyString,
695 const String& colorfile = emptyString,
696 const std::vector<const ListItem*>& colorlist = std::vector<const ListItem*>());
697#endif
698
699 private:
700#ifndef DOXYGEN_SHOULD_SKIP_THIS
701 // used by both yesno() and yesnocustom()
702 int yesNoCustomInternal(const String& heading,
703 const String& message,
704 const String& nolabel,
705 const String& yeslabel,
706 const String& customlabel,
707 int autoclose,
708 int defaultbutton);
709#endif
710 };
712
720 class DialogProgress : public AddonClass
721 {
722 CGUIDialogProgress* dlg = nullptr;
723 bool open = false;
724
725 protected:
726 void deallocating() override;
727
728 public:
729
730 DialogProgress() = default;
731 ~DialogProgress() override;
732
733#ifdef DOXYGEN_SHOULD_USE_THIS
758 create(...);
759#else
760 void create(const String& heading, const String& message = emptyString);
761#endif
762
763#ifdef DOXYGEN_SHOULD_USE_THIS
786 update(...);
787#else
788 void update(int percent, const String& message = emptyString);
789#endif
790
791#ifdef DOXYGEN_SHOULD_USE_THIS
807 close(...);
808#else
809 void close();
810#endif
811
812#ifdef DOXYGEN_SHOULD_USE_THIS
831#else
832 bool iscanceled();
833#endif
834 };
835
837
845 class DialogProgressBG : public AddonClass
846 {
847 CGUIDialogExtendedProgressBar* dlg = nullptr;
848 CGUIDialogProgressBarHandle* handle = nullptr;
849 bool open = false;
850
851 protected:
852 void deallocating() override;
853
854 public:
855
856 DialogProgressBG() = default;
857 ~DialogProgressBG() override;
858
859#ifdef DOXYGEN_SHOULD_USE_THIS
882 create(...);
883#else
884 void create(const String& heading, const String& message = emptyString);
885#endif
886
887#ifdef DOXYGEN_SHOULD_USE_THIS
909 update(...);
910#else
911 void update(int percent = 0, const String& heading = emptyString, const String& message = emptyString);
912#endif
913
914#ifdef DOXYGEN_SHOULD_USE_THIS
930 close(...);
931#else
932 void close();
933#endif
934
935#ifdef DOXYGEN_SHOULD_USE_THIS
954#else
955 bool isFinished();
956#endif
957 };
959#ifndef DOXYGEN_SHOULD_SKIP_THIS
960 SWIG_CONSTANT2(int, DLG_YESNO_NO_BTN, CONTROL_NO_BUTTON);
961 SWIG_CONSTANT2(int, DLG_YESNO_YES_BTN, CONTROL_YES_BUTTON);
962 SWIG_CONSTANT2(int, DLG_YESNO_CUSTOM_BTN, CONTROL_CUSTOM_BUTTON);
963#endif
964} // namespace xbmcgui
965} // namespace XBMCAddon
Definition Dialog.h:48
Definition Dialog.h:721
Definition ListItem.h:54