summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs')
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt14
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ContextMenu.h186
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h242
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/FileBrowser.h302
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Keyboard.h404
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Numeric.h346
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/OK.h101
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Progress.h244
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Select.h269
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/TextViewer.h109
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/YesNo.h188
11 files changed, 2405 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt
new file mode 100644
index 0000000..9aaee4f
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt
@@ -0,0 +1,14 @@
1set(HEADERS ContextMenu.h
2 ExtendedProgress.h
3 FileBrowser.h
4 Keyboard.h
5 Numeric.h
6 OK.h
7 Progress.h
8 Select.h
9 TextViewer.h
10 YesNo.h)
11
12if(NOT ENABLE_STATIC_LIBS)
13 core_add_library(addons_kodi-dev-kit_include_kodi_gui_dialogs)
14endif()
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ContextMenu.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
new file mode 100644
index 0000000..b576b9a
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
@@ -0,0 +1,186 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/context_menu.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_ContextMenu Dialog Context Menu
25/// @ingroup cpp_kodi_gui_dialogs
26/// @brief @cpp_namespace{ kodi::gui::dialogs::ContextMenu }
27/// **Context menu dialog**@n
28/// The function listed below permits the call of a dialogue as context menu to
29/// select of an entry as a key
30///
31/// It has the header @ref ContextMenu.h "#include <kodi/gui/dialogs/ContextMenu.h>"
32/// be included to enjoy it.
33///
34///
35namespace ContextMenu
36{
37//==============================================================================
38/// @ingroup cpp_kodi_gui_dialogs_ContextMenu
39/// @brief Show a context menu dialog about given parts.
40///
41/// @param[in] heading Dialog heading name
42/// @param[in] entries String list about entries
43/// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled
44///
45///
46///-------------------------------------------------------------------------
47///
48/// **Example:**
49/// ~~~~~~~~~~~~~{.cpp}
50/// #include <kodi/gui/dialogs/ContextMenu.h>
51///
52/// const std::vector<std::string> entries
53/// {
54/// "Test 1",
55/// "Test 2",
56/// "Test 3",
57/// "Test 4",
58/// "Test 5"
59/// };
60///
61/// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
62/// if (selected < 0)
63/// fprintf(stderr, "Item selection canceled\n");
64/// else
65/// fprintf(stderr, "Selected item is: %i\n", selected);
66/// ~~~~~~~~~~~~~
67///
68inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
69 const std::vector<std::string>& entries)
70{
71 using namespace ::kodi::addon;
72 unsigned int size = static_cast<unsigned int>(entries.size());
73 const char** cEntries = static_cast<const char**>(malloc(size * sizeof(const char**)));
74 for (unsigned int i = 0; i < size; ++i)
75 {
76 cEntries[i] = entries[i].c_str();
77 }
78 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(
79 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size);
80 free(cEntries);
81 return ret;
82}
83//------------------------------------------------------------------------------
84
85//==============================================================================
86/// @ingroup cpp_kodi_gui_dialogs_ContextMenu
87/// @brief Show a context menu dialog about given parts.
88///
89/// @param[in] heading Dialog heading name
90/// @param[in] entries String list about entries
91/// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled
92///
93///
94///-------------------------------------------------------------------------
95///
96/// **Example:**
97/// ~~~~~~~~~~~~~{.cpp}
98/// #include <kodi/gui/dialogs/ContextMenu.h>
99///
100/// const std::vector<std::pair<std::string, std::string>> entries
101/// {
102/// { "ID 1", "Test 1" },
103/// { "ID 2", "Test 2" },
104/// { "ID 3", "Test 3" },
105/// { "ID 4", "Test 4" },
106/// { "ID 5", "Test 5" }
107/// };
108///
109/// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
110/// if (selected < 0)
111/// fprintf(stderr, "Item selection canceled\n");
112/// else
113/// fprintf(stderr, "Selected item is: %i\n", selected);
114/// ~~~~~~~~~~~~~
115///
116inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
117 const std::vector<std::pair<std::string, std::string>>& entries)
118{
119 using namespace ::kodi::addon;
120 unsigned int size = static_cast<unsigned int>(entries.size());
121 const char** cEntries = static_cast<const char**>(malloc(size * sizeof(const char**)));
122 for (unsigned int i = 0; i < size; ++i)
123 {
124 cEntries[i] = entries[i].second.c_str();
125 }
126 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(
127 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size);
128 free(cEntries);
129 return ret;
130}
131//------------------------------------------------------------------------------
132
133//==============================================================================
134/// @ingroup cpp_kodi_gui_dialogs_ContextMenu
135/// @brief Show a context menu dialog about given parts.
136///
137/// @param[in] heading Dialog heading name
138/// @param[in] entries String list about entries
139/// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled
140///
141///
142///-------------------------------------------------------------------------
143///
144/// **Example:**
145/// ~~~~~~~~~~~~~{.cpp}
146/// #include <kodi/gui/dialogs/ContextMenu.h>
147///
148/// const std::vector<std::pair<int, std::string>> entries
149/// {
150/// { 1, "Test 1" },
151/// { 2, "Test 2" },
152/// { 3, "Test 3" },
153/// { 4, "Test 4" },
154/// { 5, "Test 5" }
155/// };
156///
157/// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
158/// if (selected < 0)
159/// fprintf(stderr, "Item selection canceled\n");
160/// else
161/// fprintf(stderr, "Selected item is: %i\n", selected);
162/// ~~~~~~~~~~~~~
163///
164inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
165 const std::vector<std::pair<int, std::string>>& entries)
166{
167 using namespace ::kodi::addon;
168 unsigned int size = static_cast<unsigned int>(entries.size());
169 const char** cEntries = static_cast<const char**>(malloc(size * sizeof(const char**)));
170 for (unsigned int i = 0; i < size; ++i)
171 {
172 cEntries[i] = entries[i].second.c_str();
173 }
174 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(
175 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size);
176 free(cEntries);
177 return ret;
178}
179//------------------------------------------------------------------------------
180}; // namespace ContextMenu
181
182} /* namespace dialogs */
183} /* namespace gui */
184} /* namespace kodi */
185
186#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
new file mode 100644
index 0000000..c650483
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
@@ -0,0 +1,242 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/extended_progress.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_CExtendedProgress Dialog Extended Progress
25/// @ingroup cpp_kodi_gui_dialogs
26/// @brief @cpp_class{ kodi::gui::dialogs::ExtendedProgress }
27/// **Progress dialog shown for background work**
28///
29/// The with @ref ExtendedProgress.h "#include <kodi/gui/dialogs/ExtendedProgress.h>"
30/// given class are basically used to create Kodi's extended progress.
31///
32///
33/// --------------------------------------------------------------------------
34///
35/// **Example:**
36/// ~~~~~~~~~~~~~{.cpp}
37/// #include <kodi/gui/dialogs/ExtendedProgress.h>
38///
39/// kodi::gui::dialogs::CExtendedProgress *ext_progress = new kodi::gui::dialogs::CExtendedProgress("Test Extended progress");
40/// ext_progress->SetText("Test progress");
41/// for (unsigned int i = 0; i < 50; i += 10)
42/// {
43/// ext_progress->SetProgress(i, 100);
44/// sleep(1);
45/// }
46///
47/// ext_progress->SetTitle("Test Extended progress - Second round");
48/// ext_progress->SetText("Test progress - Step 2");
49///
50/// for (unsigned int i = 50; i < 100; i += 10)
51/// {
52/// ext_progress->SetProgress(i, 100);
53/// sleep(1);
54/// }
55/// delete ext_progress;
56/// ~~~~~~~~~~~~~
57///
58class ATTRIBUTE_HIDDEN CExtendedProgress
59{
60public:
61 //============================================================================
62 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
63 /// Construct a new dialog.
64 ///
65 /// @param[in] title [opt] Title string
66 ///
67 explicit CExtendedProgress(const std::string& title = "")
68 {
69 using namespace ::kodi::addon;
70 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog(
71 CAddonBase::m_interface->toKodi->kodiBase, title.c_str());
72 if (!m_DialogHandle)
73 kodi::Log(ADDON_LOG_FATAL,
74 "kodi::gui::CDialogExtendedProgress can't create window class from Kodi !!!");
75 }
76 //----------------------------------------------------------------------------
77
78 //============================================================================
79 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
80 /// Destructor.
81 ///
82 ~CExtendedProgress()
83 {
84 using namespace ::kodi::addon;
85 if (m_DialogHandle)
86 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->delete_dialog(
87 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
88 }
89 //----------------------------------------------------------------------------
90
91 //============================================================================
92 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
93 /// @brief Get the used title.
94 ///
95 /// @return Title string
96 ///
97 std::string Title() const
98 {
99 using namespace ::kodi::addon;
100 std::string text;
101 char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_title(
102 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
103 if (strMsg != nullptr)
104 {
105 if (std::strlen(strMsg))
106 text = strMsg;
107 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
108 strMsg);
109 }
110 return text;
111 }
112 //----------------------------------------------------------------------------
113
114 //============================================================================
115 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
116 /// @brief To set the title of dialog.
117 ///
118 /// @param[in] title Title string
119 ///
120 void SetTitle(const std::string& title)
121 {
122 using namespace ::kodi::addon;
123 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_title(
124 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, title.c_str());
125 }
126 //----------------------------------------------------------------------------
127
128 //============================================================================
129 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
130 /// @brief Get the used text information string.
131 ///
132 /// @return Text string
133 ///
134 std::string Text() const
135 {
136 using namespace ::kodi::addon;
137 std::string text;
138 char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_text(
139 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
140 if (strMsg != nullptr)
141 {
142 if (std::strlen(strMsg))
143 text = strMsg;
144 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
145 strMsg);
146 }
147 return text;
148 }
149 //----------------------------------------------------------------------------
150
151 //============================================================================
152 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
153 /// @brief To set the used text information string.
154 ///
155 /// @param[in] text Information text to set
156 ///
157 void SetText(const std::string& text)
158 {
159 using namespace ::kodi::addon;
160 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_text(
161 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, text.c_str());
162 }
163 //----------------------------------------------------------------------------
164
165 //============================================================================
166 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
167 /// @brief To ask dialog is finished.
168 ///
169 /// @return True if on end
170 ///
171 bool IsFinished() const
172 {
173 using namespace ::kodi::addon;
174 return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->is_finished(
175 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
176 }
177 //----------------------------------------------------------------------------
178
179 //============================================================================
180 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
181 /// @brief Mark progress finished.
182 ///
183 void MarkFinished()
184 {
185 using namespace ::kodi::addon;
186 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->mark_finished(
187 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
188 }
189 //----------------------------------------------------------------------------
190
191 //============================================================================
192 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
193 /// @brief Get the current progress position as percent.
194 ///
195 /// @return Position
196 ///
197 float Percentage() const
198 {
199 using namespace ::kodi::addon;
200 return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_percentage(
201 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
202 }
203 //----------------------------------------------------------------------------
204
205 //============================================================================
206 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
207 /// @brief To set the current progress position as percent.
208 ///
209 /// @param[in] percentage Position to use from 0.0 to 100.0
210 ///
211 void SetPercentage(float percentage)
212 {
213 using namespace ::kodi::addon;
214 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_percentage(
215 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage);
216 }
217 //----------------------------------------------------------------------------
218
219 //============================================================================
220 /// @ingroup cpp_kodi_gui_dialogs_CExtendedProgress
221 /// @brief To set progress position with predefined places.
222 ///
223 /// @param[in] currentItem Place position to use
224 /// @param[in] itemCount Amount of used places
225 ///
226 void SetProgress(int currentItem, int itemCount)
227 {
228 using namespace ::kodi::addon;
229 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_progress(
230 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, currentItem, itemCount);
231 }
232 //----------------------------------------------------------------------------
233
234private:
235 KODI_GUI_HANDLE m_DialogHandle;
236};
237
238} /* namespace dialogs */
239} /* namespace gui */
240} /* namespace kodi */
241
242#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/FileBrowser.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
new file mode 100644
index 0000000..244c76c
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
@@ -0,0 +1,302 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/filebrowser.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_FileBrowser Dialog File Browser
25/// @ingroup cpp_kodi_gui_dialogs
26/// @brief @cpp_namespace{ kodi::gui::dialogs::FileBrowser }
27/// **File browser dialog**\n
28/// The functions listed below of the class "FileBrowser" offer the possibility
29/// to select to a file by the user of the add-on.
30///
31/// It allows all the options that are possible in Kodi itself and offers all
32/// support file types.
33///
34/// It has the header @ref FileBrowser.h "#include <kodi/gui/dialogs/FileBrowser.h>"
35/// be included to enjoy it.
36///
37namespace FileBrowser
38{
39//==============================================================================
40/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
41/// @brief Directory selection dialog.
42///
43/// @param[in] shares With Shares becomes the available start folders be set
44/// @param[in] heading Dialog header name
45/// @param[in,out] path As in the path to start and return value about
46/// selected directory
47/// @param[in] writeOnly [opt] If set only writeable folders are shown
48/// @return False if selection becomes canceled
49///
50/// **Example:**
51/// ~~~~~~~~~~~~~{.cpp}
52/// #include <kodi/gui/dialogs/FileBrowser.h>
53///
54/// // Example show directory selection dialog with on 'share' (first value)
55/// // defined directory types.
56/// //
57/// // If this becomes leaved empty and 'directory' is empty goes it to the
58/// // base path of the hard disk.
59/// //
60/// // Also can be with path written to 'directory' before the dialog forced
61/// // to a start place.
62/// std::string directory;
63/// bool ret = kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory("local|network|removable",
64/// "Test directory selection",
65/// directory,
66/// false);
67/// fprintf(stderr, "Selected directory is : %s and was %s\n", directory.c_str(), ret ? "OK" : "Canceled");
68/// ~~~~~~~~~~~~~
69///
70inline bool ATTRIBUTE_HIDDEN ShowAndGetDirectory(const std::string& shares,
71 const std::string& heading,
72 std::string& path,
73 bool writeOnly = false)
74{
75 using namespace ::kodi::addon;
76 char* retString = nullptr;
77 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_directory(
78 CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), heading.c_str(), path.c_str(),
79 &retString, writeOnly);
80 if (retString != nullptr)
81 {
82 if (std::strlen(retString))
83 path = retString;
84 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
85 retString);
86 }
87 return ret;
88}
89//------------------------------------------------------------------------------
90
91//==============================================================================
92/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
93/// @brief File selection dialog.
94///
95/// @param[in] shares With Shares becomes the available start folders be set.
96/// @param[in] mask The mask to filter visible files, e.g. ".m3u|.pls|.b4s|.wpl"
97/// @param[in] heading Dialog header name
98/// @param[in,out] path As in the path to start and Return value about selected
99/// file
100/// @param[in] useThumbs [opt] If set show thumbs if possible on dialog
101/// @param[in] useFileDirectories [opt] If set also packages (e.g. *.zip) are
102/// handled as directories.
103/// @return False if selection becomes canceled
104///
105inline bool ATTRIBUTE_HIDDEN ShowAndGetFile(const std::string& shares,
106 const std::string& mask,
107 const std::string& heading,
108 std::string& path,
109 bool useThumbs = false,
110 bool useFileDirectories = false)
111{
112 using namespace ::kodi::addon;
113 char* retString = nullptr;
114 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file(
115 CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), mask.c_str(), heading.c_str(),
116 path.c_str(), &retString, useThumbs, useFileDirectories);
117 if (retString != nullptr)
118 {
119 if (std::strlen(retString))
120 path = retString;
121 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
122 retString);
123 }
124 return ret;
125}
126//------------------------------------------------------------------------------
127
128//==============================================================================
129/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
130/// @brief File selection from a directory.
131///
132/// @param[in] directory The directory name where the dialog start, possible are
133/// normal names and kodi's special names
134/// @param[in] mask The mask to filter visible files, e.g. ".m3u|.pls|.b4s|.wpl"
135/// @param[in] heading Dialog header name
136/// @param[in,out] path As in the path to start and Return value about selected
137/// file
138/// @param[in] useThumbs [opt] If set show thumbs if possible on dialog
139/// @param[in] useFileDirectories [opt] If set also packages (e.g. *.zip) are
140/// handled as directories
141/// @param[in] singleList [opt]
142/// @return False if selection becomes canceled
143///
144inline bool ATTRIBUTE_HIDDEN ShowAndGetFileFromDir(const std::string& directory,
145 const std::string& mask,
146 const std::string& heading,
147 std::string& path,
148 bool useThumbs = false,
149 bool useFileDirectories = false,
150 bool singleList = false)
151{
152 using namespace ::kodi::addon;
153 char* retString = nullptr;
154 bool ret =
155 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file_from_dir(
156 CAddonBase::m_interface->toKodi->kodiBase, directory.c_str(), mask.c_str(),
157 heading.c_str(), path.c_str(), &retString, useThumbs, useFileDirectories, singleList);
158 if (retString != nullptr)
159 {
160 if (std::strlen(retString))
161 path = retString;
162 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
163 retString);
164 }
165 return ret;
166}
167//------------------------------------------------------------------------------
168
169//==============================================================================
170/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
171/// @brief File selection dialog to get several in to a list.
172///
173/// @param[in] shares With Shares becomes the available start folders be set.
174/// @param[in] mask The mask to filter visible files, e.g. ".m3u|.pls|.b4s|.wpl"
175/// @param[in] heading Dialog header name
176/// @param[out] fileList Return value about selected files
177/// @param[in] useThumbs [opt] If set show thumbs if possible on dialog.
178/// @param[in] useFileDirectories [opt] If set also packages (e.g. *.zip) are
179/// handled as directories.
180/// @return False if selection becomes canceled.
181///
182inline bool ATTRIBUTE_HIDDEN ShowAndGetFileList(const std::string& shares,
183 const std::string& mask,
184 const std::string& heading,
185 std::vector<std::string>& fileList,
186 bool useThumbs = false,
187 bool useFileDirectories = false)
188{
189 using namespace ::kodi::addon;
190 char** list = nullptr;
191 unsigned int listSize = 0;
192 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file_list(
193 CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), mask.c_str(), heading.c_str(),
194 &list, &listSize, useThumbs, useFileDirectories);
195 if (ret)
196 {
197 for (unsigned int i = 0; i < listSize; ++i)
198 fileList.emplace_back(list[i]);
199 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(
200 CAddonBase::m_interface->toKodi->kodiBase, &list, listSize);
201 }
202 return ret;
203}
204//------------------------------------------------------------------------------
205
206//==============================================================================
207/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
208/// @brief Source selection dialog.
209///
210/// @param[in,out] path As in the path to start and Return value about selected
211/// source
212/// @param[in] allowNetworkShares Allow also access to network
213/// @param[in] additionalShare [opt] With additionalShare becomes the available
214/// start folders be set.
215/// @param[in] type [opt]
216/// @return False if selection becomes canceled
217///
218inline bool ATTRIBUTE_HIDDEN ShowAndGetSource(std::string& path,
219 bool allowNetworkShares,
220 const std::string& additionalShare = "",
221 const std::string& type = "")
222{
223 using namespace ::kodi::addon;
224 char* retString = nullptr;
225 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_source(
226 CAddonBase::m_interface->toKodi->kodiBase, path.c_str(), &retString, allowNetworkShares,
227 additionalShare.c_str(), type.c_str());
228 if (retString != nullptr)
229 {
230 if (std::strlen(retString))
231 path = retString;
232 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
233 retString);
234 }
235 return ret;
236}
237//------------------------------------------------------------------------------
238
239//==============================================================================
240/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
241/// @brief Image selection dialog.
242///
243/// @param[in] shares With Shares becomes the available start folders be set
244/// @param[in] heading Dialog header name
245/// @param[out] path Return value about selected image
246/// @return False if selection becomes canceled
247///
248inline bool ATTRIBUTE_HIDDEN ShowAndGetImage(const std::string& shares,
249 const std::string& heading,
250 std::string& path)
251{
252 using namespace ::kodi::addon;
253 char* retString = nullptr;
254 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_image(
255 CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), heading.c_str(), path.c_str(),
256 &retString);
257 if (retString != nullptr)
258 {
259 if (std::strlen(retString))
260 path = retString;
261 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
262 retString);
263 }
264 return ret;
265}
266//------------------------------------------------------------------------------
267
268//==============================================================================
269/// @ingroup cpp_kodi_gui_dialogs_FileBrowser
270/// @brief Image selection dialog to get several in to a list.
271///
272/// @param[in] shares With Shares becomes the available start folders be set
273/// @param[in] heading Dialog header name
274/// @param[out] file_list Return value about selected images
275/// @return False if selection becomes canceled
276///
277inline bool ATTRIBUTE_HIDDEN ShowAndGetImageList(const std::string& shares,
278 const std::string& heading,
279 std::vector<std::string>& file_list)
280{
281 using namespace ::kodi::addon;
282 char** list = nullptr;
283 unsigned int listSize = 0;
284 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_image_list(
285 CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), heading.c_str(), &list, &listSize);
286 if (ret)
287 {
288 for (unsigned int i = 0; i < listSize; ++i)
289 file_list.emplace_back(list[i]);
290 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(
291 CAddonBase::m_interface->toKodi->kodiBase, &list, listSize);
292 }
293 return ret;
294}
295//------------------------------------------------------------------------------
296}; // namespace FileBrowser
297
298} /* namespace dialogs */
299} /* namespace gui */
300} /* namespace kodi */
301
302#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Keyboard.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Keyboard.h
new file mode 100644
index 0000000..710b7dd
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Keyboard.h
@@ -0,0 +1,404 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/keyboard.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//================================================================================
24/// @defgroup cpp_kodi_gui_dialogs_Keyboard Dialog Keyboard
25/// @ingroup cpp_kodi_gui_dialogs
26/// @brief @cpp_namespace{ kodi::gui::dialogs::Keyboard }
27/// **Keyboard dialogs**\n
28/// The functions listed below have to be permitted by the user for the
29/// representation of a keyboard around an input.
30///
31/// The class supports several kinds, from an easy text choice up to the
32/// passport Word production and their confirmation for add-on.
33///
34/// It has the header @ref Keyboard.h "#include <kodi/gui/dialogs/Keyboard.h>"
35/// be included to enjoy it.
36///
37namespace Keyboard
38{
39//==============================================================================
40/// @ingroup cpp_kodi_gui_dialogs_Keyboard
41/// @brief Show keyboard with initial value `text` and replace with result
42/// string.
43///
44/// @param[in,out] text Overwritten with user input if return=true.
45/// @param[in] heading String shown on dialog title.
46/// @param[in] allowEmptyResult Whether a blank password is valid or not.
47/// @param[in] hiddenInput [opt] The inserted input is not shown as text.
48/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
49/// milliseconds, default is 0 which keeps the dialog
50/// open indefinitely.
51/// @return true if successful display and user input. false if unsuccessful
52/// display, no user input, or canceled editing.
53///
54///
55///-------------------------------------------------------------------------
56///
57/// **Example:**
58/// ~~~~~~~~~~~~~{.cpp}
59/// #include <kodi/gui/dialogs/Keyboard.h>
60///
61/// // The example shows the display of keyboard call dialog at Kodi from the add-on.
62/// // Below all values are set, however, can last two (hidden input = false and autoCloseMs = 0)
63/// // to be released if not needed.
64/// std::string text = "Please change me to them want you want"; // It can be leaved empty or a entry text added
65/// bool bRet = ::kodi::gui::dialogs::Keyboard::ShowAndGetInput(text,
66/// "Demonstration text entry",
67/// true,
68/// false,
69/// 0);
70/// fprintf(stderr, "Written keyboard input is : '%s' and was %s\n",
71/// text.c_str(), bRet ? "OK" : "Canceled");
72/// ~~~~~~~~~~~~~
73///
74inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text,
75 const std::string& heading,
76 bool allowEmptyResult,
77 bool hiddenInput = false,
78 unsigned int autoCloseMs = 0)
79{
80 using namespace ::kodi::addon;
81 char* retString = nullptr;
82 bool ret =
83 CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input_with_head(
84 CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, heading.c_str(),
85 allowEmptyResult, hiddenInput, autoCloseMs);
86 if (retString != nullptr)
87 {
88 text = retString;
89 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
90 retString);
91 }
92 return ret;
93}
94//------------------------------------------------------------------------------
95
96//==============================================================================
97/// @ingroup cpp_kodi_gui_dialogs_Keyboard
98/// @brief The example shows the display of keyboard call dialog at Kodi
99/// from the add-on.
100///
101/// @param[out] text Overwritten with user input if return=true.
102/// @param[in] allowEmptyResult If set to true keyboard can also exited without
103/// entered text.
104/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
105/// milliseconds, default is 0 which keeps the dialog
106/// open indefinitely.
107/// @return true if successful display and user input. false if unsuccessful
108/// display, no user input, or canceled editing.
109///
110inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text,
111 bool allowEmptyResult,
112 unsigned int autoCloseMs = 0)
113{
114 using namespace ::kodi::addon;
115 char* retString = nullptr;
116 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input(
117 CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, allowEmptyResult,
118 autoCloseMs);
119 if (retString != nullptr)
120 {
121 text = retString;
122 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
123 retString);
124 }
125 return ret;
126}
127//------------------------------------------------------------------------------
128
129//==============================================================================
130/// @ingroup cpp_kodi_gui_dialogs_Keyboard
131/// @brief Shows keyboard and prompts for a password. Differs from
132/// `ShowAndVerifyNewPassword()` in that no second verification.
133///
134/// @param[in,out] newPassword Overwritten with user input if return=true.
135/// @param[in] heading String shown on dialog title.
136/// @param[in] allowEmptyResult Whether a blank password is valid or not.
137/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
138/// milliseconds, default is 0 which keeps the dialog
139/// open indefinitely.
140/// @return true if successful display and user input. false if unsuccessful
141/// display, no user input, or canceled editing.
142///
143inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword,
144 const std::string& heading,
145 bool allowEmptyResult,
146 unsigned int autoCloseMs = 0)
147{
148 using namespace ::kodi::addon;
149 char* retString = nullptr;
150 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard
151 ->show_and_get_new_password_with_head(
152 CAddonBase::m_interface->toKodi->kodiBase, newPassword.c_str(), &retString,
153 heading.c_str(), allowEmptyResult, autoCloseMs);
154 if (retString != nullptr)
155 {
156 newPassword = retString;
157 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
158 retString);
159 }
160 return ret;
161}
162//------------------------------------------------------------------------------
163
164//==============================================================================
165/// @ingroup cpp_kodi_gui_dialogs_Keyboard
166/// @brief Shows keyboard and prompts for a password. Differs from
167/// `ShowAndVerifyNewPassword()` in that no second verification.
168///
169/// @param[in,out] newPassword Overwritten with user input if return=true.
170/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
171/// milliseconds, default is 0 which keeps the dialog
172/// open indefinitely.
173/// @return true if successful display and user input. false if unsuccessful
174/// display, no user input, or canceled editing.
175///
176inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword,
177 unsigned int autoCloseMs = 0)
178{
179 using namespace ::kodi::addon;
180 char* retString = nullptr;
181 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_new_password(
182 CAddonBase::m_interface->toKodi->kodiBase, newPassword.c_str(), &retString, autoCloseMs);
183 if (retString != nullptr)
184 {
185 newPassword = retString;
186 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
187 retString);
188 }
189 return ret;
190}
191//------------------------------------------------------------------------------
192
193//==============================================================================
194/// @ingroup cpp_kodi_gui_dialogs_Keyboard
195/// @brief Show keyboard twice to get and confirm a user-entered password
196/// string.
197///
198/// @param[out] newPassword Overwritten with user input if return=true.
199/// @param[in] heading String shown on dialog title.
200/// @param[in] allowEmptyResult
201/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
202/// milliseconds, default is 0 which keeps the dialog
203/// open indefinitely.
204/// @return true if successful display and user input. false if unsuccessful
205/// display, no user input, or canceled editing.
206///
207///
208///-------------------------------------------------------------------------
209///
210/// **Example:**
211/// ~~~~~~~~~~~~~{.cpp}
212/// #include <kodi/General.h>
213/// #include <kodi/gui/dialogs/Keyboard.h>
214///
215/// // The example below shows the complete use of keyboard dialog for password
216/// // check. If only one check from add-on needed can be function with retries
217/// // set to '0' called alone.
218/// //
219/// // The use of MD5 translated password is always required for the check on Kodi!
220///
221/// int maxretries = 3;
222/// // Password names need to be send as md5 sum to kodi.
223/// std::string password;
224/// kodi::GetMD5("kodi", password);
225///
226/// // To the loop about password checks.
227/// int ret;
228/// for (unsigned int i = 0; i < maxretries; i++)
229/// {
230/// // Ask the user about the password.
231/// ret = ::kodi::gui::dialogs::Keyboard::ShowAndVerifyPassword(password, "Demo password call for PW 'kodi'", i, 0);
232/// if (ret == 0)
233/// {
234/// fprintf(stderr, "Password successfull confirmed after '%i' tries\n", i+1);
235/// break;
236/// }
237/// else if (ret < 0)
238/// {
239/// fprintf(stderr, "Canceled editing on try '%i'\n", i+1);
240/// break;
241/// }
242/// else // if (ret > 0)
243/// {
244/// fprintf(stderr, "Wrong password entered on try '%i'\n", i+1);
245/// }
246/// }
247/// ~~~~~~~~~~~~~
248///
249inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword,
250 const std::string& heading,
251 bool allowEmptyResult,
252 unsigned int autoCloseMs = 0)
253{
254 using namespace ::kodi::addon;
255 char* retString = nullptr;
256 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard
257 ->show_and_verify_new_password_with_head(CAddonBase::m_interface->toKodi->kodiBase,
258 &retString, heading.c_str(),
259 allowEmptyResult, autoCloseMs);
260 if (retString != nullptr)
261 {
262 newPassword = retString;
263 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
264 retString);
265 }
266 return ret;
267}
268//------------------------------------------------------------------------------
269
270//==============================================================================
271/// @ingroup cpp_kodi_gui_dialogs_Keyboard
272/// @brief Show keyboard twice to get and confirm a user-entered password
273/// string.
274///
275/// @param[out] newPassword Overwritten with user input if return=true.
276/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
277/// milliseconds, default is 0 which keeps the dialog
278/// open indefinitely.
279/// @return true if successful display and user input. false if unsuccessful
280/// display, no user input, or canceled editing.
281///
282inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword,
283 unsigned int autoCloseMs = 0)
284{
285 using namespace ::kodi::addon;
286 char* retString = nullptr;
287 bool ret =
288 CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_new_password(
289 CAddonBase::m_interface->toKodi->kodiBase, &retString, autoCloseMs);
290 if (retString != nullptr)
291 {
292 newPassword = retString;
293 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
294 retString);
295 }
296 return ret;
297}
298//------------------------------------------------------------------------------
299
300//==============================================================================
301/// @ingroup cpp_kodi_gui_dialogs_Keyboard
302/// @brief Show keyboard and verify user input against `password`.
303///
304/// @param[in,out] password Value to compare against user input.
305/// @param[in] heading String shown on dialog title.
306/// @param[in] retries If greater than 0, shows "Incorrect password, %d retries
307/// left" on dialog line 2, else line 2 is blank.
308/// @param[in] autoCloseMs [opt] To close the dialog after a specified time, in
309/// milliseconds, default is 0 which keeps the dialog
310/// open indefinitely.
311/// @return 0 if successful display and user input. 1 if unsuccessful input.
312/// -1 if no user input or canceled editing.
313///
314inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(std::string& password,
315 const std::string& heading,
316 int retries,
317 unsigned int autoCloseMs = 0)
318{
319 using namespace ::kodi::addon;
320 char* retString = nullptr;
321 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_password(
322 CAddonBase::m_interface->toKodi->kodiBase, password.c_str(), &retString, heading.c_str(),
323 retries, autoCloseMs);
324 if (retString != nullptr)
325 {
326 password = retString;
327 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
328 retString);
329 }
330 return ret;
331}
332//------------------------------------------------------------------------------
333
334//==============================================================================
335/// @ingroup cpp_kodi_gui_dialogs_Keyboard
336/// @brief Shows a filter related keyboard.
337///
338/// @param[in,out] text Overwritten with user input if return=true.
339/// @param[in] searching Use dialog for search and send our search message in
340/// safe way (only the active window needs it)
341/// - header name if true is "Enter search string"
342/// - header name if false is "Enter value"
343/// @param autoCloseMs [opt] To close the dialog after a specified time, in
344/// milliseconds, default is 0 which keeps the dialog open
345/// indefinitely.
346/// @return true if successful display and user input. false if unsuccessful
347/// display, no user input, or canceled editing.
348///
349inline bool ATTRIBUTE_HIDDEN ShowAndGetFilter(std::string& text,
350 bool searching,
351 unsigned int autoCloseMs = 0)
352{
353 using namespace ::kodi::addon;
354 char* retString = nullptr;
355 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_filter(
356 CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, searching, autoCloseMs);
357 if (retString != nullptr)
358 {
359 text = retString;
360 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
361 retString);
362 }
363 return ret;
364}
365//------------------------------------------------------------------------------
366
367//==============================================================================
368/// @ingroup cpp_kodi_gui_dialogs_Keyboard
369/// @brief Send a text to a visible keyboard.
370///
371/// @param[in] text Overwritten with user input if return=true.
372/// @param[in] closeKeyboard [opt] The open dialog is if also closed on 'true'.
373/// @return true if successful done, false if unsuccessful or keyboard not
374/// present.
375///
376inline bool ATTRIBUTE_HIDDEN SendTextToActiveKeyboard(const std::string& text,
377 bool closeKeyboard = false)
378{
379 using namespace ::kodi::addon;
380 return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->send_text_to_active_keyboard(
381 CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), closeKeyboard);
382}
383//------------------------------------------------------------------------------
384
385//==============================================================================
386/// @ingroup cpp_kodi_gui_dialogs_Keyboard
387/// @brief Check for visible keyboard on GUI.
388///
389/// @return true if keyboard present, false if not present
390///
391inline bool ATTRIBUTE_HIDDEN IsKeyboardActivated()
392{
393 using namespace ::kodi::addon;
394 return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->is_keyboard_activated(
395 CAddonBase::m_interface->toKodi->kodiBase);
396}
397//------------------------------------------------------------------------------
398}; // namespace Keyboard
399
400} /* namespace dialogs */
401} /* namespace gui */
402} /* namespace kodi */
403
404#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Numeric.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Numeric.h
new file mode 100644
index 0000000..835a8d4
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Numeric.h
@@ -0,0 +1,346 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/numeric.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_Numeric Dialog Numeric
25/// @ingroup cpp_kodi_gui_dialogs
26/// @{
27/// @brief @cpp_namespace{ kodi::gui::dialogs::Numeric }
28/// **Numeric dialogs**\n
29/// The functions listed below have to be permitted by the user for the
30/// representation of a numeric keyboard around an input.
31///
32/// The class supports several kinds, from an easy number choice up to the
33/// passport Word production and their confirmation for add-on.
34///
35/// It has the header @ref Numeric.h "#include <kodi/gui/dialogs/Numeric.h>"
36/// be included to enjoy it.
37///
38namespace Numeric
39{
40//==============================================================================
41/// @ingroup cpp_kodi_gui_dialogs_Numeric
42/// @brief Use dialog to get numeric new password
43///
44/// @param[out] newPassword String to preload into the keyboard accumulator.
45/// Overwritten with user input if return=true.
46/// Returned in MD5 format.
47/// @return true if successful display and user input entry/re-entry. false if
48/// unsuccessful display, no user input, or canceled editing.
49///
50inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword)
51{
52 using namespace ::kodi::addon;
53 char* pw = nullptr;
54 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_new_password(
55 CAddonBase::m_interface->toKodi->kodiBase, &pw);
56 if (pw != nullptr)
57 {
58 newPassword = pw;
59 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, pw);
60 }
61 return ret;
62}
63//------------------------------------------------------------------------------
64
65//==============================================================================
66///
67/// @ingroup cpp_kodi_gui_dialogs_Numeric
68/// @brief Use dialog to verify numeric password.
69///
70/// @param[in] password Password to compare with user input, need
71/// in MD5 format.
72/// @param[in] heading Heading to display
73/// @param[in] retries If greater than 0, shows "Incorrect
74/// password, %d retries left" on dialog
75/// line 2, else line 2 is blank.
76/// @return Possible values:
77/// - 0 if successful display and user input.
78/// - 1 if unsuccessful input.
79/// - -1 if no user input or canceled editing.
80///
81///
82///-------------------------------------------------------------------------
83///
84/// **Example:**
85/// ~~~~~~~~~~~~~{.cpp}
86/// #include <stdio.h> // fprintf
87/// #include <kodi/General.h>
88/// #include <kodi/gui/dialogs/Numeric.h>
89///
90/// // The example below shows the complete use of keyboard dialog for password
91/// // check. If only one check from add-on needed can be function with retries
92/// // set to '0' called alone.
93/// //
94/// // The use of MD5 translated password is always required for the check on Kodi!
95///
96/// int maxretries = 3;
97///
98/// // Password names need to be send as md5 sum to kodi.
99/// std::string password = kodi::GetMD5("1234");
100///
101/// // To the loop about password checks.
102/// int ret;
103/// for (unsigned int i = 0; i < maxretries; i++)
104/// {
105/// // Ask the user about the password.
106/// ret = kodi::gui::dialogs::Numeric::ShowAndVerifyPassword(password, "Demo numeric password call for PW '1234'", i);
107/// if (ret == 0)
108/// {
109/// fprintf(stderr, "Numeric password successfull confirmed after '%i' tries\n", i+1);
110/// break;
111/// }
112/// else if (ret < 0)
113/// {
114/// fprintf(stderr, "Canceled editing on try '%i'\n", i+1);
115/// break;
116/// }
117/// else // if (ret > 0)
118/// {
119/// fprintf(stderr, "Wrong numeric password entered on try '%i'\n", i+1);
120/// }
121/// }
122/// ~~~~~~~~~~~~~
123///
124inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(const std::string& password,
125 const std::string& heading,
126 int retries)
127{
128 using namespace ::kodi::addon;
129 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_password(
130 CAddonBase::m_interface->toKodi->kodiBase, password.c_str(), heading.c_str(), retries);
131}
132//------------------------------------------------------------------------------
133
134//==============================================================================
135/// @ingroup cpp_kodi_gui_dialogs_Numeric
136/// @brief Use dialog to verify numeric password
137///
138/// @param[in,out] toVerify Value to compare against user input.
139/// @param[in] heading Heading to display
140/// @param[in] verifyInput If set as true we verify the users input versus
141/// toVerify.
142/// @return true if successful display and user input. false if unsuccessful
143/// display, no user input, or canceled editing.
144///
145inline bool ATTRIBUTE_HIDDEN ShowAndVerifyInput(std::string& toVerify,
146 const std::string& heading,
147 bool verifyInput)
148{
149 using namespace ::kodi::addon;
150 char* retString = nullptr;
151 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_input(
152 CAddonBase::m_interface->toKodi->kodiBase, toVerify.c_str(), &retString, heading.c_str(),
153 verifyInput);
154 if (retString != nullptr)
155 {
156 toVerify = retString;
157 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
158 retString);
159 }
160 return ret;
161}
162//------------------------------------------------------------------------------
163
164//==============================================================================
165/// @ingroup cpp_kodi_gui_dialogs_Numeric
166/// @brief Use dialog to get time value.
167///
168/// @param[out] time Overwritten with user input if return=true and time
169/// inserted.
170/// @param[in] heading Heading to display.
171/// @return true if successful display and user input. false if unsuccessful
172/// display, no user input, or canceled editing.
173///
174///
175///-------------------------------------------------------------------------
176///
177/// **Example:**
178/// ~~~~~~~~~~~~~{.cpp}
179/// #include <stdio.h> // printf
180/// #include <time.h> // time_t, struct tm, time, localtime, strftime
181/// #include <kodi/gui/dialogs/Numeric.h>
182///
183/// time_t rawtime;
184/// struct tm * timeinfo;
185/// char buffer [10];
186///
187/// time (&rawtime);
188/// timeinfo = localtime(&rawtime);
189/// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetTime(*timeinfo, "Selected time test call");
190/// strftime(buffer, sizeof(buffer), "%H:%M.", timeinfo);
191/// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled");
192/// ~~~~~~~~~~~~~
193///
194inline bool ATTRIBUTE_HIDDEN ShowAndGetTime(tm& time, const std::string& heading)
195{
196 using namespace ::kodi::addon;
197 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_time(
198 CAddonBase::m_interface->toKodi->kodiBase, &time, heading.c_str());
199}
200//------------------------------------------------------------------------------
201
202//==============================================================================
203/// @ingroup cpp_kodi_gui_dialogs_Numeric
204/// @brief Use dialog to get date value.
205///
206/// @param[in,out] date Overwritten with user input if return=true and date
207/// inserted.
208/// @param[in] heading Heading to display
209/// @return true if successful display and user input. false if unsuccessful
210/// display, no user input, or canceled editing.
211///
212///
213///-------------------------------------------------------------------------
214///
215/// **Example:**
216/// ~~~~~~~~~~~~~{.cpp}
217/// #include <stdio.h> // printf
218/// #include <time.h> // time_t, struct tm, time, localtime, strftime
219/// #include <kodi/gui/dialogs/Numeric.h>
220///
221/// time_t rawtime;
222/// struct tm * timeinfo;
223/// char buffer [20];
224///
225/// time (&rawtime);
226/// timeinfo = localtime(&rawtime);
227/// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetDate(*timeinfo, "Selected date test call");
228/// strftime(buffer, sizeof(buffer), "%Y-%m-%d", timeinfo);
229/// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled");
230/// ~~~~~~~~~~~~~
231///
232inline bool ATTRIBUTE_HIDDEN ShowAndGetDate(tm& date, const std::string& heading)
233{
234 using namespace ::kodi::addon;
235 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_date(
236 CAddonBase::m_interface->toKodi->kodiBase, &date, heading.c_str());
237}
238//------------------------------------------------------------------------------
239
240//==============================================================================
241/// @ingroup cpp_kodi_gui_dialogs_Numeric
242/// @brief Use dialog to get a IP
243///
244/// @param[in,out] ipAddress Overwritten with user input if return=true and
245/// IP address inserted.
246/// @param[in] heading Heading to display.
247/// @return true if successful display and user input. false if unsuccessful
248/// display, no user input, or canceled editing.
249///
250inline bool ATTRIBUTE_HIDDEN ShowAndGetIPAddress(std::string& ipAddress, const std::string& heading)
251{
252 using namespace ::kodi::addon;
253 char* retString = nullptr;
254 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_ip_address(
255 CAddonBase::m_interface->toKodi->kodiBase, ipAddress.c_str(), &retString, heading.c_str());
256 if (retString != nullptr)
257 {
258 ipAddress = retString;
259 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
260 retString);
261 }
262 return ret;
263}
264//------------------------------------------------------------------------------
265
266//==============================================================================
267/// @ingroup cpp_kodi_gui_dialogs_Numeric
268/// @brief Use dialog to get normal number.
269///
270/// @param[in,out] input Overwritten with user input if return=true and time
271/// in seconds inserted
272/// @param[in] heading Heading to display
273/// @param[in] autoCloseTimeoutMs [opt] To close the dialog after a specified
274/// time, in milliseconds, default is 0
275/// which keeps the dialog open
276/// indefinitely.
277/// @return true if successful display and user input. false if unsuccessful
278/// display, no user input, or canceled editing.
279///
280///
281///-------------------------------------------------------------------------
282///
283/// **Example:**
284/// ~~~~~~~~~~~~~{.cpp}
285/// #include <stdio.h> // printf
286/// #include <stdlib.h> // strtoull (C++11)
287/// #include <kodi/gui/dialogs/Numeric.h>
288///
289/// std::string number;
290/// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetNumber(number, "Number test call");
291/// printf("Written number input is : %llu and was %s\n",
292/// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled");
293/// ~~~~~~~~~~~~~
294///
295inline bool ATTRIBUTE_HIDDEN ShowAndGetNumber(std::string& input,
296 const std::string& heading,
297 unsigned int autoCloseTimeoutMs = 0)
298{
299 using namespace ::kodi::addon;
300 char* retString = nullptr;
301 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_number(
302 CAddonBase::m_interface->toKodi->kodiBase, input.c_str(), &retString, heading.c_str(),
303 autoCloseTimeoutMs);
304 if (retString != nullptr)
305 {
306 input = retString;
307 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
308 retString);
309 }
310 return ret;
311}
312//------------------------------------------------------------------------------
313
314//==============================================================================
315/// @ingroup cpp_kodi_gui_dialogs_Numeric
316/// @brief Show numeric keypad to get seconds.
317///
318/// @param[in,out] time Overwritten with user input if return=true and time
319/// in seconds inserted.
320/// @param[in] heading Heading to display
321/// @return true if successful display and user input. false if unsuccessful
322/// display, no user input, or canceled editing.
323///
324inline bool ATTRIBUTE_HIDDEN ShowAndGetSeconds(std::string& time, const std::string& heading)
325{
326 using namespace ::kodi::addon;
327 char* retString = nullptr;
328 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_seconds(
329 CAddonBase::m_interface->toKodi->kodiBase, time.c_str(), &retString, heading.c_str());
330 if (retString != nullptr)
331 {
332 time = retString;
333 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
334 retString);
335 }
336 return ret;
337}
338//------------------------------------------------------------------------------
339}; // namespace Numeric
340/// @}
341
342} /* namespace dialogs */
343} /* namespace gui */
344} /* namespace kodi */
345
346#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/OK.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/OK.h
new file mode 100644
index 0000000..747ab9d
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/OK.h
@@ -0,0 +1,101 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/ok.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_OK Dialog OK
25/// @ingroup cpp_kodi_gui_dialogs
26/// @{
27/// @brief @cpp_namespace{ kodi::gui::dialogs::OK }
28/// **OK dialog**\n
29/// The functions listed below permit the call of a dialogue of information, a
30/// confirmation of the user by press from OK required.
31///
32/// It has the header @ref OK.h "#include <kodi/gui/dialogs/OK.h>"
33/// be included to enjoy it.
34///
35namespace OK
36{
37//==============================================================================
38/// @ingroup cpp_kodi_gui_dialogs_OK
39/// @brief Use dialog to inform user with text and confirmation with OK with
40/// continued string.
41///
42/// @param[in] heading Dialog heading.
43/// @param[in] text Multi-line text.
44///
45///
46///-------------------------------------------------------------------------
47///
48/// **Example:**
49/// ~~~~~~~~~~~~~{.cpp}
50/// #include <kodi/gui/dialogs/OK.h>
51/// ...
52/// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D");
53/// ~~~~~~~~~~~~~
54///
55inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, const std::string& text)
56{
57 using namespace ::kodi::addon;
58 CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_single_text(
59 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str());
60}
61//------------------------------------------------------------------------------
62
63//==============================================================================
64/// @ingroup cpp_kodi_gui_dialogs_OK
65/// @brief Use dialog to inform user with text and confirmation with OK with
66/// strings separated to the lines.
67///
68/// @param[in] heading Dialog heading.
69/// @param[in] line0 Line #1 text.
70/// @param[in] line1 Line #2 text.
71/// @param[in] line2 Line #3 text.
72///
73///
74///-------------------------------------------------------------------------
75///
76/// **Example:**
77/// ~~~~~~~~~~~~~{.cpp}
78/// #include <kodi/gui/dialogs/OK.h>
79/// ...
80/// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D");
81/// ~~~~~~~~~~~~~
82///
83inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
84 const std::string& line0,
85 const std::string& line1,
86 const std::string& line2)
87{
88 using namespace ::kodi::addon;
89 CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_line_text(
90 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), line0.c_str(), line1.c_str(),
91 line2.c_str());
92}
93//------------------------------------------------------------------------------
94} // namespace OK
95/// @}
96
97} /* namespace dialogs */
98} /* namespace gui */
99} /* namespace kodi */
100
101#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Progress.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Progress.h
new file mode 100644
index 0000000..d242a56
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Progress.h
@@ -0,0 +1,244 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/progress.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_CProgress Dialog Progress
25/// @ingroup cpp_kodi_gui_dialogs
26/// @brief @cpp_class{ kodi::gui::dialogs::CProgress }
27/// **Progress dialog shown in center**\n
28/// The with @ref Progress.h "#include <kodi/gui/dialogs/Progress.h>"
29/// given class are basically used to create Kodi's progress dialog with named
30/// text fields.
31///
32/// **Example:**
33/// ~~~~~~~~~~~~~{.cpp}
34/// #include <kodi/gui/dialogs/Progress.h>
35///
36/// kodi::gui::dialogs::CProgress *progress = new kodi::gui::dialogs::CProgress;
37/// progress->SetHeading("Test progress");
38/// progress->SetLine(1, "line 1");
39/// progress->SetLine(2, "line 2");
40/// progress->SetLine(3, "line 3");
41/// progress->SetCanCancel(true);
42/// progress->ShowProgressBar(true);
43/// progress->Open();
44/// for (unsigned int i = 0; i < 100; i += 10)
45/// {
46/// progress->SetPercentage(i);
47/// sleep(1);
48/// }
49/// delete progress;
50/// ~~~~~~~~~~~~~
51///
52class ATTRIBUTE_HIDDEN CProgress
53{
54public:
55 //============================================================================
56 /// @ingroup cpp_kodi_gui_dialogs_CProgress
57 /// @brief Construct a new dialog
58 ///
59 CProgress()
60 {
61 using namespace ::kodi::addon;
62 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog(
63 CAddonBase::m_interface->toKodi->kodiBase);
64 if (!m_DialogHandle)
65 kodi::Log(ADDON_LOG_FATAL,
66 "kodi::gui::dialogs::CProgress can't create window class from Kodi !!!");
67 }
68 //----------------------------------------------------------------------------
69
70 //============================================================================
71 /// @ingroup cpp_kodi_gui_dialogs_CProgress
72 /// @brief Destructor
73 ///
74 ~CProgress()
75 {
76 using namespace ::kodi::addon;
77 if (m_DialogHandle)
78 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->delete_dialog(
79 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
80 }
81 //----------------------------------------------------------------------------
82
83 //============================================================================
84 /// @ingroup cpp_kodi_gui_dialogs_CProgress
85 /// @brief To open the dialog
86 ///
87 void Open()
88 {
89 using namespace ::kodi::addon;
90 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->open(
91 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
92 }
93 //----------------------------------------------------------------------------
94
95 //============================================================================
96 /// @ingroup cpp_kodi_gui_dialogs_CProgress
97 /// @brief Set the heading title of dialog
98 ///
99 /// @param[in] heading Title string to use
100 ///
101 void SetHeading(const std::string& heading)
102 {
103 using namespace ::kodi::addon;
104 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_heading(
105 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, heading.c_str());
106 }
107 //----------------------------------------------------------------------------
108
109 //============================================================================
110 /// @ingroup cpp_kodi_gui_dialogs_CProgress
111 /// @brief To set the line text field on dialog from 0 - 2
112 ///
113 /// @param[in] iLine Line number
114 /// @param[in] line Text string
115 ///
116 void SetLine(unsigned int iLine, const std::string& line)
117 {
118 using namespace ::kodi::addon;
119 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_line(
120 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, iLine, line.c_str());
121 }
122 //----------------------------------------------------------------------------
123
124 //============================================================================
125 /// @ingroup cpp_kodi_gui_dialogs_CProgress
126 /// @brief To enable and show cancel button on dialog
127 ///
128 /// @param[in] canCancel if true becomes it shown
129 ///
130 void SetCanCancel(bool canCancel)
131 {
132 using namespace ::kodi::addon;
133 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_can_cancel(
134 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, canCancel);
135 }
136 //----------------------------------------------------------------------------
137
138 //============================================================================
139 /// @ingroup cpp_kodi_gui_dialogs_CProgress
140 /// @brief To check dialog for clicked cancel button
141 ///
142 /// @return True if canceled
143 ///
144 bool IsCanceled() const
145 {
146 using namespace ::kodi::addon;
147 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->is_canceled(
148 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
149 }
150 //----------------------------------------------------------------------------
151
152 //============================================================================
153 /// @ingroup cpp_kodi_gui_dialogs_CProgress
154 /// @brief Get the current progress position as percent
155 ///
156 /// @param[in] percentage Position to use from 0 to 100
157 ///
158 void SetPercentage(int percentage)
159 {
160 using namespace ::kodi::addon;
161 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_percentage(
162 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage);
163 }
164 //----------------------------------------------------------------------------
165
166 //============================================================================
167 /// @ingroup cpp_kodi_gui_dialogs_CProgress
168 /// @brief To set the current progress position as percent
169 ///
170 /// @return Current Position used from 0 to 100
171 ///
172 int GetPercentage() const
173 {
174 using namespace ::kodi::addon;
175 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->get_percentage(
176 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
177 }
178 //----------------------------------------------------------------------------
179
180 //============================================================================
181 /// @ingroup cpp_kodi_gui_dialogs_CProgress
182 /// @brief To show or hide progress bar dialog
183 ///
184 /// @param[in] onOff If true becomes it shown
185 ///
186 void ShowProgressBar(bool onOff)
187 {
188 using namespace ::kodi::addon;
189 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->show_progress_bar(
190 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, onOff);
191 }
192 //----------------------------------------------------------------------------
193
194 //============================================================================
195 /// @ingroup cpp_kodi_gui_dialogs_CProgress
196 /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used
197 ///
198 /// @param[in] max Biggest usable position to use
199 ///
200 void SetProgressMax(int max)
201 {
202 using namespace ::kodi::addon;
203 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_max(
204 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, max);
205 }
206 //----------------------------------------------------------------------------
207
208 //============================================================================
209 /// @ingroup cpp_kodi_gui_dialogs_CProgress
210 /// @brief To increase progress bar by defined step size until reach of maximum position
211 ///
212 /// @param[in] steps Step size to increase, default is 1
213 ///
214 void SetProgressAdvance(int steps = 1)
215 {
216 using namespace ::kodi::addon;
217 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_advance(
218 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, steps);
219 }
220 //----------------------------------------------------------------------------
221
222 //============================================================================
223 /// @ingroup cpp_kodi_gui_dialogs_CProgress
224 /// @brief To check progress was canceled on work
225 ///
226 /// @return True if aborted
227 ///
228 bool Abort()
229 {
230 using namespace ::kodi::addon;
231 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->abort(
232 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
233 }
234 //----------------------------------------------------------------------------
235
236private:
237 KODI_GUI_HANDLE m_DialogHandle;
238};
239
240} /* namespace dialogs */
241} /* namespace gui */
242} /* namespace kodi */
243
244#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Select.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Select.h
new file mode 100644
index 0000000..9b1923e
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/Select.h
@@ -0,0 +1,269 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/select.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_Select_Defs Definitions, structures and enumerators
25/// @ingroup cpp_kodi_gui_dialogs_Select
26/// @brief **Dialog Select definition values**\n
27/// Data structures associated with this dialog.
28///
29//------------------------------------------------------------------------------
30
31//==============================================================================
32/// @ingroup cpp_kodi_gui_dialogs_Select_Defs
33/// @brief **Selection entry structure**\n
34/// Used to provide the necessary data for the selection dialog and to declare
35/// the selected position in it.
36///
37typedef struct SSelectionEntry
38{
39 /*! \cond PRIVATE */
40 SSelectionEntry() = default;
41 /*! \endcond */
42
43 /// Entry identfication string
44 std::string id;
45
46 /// Entry name to show on GUI dialog
47 std::string name;
48
49 /// Place where entry can be preselected and after return the from user
50 /// selected is set.
51 bool selected = false;
52} SSelectionEntry;
53//------------------------------------------------------------------------------
54
55//==============================================================================
56/// @defgroup cpp_kodi_gui_dialogs_Select Dialog Select
57/// @ingroup cpp_kodi_gui_dialogs
58/// @{
59/// @brief @cpp_namespace{ kodi::gui::dialogs::Select }
60/// **Selection dialog**\n
61/// The function listed below permits the call of a dialogue to select of an
62/// entry as a key
63///
64/// It has the header @ref Select.h "#include <kodi/gui/dialogs/Select.h>"
65/// be included to enjoy it.
66///
67///
68namespace Select
69{
70//==============================================================================
71/// @ingroup cpp_kodi_gui_dialogs_Select
72/// @brief Show a selection dialog about given parts.
73///
74/// @param[in] heading Dialog heading name
75/// @param[in] entries String list about entries
76/// @param[in] selected [opt] Predefined selection (default is <tt>-1</tt> for
77/// the first)
78/// @param[in] autoclose [opt] To close dialog automatic after the given time
79/// in ms. As '0' it stays open.
80/// @return The selected entry, if return <tt>-1</tt> was nothing selected or
81/// canceled
82///
83///
84///-------------------------------------------------------------------------
85///
86/// **Example:**
87/// ~~~~~~~~~~~~~{.cpp}
88/// #include <kodi/gui/dialogs/Select.h>
89///
90/// const std::vector<std::string> entries
91/// {
92/// "Test 1",
93/// "Test 2",
94/// "Test 3",
95/// "Test 4",
96/// "Test 5"
97/// };
98///
99/// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1);
100/// if (selected < 0)
101/// fprintf(stderr, "Item selection canceled\n");
102/// else
103/// fprintf(stderr, "Selected item is: %i\n", selected);
104/// ~~~~~~~~~~~~~
105///
106inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
107 const std::vector<std::string>& entries,
108 int selected = -1,
109 unsigned int autoclose = 0)
110{
111 using namespace ::kodi::addon;
112 unsigned int size = static_cast<unsigned int>(entries.size());
113 const char** cEntries = (const char**)malloc(size * sizeof(const char**));
114 for (unsigned int i = 0; i < size; ++i)
115 {
116 cEntries[i] = entries[i].c_str();
117 }
118 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open(
119 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size, selected,
120 autoclose);
121 free(cEntries);
122 return ret;
123}
124//------------------------------------------------------------------------------
125
126//==============================================================================
127/// @ingroup cpp_kodi_gui_dialogs_Select
128/// @brief Show a selection dialog about given parts.
129///
130/// This function is mostly equal to the other, only becomes the string list
131/// here done by a @ref SSelectionEntry, where a ID string can be defined.
132///
133/// @param[in] heading Dialog heading name
134/// @param[in] entries @ref SSelectionEntry list about entries
135/// @param[in] selected [opt] Predefined selection (default is <tt>-1</tt> for
136/// the first)
137/// @param[in] autoclose [opt] To close dialog automatic after the given time
138/// in ms. As '0' it stays open.
139/// @return The selected entry, if return <tt>-1</tt> was nothing selected
140/// or canceled
141///
142///
143///-------------------------------------------------------------------------
144///
145/// **Example:**
146/// ~~~~~~~~~~~~~{.cpp}
147/// #include <kodi/gui/dialogs/Select.h>
148///
149/// std::vector<kodi::gui::dialogs::SSelectionEntry> entries
150/// {
151/// { "ID 1", "Test 1", false },
152/// { "ID 2", "Test 2", false },
153/// { "ID 3", "Test 3", false },
154/// { "ID 4", "Test 4", false },
155/// { "ID 5", "Test 5", false }
156/// };
157///
158/// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1);
159/// if (selected < 0)
160/// fprintf(stderr, "Item selection canceled\n");
161/// else
162/// fprintf(stderr, "Selected item is: %i\n", selected);
163/// ~~~~~~~~~~~~~
164///
165inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
166 std::vector<kodi::gui::dialogs::SSelectionEntry>& entries,
167 int selected = -1,
168 unsigned int autoclose = 0)
169{
170 using namespace ::kodi::addon;
171 unsigned int size = static_cast<unsigned int>(entries.size());
172 const char** cEntries = static_cast<const char**>(malloc(size * sizeof(const char*)));
173 for (unsigned int i = 0; i < size; ++i)
174 {
175 cEntries[i] = entries[i].name.c_str();
176 if (selected == -1 && entries[i].selected)
177 selected = i;
178 }
179 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open(
180 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size, selected,
181 autoclose);
182 if (ret >= 0)
183 {
184 entries[ret].selected = true;
185 }
186 free(cEntries);
187 return ret;
188}
189//------------------------------------------------------------------------------
190
191//==============================================================================
192/// @ingroup cpp_kodi_gui_dialogs_Select
193/// @brief Show a multiple selection dialog about given parts.
194///
195/// @param[in] heading Dialog heading name
196/// @param[in] entries @ref SSelectionEntry list about entries
197/// @param[in] autoclose [opt] To close dialog automatic after the given time in
198/// ms. As '0' it stays open.
199/// @return The selected entries, if return <tt>empty</tt> was nothing selected
200/// or canceled
201///
202/// With selected on @ref SSelectionEntry can be a pre selection defined.
203///
204///-------------------------------------------------------------------------
205///
206/// **Example:**
207/// ~~~~~~~~~~~~~{.cpp}
208/// #include <kodi/gui/dialogs/Select.h>
209///
210/// std::vector<kodi::gui::dialogs::SSelectionEntry> entries
211/// {
212/// { "ID 1", "Test 1", false },
213/// { "ID 2", "Test 2", false },
214/// { "ID 3", "Test 3", false },
215/// { "ID 4", "Test 4", false },
216/// { "ID 5", "Test 5", false }
217/// };
218///
219/// bool ret = kodi::gui::dialogs::Select::ShowMultiSelect("Test selection", entries);
220/// if (!ret)
221/// fprintf(stderr, "Selection canceled\n");
222/// else
223/// {
224/// fprintf(stderr, "Selected items:\n");
225/// for (const auto& entry : entries)
226/// {
227/// if (entry.selected)
228/// fprintf(stderr, " - %s\n", entry.selected.id.c_str());
229/// }
230/// }
231/// ~~~~~~~~~~~~~
232///
233inline bool ATTRIBUTE_HIDDEN ShowMultiSelect(const std::string& heading,
234 std::vector<kodi::gui::dialogs::SSelectionEntry>& entries,
235 int autoclose = 0)
236{
237 using namespace ::kodi::addon;
238 unsigned int size = static_cast<unsigned int>(entries.size());
239 const char** cEntryIDs = static_cast<const char**>(malloc(size * sizeof(const char*)));
240 const char** cEntryNames = static_cast<const char**>(malloc(size * sizeof(const char*)));
241 bool* cEntriesSelected = static_cast<bool*>(malloc(size * sizeof(bool)));
242 for (unsigned int i = 0; i < size; ++i)
243 {
244 cEntryIDs[i] = entries[i].id.c_str();
245 cEntryNames[i] = entries[i].name.c_str();
246 cEntriesSelected[i] = entries[i].selected;
247 }
248 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open_multi_select(
249 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntryIDs, cEntryNames,
250 cEntriesSelected, size, autoclose);
251 if (ret)
252 {
253 for (unsigned int i = 0; i < size; ++i)
254 entries[i].selected = cEntriesSelected[i];
255 }
256 free(cEntryNames);
257 free(cEntryIDs);
258 free(cEntriesSelected);
259 return ret;
260}
261//------------------------------------------------------------------------------
262}; // namespace Select
263/// @}
264
265} /* namespace dialogs */
266} /* namespace gui */
267} /* namespace kodi */
268
269#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/TextViewer.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/TextViewer.h
new file mode 100644
index 0000000..42a86f3
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/TextViewer.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright (C) 2015-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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/text_viewer.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_TextViewer Dialog Text Viewer
25/// @ingroup cpp_kodi_gui_dialogs
26/// @{
27/// @brief @cpp_namespace{ kodi::gui::dialogs::TextViewer }
28/// **Text viewer dialog**\n
29/// The text viewer dialog can be used to display descriptions, help texts or
30/// other larger texts.
31///
32/// In order to achieve a line break is a <b>\\n</b> directly in the text or
33/// in the <em>"./resources/language/resource.language.??_??/strings.po"</em>
34/// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>.
35///
36/// It has the header \ref TextViewer.h "#include <kodi/gui/dialogs/TextViewer.h>"
37/// be included to enjoy it.
38///
39namespace TextViewer
40{
41//==============================================================================
42/// @ingroup cpp_kodi_gui_dialogs_TextViewer
43/// @brief Show info text dialog
44///
45/// @param[in] heading mall heading text
46/// @param[in] text Showed text on dialog
47///
48///
49///-------------------------------------------------------------------------
50///
51/// **Example:**
52/// ~~~~~~~~~~~~~{.cpp}
53/// #include <kodi/gui/dialogs/TextViewer.h>
54///
55/// kodi::gui::dialogs::TextViewer::Show("The Wizard of Oz (1939 film)",
56/// "The Wizard of Oz is a 1939 American musical comedy-drama fantasy film "
57/// "produced by Metro-Goldwyn-Mayer, and the most well-known and commercially "
58/// "successful adaptation based on the 1900 novel The Wonderful Wizard of Oz "
59/// "by L. Frank Baum. The film stars Judy Garland as Dorothy Gale. The film"
60/// "co-stars Terry the dog, billed as Toto; Ray Bolger, Jack Haley, Bert Lahr, "
61/// "Frank Morgan, Billie Burke, Margaret Hamilton, with Charley Grapewin and "
62/// "Clara Blandick, and the Singer Midgets as the Munchkins.\n"
63/// "\n"
64/// "Notable for its use of Technicolor, fantasy storytelling, musical score and "
65/// "unusual characters, over the years it has become an icon of American popular "
66/// "culture. It was nominated for six Academy Awards, including Best Picture but "
67/// "lost to Gone with the Wind. It did win in two other categories including Best "
68/// "Original Song for \"Over the Rainbow\". However, the film was a box office "
69/// "disappointment on its initial release, earning only $3,017,000 on a $2,777,000 "
70/// "budget, despite receiving largely positive reviews. It was MGM's most "
71/// "expensive production at that time, and did not completely recoup the studio's "
72/// "investment and turn a profit until theatrical re-releases starting in 1949.\n"
73/// "\n"
74/// "The 1956 broadcast television premiere of the film on CBS re-introduced the "
75/// "film to the wider public and eventually made the presentation an annual "
76/// "tradition, making it one of the most known films in cinema history. The "
77/// "film was named the most-viewed motion picture on television syndication by "
78/// "the Library of Congress who also included the film in its National Film "
79/// "Registry in its inaugural year in 1989. Designation on the registry calls "
80/// "for efforts to preserve it for being \"culturally, historically, and "
81/// "aesthetically significant\". It is also one of the few films on UNESCO's "
82/// "Memory of the World Register.\n"
83/// "\n"
84/// "The Wizard of Oz is often ranked on best-movie lists in critics' and public "
85/// "polls. It is the source of many quotes referenced in modern popular culture. "
86/// "It was directed primarily by Victor Fleming (who left production to take "
87/// "over direction on the troubled Gone with the Wind production). Noel Langley, "
88/// "Florence Ryerson and Edgar Allan Woolf received credit for the screenplay, "
89/// "but there were uncredited contributions by others. The songs were written "
90/// "by Edgar \"Yip\" Harburg (lyrics) and Harold Arlen (music). The incidental "
91/// "music, based largely on the songs, was composed by Herbert Stothart, with "
92/// "interspersed renderings from classical composers.\n");
93/// ~~~~~~~~~~~~~
94///
95inline void ATTRIBUTE_HIDDEN Show(const std::string& heading, const std::string& text)
96{
97 using namespace ::kodi::addon;
98 CAddonBase::m_interface->toKodi->kodi_gui->dialogTextViewer->open(
99 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str());
100}
101//------------------------------------------------------------------------------
102}; // namespace TextViewer
103/// @}
104
105} /* namespace dialogs */
106} /* namespace gui */
107} /* namespace kodi */
108
109#endif /* __cplusplus */
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/YesNo.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/YesNo.h
new file mode 100644
index 0000000..6e6e069
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs/YesNo.h
@@ -0,0 +1,188 @@
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 "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/yes_no.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_dialogs_YesNo Dialog Yes/No
25/// @ingroup cpp_kodi_gui_dialogs
26/// @{
27/// @brief @cpp_namespace{ kodi::gui::dialogs::YesNo }
28/// **Yes / No dialog**\n
29/// The Yes / No dialog can be used to inform the user about questions and get
30/// the answer.
31///
32/// In order to achieve a line break is a <b>\\n</b> directly in the text or
33/// in the <em>"./resources/language/resource.language.??_??/strings.po"</em>
34/// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>.
35///
36/// It has the header @ref YesNo.h "#include <kodi/gui/dialogs/YesNo.h>"
37/// be included to enjoy it.
38///
39namespace YesNo
40{
41//==============================================================================
42/// @ingroup cpp_kodi_gui_dialogs_YesNo
43/// @brief Use dialog to get numeric new password with one text string shown
44/// everywhere and cancel return field.
45///
46/// @param[in] heading Dialog heading
47/// @param[in] text Multi-line text
48/// @param[out] canceled Return value about cancel button
49/// @param[in] noLabel [opt] label to put on the no button
50/// @param[in] yesLabel [opt] label to put on the yes button
51/// @return Returns True if 'Yes' was pressed, else False
52///
53/// @note It is preferred to only use this as it is actually a multi-line text.
54///
55///
56///-------------------------------------------------------------------------
57///
58/// **Example:**
59/// ~~~~~~~~~~~~~{.cpp}
60/// #include <kodi/gui/dialogs/YesNo.h>
61///
62/// bool canceled = false;
63/// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(
64/// "Yes / No test call", // The Header
65/// "You has opened Yes / No dialog for test\n\nIs this OK for you?",
66/// canceled, // return value about cancel button
67/// "Not really", // No label, is optional and if empty "No"
68/// "Ohhh yes"); // Yes label, also optional and if empty "Yes"
69/// fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n",
70/// ret ? "yes" : "no",
71/// canceled ? "canceled" : "not canceled");
72/// ~~~~~~~~~~~~~
73///
74inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
75 const std::string& text,
76 bool& canceled,
77 const std::string& noLabel = "",
78 const std::string& yesLabel = "")
79{
80 using namespace ::kodi::addon;
81 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_single_text(
82 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str(), &canceled,
83 noLabel.c_str(), yesLabel.c_str());
84}
85//------------------------------------------------------------------------------
86
87//==============================================================================
88/// @ingroup cpp_kodi_gui_dialogs_YesNo
89/// @brief Use dialog to get numeric new password with separated line strings.
90///
91/// @param[in] heading Dialog heading
92/// @param[in] line0 Line #0 text
93/// @param[in] line1 Line #1 text
94/// @param[in] line2 Line #2 text
95/// @param[in] noLabel [opt] label to put on the no button
96/// @param[in] yesLabel [opt] label to put on the yes button
97/// @return Returns True if 'Yes' was pressed, else False
98///
99///
100///-------------------------------------------------------------------------
101///
102/// **Example:**
103/// ~~~~~~~~~~~~~{.cpp}
104/// #include <kodi/gui/dialogs/YesNo.h>
105///
106/// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(
107/// "Yes / No test call", // The Header
108/// "You has opened Yes / No dialog for test",
109/// "",
110/// "Is this OK for you?",
111/// "Not really", // No label, is optional and if empty "No"
112/// "Ohhh yes"); // Yes label, also optional and if empty "Yes"
113/// fprintf(stderr, "You has called Yes/No, returned '%s'\n",
114/// ret ? "yes" : "no");
115/// ~~~~~~~~~~~~~
116///
117inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
118 const std::string& line0,
119 const std::string& line1,
120 const std::string& line2,
121 const std::string& noLabel = "",
122 const std::string& yesLabel = "")
123{
124 using namespace ::kodi::addon;
125 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_text(
126 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), line0.c_str(), line1.c_str(),
127 line2.c_str(), noLabel.c_str(), yesLabel.c_str());
128}
129//------------------------------------------------------------------------------
130
131//==============================================================================
132/// @ingroup cpp_kodi_gui_dialogs_YesNo
133/// @brief Use dialog to get numeric new password with separated line strings
134/// and cancel return field.
135///
136/// @param[in] heading Dialog heading
137/// @param[in] line0 Line #0 text
138/// @param[in] line1 Line #1 text
139/// @param[in] line2 Line #2 text
140/// @param[out] canceled Return value about cancel button
141/// @param[in] noLabel [opt] label to put on the no button
142/// @param[in] yesLabel [opt] label to put on the yes button
143/// @return Returns True if 'Yes' was pressed, else False
144///
145///
146///-------------------------------------------------------------------------
147///
148/// **Example:**
149/// ~~~~~~~~~~~~~{.cpp}
150/// #include <kodi/gui/dialogs/YesNo.h>
151///
152/// bool canceled = false;
153/// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(
154/// "Yes / No test call", // The Header
155/// "You has opened Yes / No dialog for test",
156/// "",
157/// "Is this OK for you?",
158/// canceled, // return value about cancel button
159/// "Not really", // No label, is optional and if empty "No"
160/// "Ohhh yes"); // Yes label, also optional and if empty "Yes"
161/// fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n",
162/// ret ? "yes" : "no",
163/// canceled ? "canceled" : "not canceled");
164/// ~~~~~~~~~~~~~
165///
166inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
167 const std::string& line0,
168 const std::string& line1,
169 const std::string& line2,
170 bool& canceled,
171 const std::string& noLabel = "",
172 const std::string& yesLabel = "")
173{
174 using namespace ::kodi::addon;
175 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo
176 ->show_and_get_input_line_button_text(
177 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), line0.c_str(), line1.c_str(),
178 line2.c_str(), &canceled, noLabel.c_str(), yesLabel.c_str());
179}
180//------------------------------------------------------------------------------
181}; // namespace YesNo
182/// @}
183
184} /* namespace dialogs */
185} /* namespace gui */
186} /* namespace kodi */
187
188#endif /* __cplusplus */