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