summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h1186
1 files changed, 0 insertions, 1186 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
deleted file mode 100644
index ff51c98..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
+++ /dev/null
@@ -1,1186 +0,0 @@
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 <string>
12#include <vector>
13#include <string.h>
14#include <stdlib.h>
15#include <stdio.h>
16#include "libXBMC_addon.h"
17
18typedef void* GUIHANDLE;
19
20namespace KodiAPI
21{
22namespace GUI
23{
24
25typedef struct CB_GUILib
26{
27 void (*Lock)();
28 void (*Unlock)();
29 int (*GetScreenHeight)();
30 int (*GetScreenWidth)();
31 int (*GetVideoResolution)();
32 GUIHANDLE (*Window_New)(void *addonData, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog);
33 void (*Window_Delete)(void *addonData, GUIHANDLE handle);
34 void (*Window_SetCallbacks)(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*)(GUIHANDLE handle), bool (*)(GUIHANDLE handle, int), bool (*)(GUIHANDLE handle, int), bool (*)(GUIHANDLE handle, int));
35 bool (*Window_Show)(void *addonData, GUIHANDLE handle);
36 bool (*Window_Close)(void *addonData, GUIHANDLE handle);
37 bool (*Window_DoModal)(void *addonData, GUIHANDLE handle);
38 bool (*Window_SetFocusId)(void *addonData, GUIHANDLE handle, int iControlId);
39 int (*Window_GetFocusId)(void *addonData, GUIHANDLE handle);
40 bool (*Window_SetCoordinateResolution)(void *addonData, GUIHANDLE handle, int res);
41 void (*Window_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value);
42 void (*Window_SetPropertyInt)(void *addonData, GUIHANDLE handle, const char *key, int value);
43 void (*Window_SetPropertyBool)(void *addonData, GUIHANDLE handle, const char *key, bool value);
44 void (*Window_SetPropertyDouble)(void *addonData, GUIHANDLE handle, const char *key, double value);
45 const char* (*Window_GetProperty)(void *addonData, GUIHANDLE handle, const char *key);
46 int (*Window_GetPropertyInt)(void *addonData, GUIHANDLE handle, const char *key);
47 bool (*Window_GetPropertyBool)(void *addonData, GUIHANDLE handle, const char *key);
48 double (*Window_GetPropertyDouble)(void *addonData, GUIHANDLE handle, const char *key);
49 void (*Window_ClearProperties)(void *addonData, GUIHANDLE handle);
50 int (*Window_GetListSize)(void *addonData, GUIHANDLE handle);
51 void (*Window_ClearList)(void *addonData, GUIHANDLE handle);
52 GUIHANDLE (*Window_AddItem)(void *addonData, GUIHANDLE handle, GUIHANDLE item, int itemPosition);
53 GUIHANDLE (*Window_AddStringItem)(void *addonData, GUIHANDLE handle, const char *itemName, int itemPosition);
54 void (*Window_RemoveItem)(void *addonData, GUIHANDLE handle, int itemPosition);
55 GUIHANDLE (*Window_GetListItem)(void *addonData, GUIHANDLE handle, int listPos);
56 void (*Window_SetCurrentListPosition)(void *addonData, GUIHANDLE handle, int listPos);
57 int (*Window_GetCurrentListPosition)(void *addonData, GUIHANDLE handle);
58 GUIHANDLE (*Window_GetControl_Spin)(void *addonData, GUIHANDLE handle, int controlId);
59 GUIHANDLE (*Window_GetControl_Button)(void *addonData, GUIHANDLE handle, int controlId);
60 GUIHANDLE (*Window_GetControl_RadioButton)(void *addonData, GUIHANDLE handle, int controlId);
61 GUIHANDLE (*Window_GetControl_Edit)(void *addonData, GUIHANDLE handle, int controlId);
62 GUIHANDLE (*Window_GetControl_Progress)(void *addonData, GUIHANDLE handle, int controlId);
63 GUIHANDLE (*Window_GetControl_RenderAddon)(void *addonData, GUIHANDLE handle, int controlId);
64 void (*Window_SetControlLabel)(void *addonData, GUIHANDLE handle, int controlId, const char *label);
65 void (*Window_MarkDirtyRegion)(void *addonData, GUIHANDLE handle);
66 void (*Control_Spin_SetVisible)(void *addonData, GUIHANDLE spinhandle, bool yesNo);
67 void (*Control_Spin_SetText)(void *addonData, GUIHANDLE spinhandle, const char *label);
68 void (*Control_Spin_Clear)(void *addonData, GUIHANDLE spinhandle);
69 void (*Control_Spin_AddLabel)(void *addonData, GUIHANDLE spinhandle, const char *label, int iValue);
70 int (*Control_Spin_GetValue)(void *addonData, GUIHANDLE spinhandle);
71 void (*Control_Spin_SetValue)(void *addonData, GUIHANDLE spinhandle, int iValue);
72 void (*Control_RadioButton_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo);
73 void (*Control_RadioButton_SetText)(void *addonData, GUIHANDLE handle, const char *label);
74 void (*Control_RadioButton_SetSelected)(void *addonData, GUIHANDLE handle, bool yesNo);
75 bool (*Control_RadioButton_IsSelected)(void *addonData, GUIHANDLE handle);
76 void (*Control_Progress_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent);
77 float (*Control_Progress_GetPercentage)(void *addonData, GUIHANDLE handle);
78 void (*Control_Progress_SetInfo)(void *addonData, GUIHANDLE handle, int iInfo);
79 int (*Control_Progress_GetInfo)(void *addonData, GUIHANDLE handle);
80 const char* (*Control_Progress_GetDescription)(void *addonData, GUIHANDLE handle);
81 GUIHANDLE (*Window_GetControl_Slider)(void *addonData, GUIHANDLE handle, int controlId);
82 void (*Control_Slider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo);
83 const char *(*Control_Slider_GetDescription)(void *addonData, GUIHANDLE handle);
84 void (*Control_Slider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd);
85 void (*Control_Slider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue);
86 int (*Control_Slider_GetIntValue)(void *addonData, GUIHANDLE handle);
87 void (*Control_Slider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval);
88 void (*Control_Slider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent);
89 float (*Control_Slider_GetPercentage)(void *addonData, GUIHANDLE handle);
90 void (*Control_Slider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd);
91 void (*Control_Slider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue);
92 float (*Control_Slider_GetFloatValue)(void *addonData, GUIHANDLE handle);
93 void (*Control_Slider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval);
94 GUIHANDLE (*Window_GetControl_SettingsSlider)(void *addonData, GUIHANDLE handle, int controlId);
95 void (*Control_SettingsSlider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo);
96 void (*Control_SettingsSlider_SetText)(void *addonData, GUIHANDLE handle, const char *label);
97 const char *(*Control_SettingsSlider_GetDescription)(void *addonData, GUIHANDLE handle);
98 void (*Control_SettingsSlider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd);
99 void (*Control_SettingsSlider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue);
100 int (*Control_SettingsSlider_GetIntValue)(void *addonData, GUIHANDLE handle);
101 void (*Control_SettingsSlider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval);
102 void (*Control_SettingsSlider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent);
103 float (*Control_SettingsSlider_GetPercentage)(void *addonData, GUIHANDLE handle);
104 void (*Control_SettingsSlider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd);
105 void (*Control_SettingsSlider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue);
106 float (*Control_SettingsSlider_GetFloatValue)(void *addonData, GUIHANDLE handle);
107 void (*Control_SettingsSlider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval);
108 GUIHANDLE (*ListItem_Create)(void *addonData, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path);
109 const char* (*ListItem_GetLabel)(void *addonData, GUIHANDLE handle);
110 void (*ListItem_SetLabel)(void *addonData, GUIHANDLE handle, const char *label);
111 const char* (*ListItem_GetLabel2)(void *addonData, GUIHANDLE handle);
112 void (*ListItem_SetLabel2)(void *addonData, GUIHANDLE handle, const char *label);
113 void (*ListItem_SetIconImage)(void *addonData, GUIHANDLE handle, const char *image);
114 void (*ListItem_SetThumbnailImage)(void *addonData, GUIHANDLE handle, const char *image);
115 void (*ListItem_SetInfo)(void *addonData, GUIHANDLE handle, const char *info);
116 void (*ListItem_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value);
117 const char* (*ListItem_GetProperty)(void *addonData, GUIHANDLE handle, const char *key);
118 void (*ListItem_SetPath)(void *addonData, GUIHANDLE handle, const char *path);
119 void (*RenderAddon_SetCallbacks)(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*createCB)(GUIHANDLE,int,int,int,int,void*), void (*renderCB)(GUIHANDLE), void (*stopCB)(GUIHANDLE), bool (*dirtyCB)(GUIHANDLE));
120 void (*RenderAddon_Delete)(void *addonData, GUIHANDLE handle);
121 void (*RenderAddon_MarkDirty)(void *addonData, GUIHANDLE handle);
122
123 bool (*Dialog_Keyboard_ShowAndGetInputWithHead)(char &strTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs);
124 bool (*Dialog_Keyboard_ShowAndGetInput)(char &strTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs);
125 bool (*Dialog_Keyboard_ShowAndGetNewPasswordWithHead)(char &newPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs);
126 bool (*Dialog_Keyboard_ShowAndGetNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs);
127 bool (*Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead)(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmpty, unsigned int autoCloseMs);
128 bool (*Dialog_Keyboard_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs);
129 int (*Dialog_Keyboard_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs);
130 bool (*Dialog_Keyboard_ShowAndGetFilter)(char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs);
131 bool (*Dialog_Keyboard_SendTextToActiveKeyboard)(const char *aTextString, bool closeKeyboard);
132 bool (*Dialog_Keyboard_isKeyboardActivated)();
133
134 bool (*Dialog_Numeric_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize);
135 int (*Dialog_Numeric_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries);
136 bool (*Dialog_Numeric_ShowAndVerifyInput)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput);
137 bool (*Dialog_Numeric_ShowAndGetTime)(tm &time, const char *strHeading);
138 bool (*Dialog_Numeric_ShowAndGetDate)(tm &date, const char *strHeading);
139 bool (*Dialog_Numeric_ShowAndGetIPAddress)(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading);
140 bool (*Dialog_Numeric_ShowAndGetNumber)(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs);
141 bool (*Dialog_Numeric_ShowAndGetSeconds)(char &timeString, unsigned int iMaxStringSize, const char *strHeading);
142
143 bool (*Dialog_FileBrowser_ShowAndGetFile)(const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList);
144
145 void (*Dialog_OK_ShowAndGetInputSingleText)(const char *heading, const char *text);
146 void (*Dialog_OK_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2);
147
148 bool (*Dialog_YesNo_ShowAndGetInputSingleText)(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel);
149 bool (*Dialog_YesNo_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel);
150 bool (*Dialog_YesNo_ShowAndGetInputLineButtonText)(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel);
151
152 void (*Dialog_TextViewer)(const char *heading, const char *text);
153
154 int (*Dialog_Select)(const char *heading, const char *entries[], unsigned int size, int selected);
155} CB_GUILib;
156
157} /* namespace GUI */
158} /* namespace KodiAPI */
159
160
161#define ADDON_ACTION_PREVIOUS_MENU 10
162#define ADDON_ACTION_CLOSE_DIALOG 51
163#define ADDON_ACTION_NAV_BACK 92
164
165class CAddonGUIControlBase
166{
167public:
168 GUIHANDLE GetControlHandle() const { return m_controlHandle; }
169
170protected:
171 CAddonGUIControlBase(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIControlBase* window)
172 : m_controlHandle(nullptr), m_Handle(hdl), m_cb(cb), m_Window(window) {}
173 virtual ~CAddonGUIControlBase() = default;
174
175 GUIHANDLE m_controlHandle;
176 AddonCB* m_Handle;
177 KodiAPI::GUI::CB_GUILib* m_cb;
178 CAddonGUIControlBase* m_Window;
179
180private:
181 CAddonGUIControlBase() = delete;
182 CAddonGUIControlBase(const CAddonGUIControlBase&) = delete;
183 CAddonGUIControlBase &operator=(const CAddonGUIControlBase&) = delete;
184};
185
186class CAddonListItem : public CAddonGUIControlBase
187{
188public:
189 CAddonListItem(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)
190 : CAddonGUIControlBase(hdl, cb, nullptr)
191 {
192 m_controlHandle = m_cb->ListItem_Create(m_Handle->addonData, label, label2, iconImage, thumbnailImage, path);
193 }
194
195 ~CAddonListItem() override = default;
196
197 const char *GetLabel()
198 {
199 if (!m_controlHandle)
200 return "";
201
202 return m_cb->ListItem_GetLabel(m_Handle->addonData, m_controlHandle);
203 }
204
205 void SetLabel(const char *label)
206 {
207 if (m_controlHandle)
208 m_cb->ListItem_SetLabel(m_Handle->addonData, m_controlHandle, label);
209 }
210
211 const char *GetLabel2()
212 {
213 if (!m_controlHandle)
214 return "";
215
216 return m_cb->ListItem_GetLabel2(m_Handle->addonData, m_controlHandle);
217 }
218
219 void SetLabel2(const char *label)
220 {
221 if (m_controlHandle)
222 m_cb->ListItem_SetLabel2(m_Handle->addonData, m_controlHandle, label);
223 }
224
225 void SetIconImage(const char *image)
226 {
227 if (m_controlHandle)
228 m_cb->ListItem_SetIconImage(m_Handle->addonData, m_controlHandle, image);
229 }
230
231 void SetThumbnailImage(const char *image)
232 {
233 if (m_controlHandle)
234 m_cb->ListItem_SetThumbnailImage(m_Handle->addonData, m_controlHandle, image);
235 }
236
237 void SetInfo(const char *Info)
238 {
239 if (m_controlHandle)
240 m_cb->ListItem_SetInfo(m_Handle->addonData, m_controlHandle, Info);
241 }
242
243 void SetProperty(const char *key, const char *value)
244 {
245 if (m_controlHandle)
246 m_cb->ListItem_SetProperty(m_Handle->addonData, m_controlHandle, key, value);
247 }
248
249 const char *GetProperty(const char *key) const
250 {
251 if (!m_controlHandle)
252 return "";
253
254 return m_cb->ListItem_GetProperty(m_Handle->addonData, m_controlHandle, key);
255 }
256
257 void SetPath(const char *Path)
258 {
259 if (m_controlHandle)
260 m_cb->ListItem_SetPath(m_Handle->addonData, m_controlHandle, Path);
261 }
262};
263
264class CAddonGUIWindow : public CAddonGUIControlBase
265{
266public:
267 CAddonGUIWindow(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog)
268 : CAddonGUIControlBase(hdl, cb, nullptr)
269 , m_cbhdl(nullptr)
270 , CBOnInit(nullptr)
271 , CBOnFocus(nullptr)
272 , CBOnClick(nullptr)
273 , CBOnAction(nullptr)
274 {
275 if (hdl && cb)
276 {
277 m_controlHandle = m_cb->Window_New(m_Handle->addonData, xmlFilename, defaultSkin, forceFallback, asDialog);
278 if (!m_controlHandle)
279 fprintf(stderr, "libKODI_guilib: ERROR: Can't create window class !!!\n");
280
281 m_cb->Window_SetCallbacks(m_Handle->addonData, m_controlHandle, this, OnInitCB, OnClickCB, OnFocusCB, OnActionCB);
282 }
283 }
284
285 ~CAddonGUIWindow() override
286 {
287 if (m_Handle && m_cb && m_controlHandle)
288 {
289 m_cb->Window_Delete(m_Handle->addonData, m_controlHandle);
290 m_controlHandle = nullptr;
291 }
292 }
293
294 bool Show()
295 {
296 return m_cb->Window_Show(m_Handle->addonData, m_controlHandle);
297 }
298
299 void Close()
300 {
301 m_cb->Window_Close(m_Handle->addonData, m_controlHandle);
302 }
303
304 void DoModal()
305 {
306 m_cb->Window_DoModal(m_Handle->addonData, m_controlHandle);
307 }
308
309 bool SetFocusId(int iControlId)
310 {
311 return m_cb->Window_SetFocusId(m_Handle->addonData, m_controlHandle, iControlId);
312 }
313
314 int GetFocusId()
315 {
316 return m_cb->Window_GetFocusId(m_Handle->addonData, m_controlHandle);
317 }
318
319 bool SetCoordinateResolution(int res)
320 {
321 return m_cb->Window_SetCoordinateResolution(m_Handle->addonData, m_controlHandle, res);
322 }
323
324 void SetProperty(const char *key, const char *value)
325 {
326 m_cb->Window_SetProperty(m_Handle->addonData, m_controlHandle, key, value);
327 }
328
329 void SetPropertyInt(const char *key, int value)
330 {
331 m_cb->Window_SetPropertyInt(m_Handle->addonData, m_controlHandle, key, value);
332 }
333
334 void SetPropertyBool(const char *key, bool value)
335 {
336 m_cb->Window_SetPropertyBool(m_Handle->addonData, m_controlHandle, key, value);
337 }
338
339 void SetPropertyDouble(const char *key, double value)
340 {
341 m_cb->Window_SetPropertyDouble(m_Handle->addonData, m_controlHandle, key, value);
342 }
343
344 const char *GetProperty(const char *key) const
345 {
346 return m_cb->Window_GetProperty(m_Handle->addonData, m_controlHandle, key);
347 }
348
349 int GetPropertyInt(const char *key) const
350 {
351 return m_cb->Window_GetPropertyInt(m_Handle->addonData, m_controlHandle, key);
352 }
353
354 bool GetPropertyBool(const char *key) const
355 {
356 return m_cb->Window_GetPropertyBool(m_Handle->addonData, m_controlHandle, key);
357 }
358
359 double GetPropertyDouble(const char *key) const
360 {
361 return m_cb->Window_GetPropertyDouble(m_Handle->addonData, m_controlHandle, key);
362 }
363
364 void ClearProperties()
365 {
366 m_cb->Window_ClearProperties(m_Handle->addonData, m_controlHandle);
367 }
368
369 int GetListSize()
370 {
371 return m_cb->Window_GetListSize(m_Handle->addonData, m_controlHandle);
372 }
373
374 void ClearList()
375 {
376 m_cb->Window_ClearList(m_Handle->addonData, m_controlHandle);
377 }
378
379 GUIHANDLE AddStringItem(const char *name, int itemPosition = -1)
380 {
381 return m_cb->Window_AddStringItem(m_Handle->addonData, m_controlHandle, name, itemPosition);
382 }
383
384 void AddItem(GUIHANDLE item, int itemPosition = -1)
385 {
386 m_cb->Window_AddItem(m_Handle->addonData, m_controlHandle, item, itemPosition);
387 }
388
389 void AddItem(CAddonListItem *item, int itemPosition = -1)
390 {
391 m_cb->Window_AddItem(m_Handle->addonData, m_controlHandle, item->GetControlHandle(), itemPosition);
392 }
393
394 void RemoveItem(int itemPosition)
395 {
396 m_cb->Window_RemoveItem(m_Handle->addonData, m_controlHandle, itemPosition);
397 }
398
399 GUIHANDLE GetListItem(int listPos)
400 {
401 return m_cb->Window_GetListItem(m_Handle->addonData, m_controlHandle, listPos);
402 }
403
404 void SetCurrentListPosition(int listPos)
405 {
406 m_cb->Window_SetCurrentListPosition(m_Handle->addonData, m_controlHandle, listPos);
407 }
408
409 int GetCurrentListPosition()
410 {
411 return m_cb->Window_GetCurrentListPosition(m_Handle->addonData, m_controlHandle);
412 }
413
414 void SetControlLabel(int controlId, const char *label)
415 {
416 m_cb->Window_SetControlLabel(m_Handle->addonData, m_controlHandle, controlId, label);
417 }
418
419 void MarkDirtyRegion()
420 {
421 m_cb->Window_MarkDirtyRegion(m_Handle->addonData, m_controlHandle);
422 }
423
424 bool OnClick(int controlId)
425 {
426 if (!CBOnClick)
427 return false;
428
429 return CBOnClick(m_cbhdl, controlId);
430 }
431
432 bool OnFocus(int controlId)
433 {
434 if (!CBOnFocus)
435 return false;
436
437 return CBOnFocus(m_cbhdl, controlId);
438 }
439
440 bool OnInit()
441 {
442 if (!CBOnInit)
443 return false;
444
445 return CBOnInit(m_cbhdl);
446 }
447
448 bool OnAction(int actionId)
449 {
450 if (!CBOnAction)
451 return false;
452
453 return CBOnAction(m_cbhdl, actionId);
454 }
455
456 GUIHANDLE m_cbhdl;
457 bool (*CBOnInit)(GUIHANDLE cbhdl);
458 bool (*CBOnFocus)(GUIHANDLE cbhdl, int controlId);
459 bool (*CBOnClick)(GUIHANDLE cbhdl, int controlId);
460 bool (*CBOnAction)(GUIHANDLE cbhdl, int actionId);
461
462protected:
463 static bool OnInitCB(GUIHANDLE cbhdl);
464 static bool OnFocusCB(GUIHANDLE cbhdl, int controlId);
465 static bool OnClickCB(GUIHANDLE cbhdl, int controlId);
466 static bool OnActionCB(GUIHANDLE cbhdl, int actionId);
467};
468
469
470inline bool CAddonGUIWindow::OnInitCB(GUIHANDLE cbhdl)
471{
472 return static_cast<CAddonGUIWindow*>(cbhdl)->OnInit();
473}
474
475inline bool CAddonGUIWindow::OnClickCB(GUIHANDLE cbhdl, int controlId)
476{
477 return static_cast<CAddonGUIWindow*>(cbhdl)->OnClick(controlId);
478}
479
480inline bool CAddonGUIWindow::OnFocusCB(GUIHANDLE cbhdl, int controlId)
481{
482 return static_cast<CAddonGUIWindow*>(cbhdl)->OnFocus(controlId);
483}
484
485inline bool CAddonGUIWindow::OnActionCB(GUIHANDLE cbhdl, int actionId)
486{
487 return static_cast<CAddonGUIWindow*>(cbhdl)->OnAction(actionId);
488}
489
490class CAddonGUISpinControl: public CAddonGUIControlBase
491{
492public:
493 CAddonGUISpinControl(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId)
494 : CAddonGUIControlBase(hdl, cb, window)
495 {
496 m_controlHandle = m_cb->Window_GetControl_Spin(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
497 }
498 ~CAddonGUISpinControl(void) override = default;
499
500 void SetVisible(bool yesNo)
501 {
502 if (m_controlHandle)
503 m_cb->Control_Spin_SetVisible(m_Handle->addonData, m_controlHandle, yesNo);
504 }
505
506 void SetText(const char *label)
507 {
508 if (m_controlHandle)
509 m_cb->Control_Spin_SetText(m_Handle->addonData, m_controlHandle, label);
510 }
511
512 void Clear()
513 {
514 if (m_controlHandle)
515 m_cb->Control_Spin_Clear(m_Handle->addonData, m_controlHandle);
516 }
517
518 void AddLabel(const char *label, int iValue)
519 {
520 if (m_controlHandle)
521 m_cb->Control_Spin_AddLabel(m_Handle->addonData, m_controlHandle, label, iValue);
522 }
523
524 int GetValue()
525 {
526 if (!m_controlHandle)
527 return -1;
528
529 return m_cb->Control_Spin_GetValue(m_Handle->addonData, m_controlHandle);
530 }
531
532 void SetValue(int iValue)
533 {
534 if (m_controlHandle)
535 m_cb->Control_Spin_SetValue(m_Handle->addonData, m_controlHandle, iValue);
536 }
537};
538
539class CAddonGUIRadioButton : public CAddonGUIControlBase
540{
541public:
542 CAddonGUIRadioButton(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId)
543 : CAddonGUIControlBase(hdl, cb, window)
544 {
545 m_controlHandle = m_cb->Window_GetControl_RadioButton(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
546 }
547 ~CAddonGUIRadioButton() override = default;
548
549 void SetVisible(bool yesNo)
550 {
551 if (m_controlHandle)
552 m_cb->Control_RadioButton_SetVisible(m_Handle->addonData, m_controlHandle, yesNo);
553 }
554
555 void SetText(const char *label)
556 {
557 if (m_controlHandle)
558 m_cb->Control_RadioButton_SetText(m_Handle->addonData, m_controlHandle, label);
559 }
560
561 void SetSelected(bool yesNo)
562 {
563 if (m_controlHandle)
564 m_cb->Control_RadioButton_SetSelected(m_Handle->addonData, m_controlHandle, yesNo);
565 }
566
567 bool IsSelected()
568 {
569 if (!m_controlHandle)
570 return false;
571
572 return m_cb->Control_RadioButton_IsSelected(m_Handle->addonData, m_controlHandle);
573 }
574};
575
576class CAddonGUIProgressControl : public CAddonGUIControlBase
577{
578public:
579 CAddonGUIProgressControl(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId)
580 : CAddonGUIControlBase(hdl, cb, window)
581 {
582 m_controlHandle = m_cb->Window_GetControl_Progress(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
583 }
584
585 ~CAddonGUIProgressControl(void) override = default;
586
587 void SetPercentage(float fPercent)
588 {
589 if (m_controlHandle)
590 m_cb->Control_Progress_SetPercentage(m_Handle->addonData, m_controlHandle, fPercent);
591 }
592
593 float GetPercentage() const
594 {
595 if (!m_controlHandle)
596 return 0.0f;
597
598 return m_cb->Control_Progress_GetPercentage(m_Handle->addonData, m_controlHandle);
599 }
600
601 void SetInfo(int iInfo)
602 {
603 if (m_controlHandle)
604 m_cb->Control_Progress_SetInfo(m_Handle->addonData, m_controlHandle, iInfo);
605 }
606
607 int GetInfo() const
608 {
609 if (!m_controlHandle)
610 return -1;
611
612 return m_cb->Control_Progress_GetInfo(m_Handle->addonData, m_controlHandle);
613 }
614
615 std::string GetDescription() const
616 {
617 if (!m_controlHandle)
618 return "";
619
620 return m_cb->Control_Progress_GetDescription(m_Handle->addonData, m_controlHandle);
621 }
622};
623
624class CAddonGUISliderControl : public CAddonGUIControlBase
625{
626public:
627 CAddonGUISliderControl(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId)
628 : CAddonGUIControlBase(hdl, cb, window)
629 {
630 m_controlHandle = m_cb->Window_GetControl_Slider(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
631 }
632
633 ~CAddonGUISliderControl(void) override = default;
634
635 void SetVisible(bool yesNo)
636 {
637 if (m_controlHandle)
638 m_cb->Control_Slider_SetVisible(m_Handle->addonData, m_controlHandle, yesNo);
639 }
640
641 std::string GetDescription() const
642 {
643 if (!m_controlHandle)
644 return "";
645
646 return m_cb->Control_Slider_GetDescription(m_Handle->addonData, m_controlHandle);
647 }
648
649 void SetIntRange(int iStart, int iEnd)
650 {
651 if (m_controlHandle)
652 m_cb->Control_Slider_SetIntRange(m_Handle->addonData, m_controlHandle, iStart, iEnd);
653 }
654
655 void SetIntValue(int iValue)
656 {
657 if (m_controlHandle)
658 m_cb->Control_Slider_SetIntValue(m_Handle->addonData, m_controlHandle, iValue);
659 }
660
661 int GetIntValue() const
662 {
663 if (!m_controlHandle)
664 return 0;
665 return m_cb->Control_Slider_GetIntValue(m_Handle->addonData, m_controlHandle);
666 }
667
668 void SetIntInterval(int iInterval)
669 {
670 if (m_controlHandle)
671 m_cb->Control_Slider_SetIntInterval(m_Handle->addonData, m_controlHandle, iInterval);
672 }
673
674 void SetPercentage(float fPercent)
675 {
676 if (m_controlHandle)
677 m_cb->Control_Slider_SetPercentage(m_Handle->addonData, m_controlHandle, fPercent);
678 }
679
680 float GetPercentage() const
681 {
682 if (!m_controlHandle)
683 return 0.0f;
684
685 return m_cb->Control_Slider_GetPercentage(m_Handle->addonData, m_controlHandle);
686 }
687
688 void SetFloatRange(float fStart, float fEnd)
689 {
690 if (m_controlHandle)
691 m_cb->Control_Slider_SetFloatRange(m_Handle->addonData, m_controlHandle, fStart, fEnd);
692 }
693
694 void SetFloatValue(float fValue)
695 {
696 if (m_controlHandle)
697 m_cb->Control_Slider_SetFloatValue(m_Handle->addonData, m_controlHandle, fValue);
698 }
699
700 float GetFloatValue() const
701 {
702 if (!m_controlHandle)
703 return 0.0f;
704 return m_cb->Control_Slider_GetFloatValue(m_Handle->addonData, m_controlHandle);
705 }
706
707 void SetFloatInterval(float fInterval)
708 {
709 if (m_controlHandle)
710 m_cb->Control_Slider_SetFloatInterval(m_Handle->addonData, m_controlHandle, fInterval);
711 }
712};
713
714class CAddonGUISettingsSliderControl : public CAddonGUIControlBase
715{
716public:
717 CAddonGUISettingsSliderControl(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId)
718 : CAddonGUIControlBase(hdl, cb, window)
719 {
720 m_controlHandle = m_cb->Window_GetControl_SettingsSlider(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
721 }
722
723 ~CAddonGUISettingsSliderControl(void) override = default;
724
725 void SetVisible(bool yesNo)
726 {
727 if (m_controlHandle)
728 m_cb->Control_SettingsSlider_SetVisible(m_Handle->addonData, m_controlHandle, yesNo);
729 }
730
731 void SetText(const char *label)
732 {
733 if (m_controlHandle)
734 m_cb->Control_SettingsSlider_SetText(m_Handle->addonData, m_controlHandle, label);
735 }
736
737 std::string GetDescription() const
738 {
739 if (!m_controlHandle)
740 return "";
741
742 return m_cb->Control_SettingsSlider_GetDescription(m_Handle->addonData, m_controlHandle);
743 }
744
745 void SetIntRange(int iStart, int iEnd)
746 {
747 if (m_controlHandle)
748 m_cb->Control_SettingsSlider_SetIntRange(m_Handle->addonData, m_controlHandle, iStart, iEnd);
749 }
750
751 void SetIntValue(int iValue)
752 {
753 if (m_controlHandle)
754 m_cb->Control_SettingsSlider_SetIntValue(m_Handle->addonData, m_controlHandle, iValue);
755 }
756
757 int GetIntValue() const
758 {
759 if (!m_controlHandle)
760 return 0;
761 return m_cb->Control_SettingsSlider_GetIntValue(m_Handle->addonData, m_controlHandle);
762 }
763
764 void SetIntInterval(int iInterval)
765 {
766 if (m_controlHandle)
767 m_cb->Control_SettingsSlider_SetIntInterval(m_Handle->addonData, m_controlHandle, iInterval);
768 }
769
770 void SetPercentage(float fPercent)
771 {
772 if (m_controlHandle)
773 m_cb->Control_SettingsSlider_SetPercentage(m_Handle->addonData, m_controlHandle, fPercent);
774 }
775
776 float GetPercentage() const
777 {
778 if (!m_controlHandle)
779 return 0.0f;
780
781 return m_cb->Control_SettingsSlider_GetPercentage(m_Handle->addonData, m_controlHandle);
782 }
783
784 void SetFloatRange(float fStart, float fEnd)
785 {
786 if (m_controlHandle)
787 m_cb->Control_SettingsSlider_SetFloatRange(m_Handle->addonData, m_controlHandle, fStart, fEnd);
788 }
789
790 void SetFloatValue(float fValue)
791 {
792 if (m_controlHandle)
793 m_cb->Control_SettingsSlider_SetFloatValue(m_Handle->addonData, m_controlHandle, fValue);
794 }
795
796 float GetFloatValue() const
797 {
798 if (!m_controlHandle)
799 return 0.0f;
800 return m_cb->Control_SettingsSlider_GetFloatValue(m_Handle->addonData, m_controlHandle);
801 }
802
803 void SetFloatInterval(float fInterval)
804 {
805 if (m_controlHandle)
806 m_cb->Control_SettingsSlider_SetFloatInterval(m_Handle->addonData, m_controlHandle, fInterval);
807 }
808};
809
810class CAddonGUIRenderingControl : public CAddonGUIControlBase
811{
812public:
813 CAddonGUIRenderingControl(AddonCB* hdl, KodiAPI::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId)
814 : CAddonGUIControlBase(hdl, cb, window)
815 , m_cbhdl(nullptr)
816 , CBCreate(nullptr)
817 , CBRender(nullptr)
818 , CBStop(nullptr)
819 , CBDirty(nullptr)
820 {
821 m_controlHandle = m_cb->Window_GetControl_RenderAddon(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
822 }
823
824 ~CAddonGUIRenderingControl() override
825 {
826 m_cb->RenderAddon_Delete(m_Handle->addonData, m_controlHandle);
827 }
828
829 void Init()
830 {
831 m_cb->RenderAddon_SetCallbacks(m_Handle->addonData, m_controlHandle, this, OnCreateCB, OnRenderCB, OnStopCB, OnDirtyCB);
832 }
833
834 bool Create(int x, int y, int w, int h, void *device)
835 {
836 if (!CBCreate)
837 return false;
838
839 return CBCreate(m_cbhdl, x, y, w, h, device);
840 }
841
842 void Render()
843 {
844 if (!CBRender)
845 return;
846
847 CBRender(m_cbhdl);
848 }
849
850 void Stop()
851 {
852 if (!CBStop)
853 return;
854
855 CBStop(m_cbhdl);
856 }
857
858 bool Dirty()
859 {
860 if (!CBDirty)
861 return true;
862
863 return CBDirty(m_cbhdl);
864 }
865
866 GUIHANDLE m_cbhdl;
867 bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device);
868 void (*CBRender)(GUIHANDLE cbhdl);
869 void (*CBStop)(GUIHANDLE cbhdl);
870 bool (*CBDirty)(GUIHANDLE cbhdl);
871
872private:
873 static bool OnCreateCB(GUIHANDLE cbhdl, int x, int y, int w, int h, void* device);
874 static void OnRenderCB(GUIHANDLE cbhdl);
875 static void OnStopCB(GUIHANDLE cbhdl);
876 static bool OnDirtyCB(GUIHANDLE cbhdl);
877};
878
879inline bool CAddonGUIRenderingControl::OnCreateCB(GUIHANDLE cbhdl, int x, int y, int w, int h, void* device)
880{
881 return static_cast<CAddonGUIRenderingControl*>(cbhdl)->Create(x, y, w, h, device);
882}
883
884inline void CAddonGUIRenderingControl::OnRenderCB(GUIHANDLE cbhdl)
885{
886 static_cast<CAddonGUIRenderingControl*>(cbhdl)->Render();
887}
888
889inline void CAddonGUIRenderingControl::OnStopCB(GUIHANDLE cbhdl)
890{
891 static_cast<CAddonGUIRenderingControl*>(cbhdl)->Stop();
892}
893
894inline bool CAddonGUIRenderingControl::OnDirtyCB(GUIHANDLE cbhdl)
895{
896 return static_cast<CAddonGUIRenderingControl*>(cbhdl)->Dirty();
897}
898
899class CHelper_libKODI_guilib
900{
901public:
902 CHelper_libKODI_guilib()
903 {
904 m_Handle = nullptr;
905 m_Callbacks = nullptr;
906 }
907
908 ~CHelper_libKODI_guilib()
909 {
910 if (m_Handle && m_Callbacks)
911 {
912 m_Handle->GUILib_UnRegisterMe(m_Handle->addonData, m_Callbacks);
913 }
914 }
915
916 bool RegisterMe(void *handle)
917 {
918 m_Handle = static_cast<AddonCB*>(handle);
919 if (m_Handle)
920 m_Callbacks = (KodiAPI::GUI::CB_GUILib*)m_Handle->GUILib_RegisterMe(m_Handle->addonData);
921 if (!m_Callbacks)
922 fprintf(stderr, "libKODI_guilib-ERROR: GUILib_RegisterMe can't get callback table from Kodi !!!\n");
923
924 return m_Callbacks != nullptr;
925 }
926
927 void Lock()
928 {
929 m_Callbacks->Lock();
930 }
931
932 void Unlock()
933 {
934 m_Callbacks->Unlock();
935 }
936
937 int GetScreenHeight()
938 {
939 return m_Callbacks->GetScreenHeight();
940 }
941
942 int GetScreenWidth()
943 {
944 return m_Callbacks->GetScreenWidth();
945 }
946
947 int GetVideoResolution()
948 {
949 return m_Callbacks->GetVideoResolution();
950 }
951
952 CAddonGUIWindow* Window_create(const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog)
953 {
954 return new CAddonGUIWindow(m_Handle, m_Callbacks, xmlFilename, defaultSkin, forceFallback, asDialog);
955 }
956
957 void Window_destroy(CAddonGUIWindow* p)
958 {
959 delete p;
960 }
961
962 CAddonGUISpinControl* Control_getSpin(CAddonGUIWindow *window, int controlId)
963 {
964 return new CAddonGUISpinControl(m_Handle, m_Callbacks, window, controlId);
965 }
966
967 void Control_releaseSpin(CAddonGUISpinControl* p)
968 {
969 delete p;
970 }
971
972 CAddonGUIRadioButton* Control_getRadioButton(CAddonGUIWindow *window, int controlId)
973 {
974 return new CAddonGUIRadioButton(m_Handle, m_Callbacks, window, controlId);
975 }
976
977 void Control_releaseRadioButton(CAddonGUIRadioButton* p)
978 {
979 delete p;
980 }
981
982 CAddonGUIProgressControl* Control_getProgress(CAddonGUIWindow *window, int controlId)
983 {
984 return new CAddonGUIProgressControl(m_Handle, m_Callbacks, window, controlId);
985 }
986
987 void Control_releaseProgress(CAddonGUIProgressControl* p)
988 {
989 delete p;
990 }
991
992 CAddonListItem* ListItem_create(const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)
993 {
994 return new CAddonListItem(m_Handle, m_Callbacks, label, label2, iconImage, thumbnailImage, path);
995 }
996
997 void ListItem_destroy(CAddonListItem* p)
998 {
999 delete p;
1000 }
1001
1002 CAddonGUIRenderingControl* Control_getRendering(CAddonGUIWindow *window, int controlId)
1003 {
1004 return new CAddonGUIRenderingControl(m_Handle, m_Callbacks, window, controlId);
1005 }
1006
1007 void Control_releaseRendering(CAddonGUIRenderingControl* p)
1008 {
1009 delete p;
1010 }
1011
1012 CAddonGUISliderControl* Control_getSlider(CAddonGUIWindow *window, int controlId)
1013 {
1014 return new CAddonGUISliderControl(m_Handle, m_Callbacks, window, controlId);
1015 }
1016
1017 void Control_releaseSlider(CAddonGUISliderControl* p)
1018 {
1019 delete p;
1020 }
1021
1022 CAddonGUISettingsSliderControl* Control_getSettingsSlider(CAddonGUIWindow *window, int controlId)
1023 {
1024 return new CAddonGUISettingsSliderControl(m_Handle, m_Callbacks, window, controlId);
1025 }
1026
1027 void Control_releaseSettingsSlider(CAddonGUISettingsSliderControl* p)
1028 {
1029 delete p;
1030 }
1031
1032 /*! @name GUI Keyboard functions */
1033 //@{
1034 bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs = 0)
1035 {
1036 return m_Callbacks->Dialog_Keyboard_ShowAndGetInputWithHead(strText, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs);
1037 }
1038
1039 bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs = 0)
1040 {
1041 return m_Callbacks->Dialog_Keyboard_ShowAndGetInput(strText, iMaxStringSize, allowEmptyResult, autoCloseMs);
1042 }
1043
1044 bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0)
1045 {
1046 return m_Callbacks->Dialog_Keyboard_ShowAndGetNewPasswordWithHead(strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs);
1047 }
1048
1049 bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0)
1050 {
1051 return m_Callbacks->Dialog_Keyboard_ShowAndGetNewPassword(strNewPassword, iMaxStringSize, autoCloseMs);
1052 }
1053
1054 bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0)
1055 {
1056 return m_Callbacks->Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead(strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs);
1057 }
1058
1059 bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0)
1060 {
1061 return m_Callbacks->Dialog_Keyboard_ShowAndVerifyNewPassword(strNewPassword, iMaxStringSize, autoCloseMs);
1062 }
1063
1064 int Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs = 0)
1065 {
1066 return m_Callbacks->Dialog_Keyboard_ShowAndVerifyPassword(strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs);
1067 }
1068
1069 bool Dialog_Keyboard_ShowAndGetFilter(char &strText, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs = 0)
1070 {
1071 return m_Callbacks->Dialog_Keyboard_ShowAndGetFilter(strText, iMaxStringSize, searching, autoCloseMs);
1072 }
1073
1074 bool Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard = false)
1075 {
1076 return m_Callbacks->Dialog_Keyboard_SendTextToActiveKeyboard(aTextString, closeKeyboard);
1077 }
1078
1079 bool Dialog_Keyboard_isKeyboardActivated()
1080 {
1081 return m_Callbacks->Dialog_Keyboard_isKeyboardActivated();
1082 }
1083 //@}
1084
1085 /*! @name GUI Numeric functions */
1086 //@{
1087 bool Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize)
1088 {
1089 return m_Callbacks->Dialog_Numeric_ShowAndVerifyNewPassword(strNewPassword, iMaxStringSize);
1090 }
1091
1092 int Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries)
1093 {
1094 return m_Callbacks->Dialog_Numeric_ShowAndVerifyPassword(strPassword, iMaxStringSize, strHeading, iRetries);
1095 }
1096
1097 bool Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput)
1098 {
1099 return m_Callbacks->Dialog_Numeric_ShowAndVerifyInput(strPassword, iMaxStringSize, strHeading, bGetUserInput);
1100 }
1101
1102 bool Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading)
1103 {
1104 return m_Callbacks->Dialog_Numeric_ShowAndGetTime(time, strHeading);
1105 }
1106
1107 bool Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading)
1108 {
1109 return m_Callbacks->Dialog_Numeric_ShowAndGetDate(date, strHeading);
1110 }
1111
1112 bool Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading)
1113 {
1114 return m_Callbacks->Dialog_Numeric_ShowAndGetIPAddress(strIPAddress, iMaxStringSize, strHeading);
1115 }
1116
1117 bool Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs = 0)
1118 {
1119 return m_Callbacks->Dialog_Numeric_ShowAndGetNumber(strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs);
1120 }
1121
1122 bool Dialog_Numeric_ShowAndGetSeconds(char &strTime, unsigned int iMaxStringSize, const char *strHeading)
1123 {
1124 return m_Callbacks->Dialog_Numeric_ShowAndGetSeconds(strTime, iMaxStringSize, strHeading);
1125 }
1126 //@}
1127
1128 /*! @name GUI File browser functions */
1129 //@{
1130 bool Dialog_FileBrowser_ShowAndGetFile(const char *directory, const char *mask, const char *heading, char &strPath, unsigned int iMaxStringSize, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false)
1131 {
1132 return m_Callbacks->Dialog_FileBrowser_ShowAndGetFile(directory, mask, heading, strPath, iMaxStringSize, useThumbs, useFileDirectories, singleList);
1133 }
1134 //@}
1135
1136 /*! @name GUI OK Dialog functions */
1137 //@{
1138 void Dialog_OK_ShowAndGetInput(const char *heading, const char *text)
1139 {
1140 return m_Callbacks->Dialog_OK_ShowAndGetInputSingleText(heading, text);
1141 }
1142
1143 void Dialog_OK_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2)
1144 {
1145 return m_Callbacks->Dialog_OK_ShowAndGetInputLineText(heading, line0, line1, line2);
1146 }
1147 //@}
1148
1149 /*! @name GUI Yes No Dialog functions */
1150 //@{
1151 bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *text, bool& bCanceled, const char *noLabel = "", const char *yesLabel = "")
1152 {
1153 return m_Callbacks->Dialog_YesNo_ShowAndGetInputSingleText(heading, text, bCanceled, noLabel, yesLabel);
1154 }
1155
1156 bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel = "", const char *yesLabel = "")
1157 {
1158 return m_Callbacks->Dialog_YesNo_ShowAndGetInputLineText(heading, line0, line1, line2, noLabel, yesLabel);
1159 }
1160
1161 bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel = "", const char *yesLabel = "")
1162 {
1163 return m_Callbacks->Dialog_YesNo_ShowAndGetInputLineButtonText(heading, line0, line1, line2, bCanceled, noLabel, yesLabel);
1164 }
1165 //@}
1166
1167 /*! @name GUI Text viewer Dialog */
1168 //@{
1169 void Dialog_TextViewer(const char *heading, const char *text)
1170 {
1171 return m_Callbacks->Dialog_TextViewer(heading, text);
1172 }
1173 //@}
1174
1175 /*! @name GUI select Dialog */
1176 //@{
1177 int Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected = -1)
1178 {
1179 return m_Callbacks->Dialog_Select(heading, entries, size, selected);
1180 }
1181 //@}
1182
1183private:
1184 AddonCB* m_Handle;
1185 KodiAPI::GUI::CB_GUILib* m_Callbacks;
1186};