diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | Makefile.include.in | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/addons/library.kodi.guilib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/addons/library.kodi.guilib/Makefile.in | 38 | ||||
-rw-r--r-- | lib/addons/library.kodi.guilib/libKODI_guilib.cpp | 1013 | ||||
-rw-r--r-- | lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj | 90 | ||||
-rw-r--r-- | lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj.filters | 18 | ||||
-rw-r--r-- | lib/addons/library.kodi.guilib/project/VS2010Express/post-build.ps1 | 29 | ||||
-rw-r--r-- | project/cmake/installdata/common/addons.txt | 1 | ||||
-rw-r--r-- | project/cmake/treedata/common/addons.txt | 1 | ||||
-rw-r--r-- | xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.cpp | 2 | ||||
-rw-r--r-- | xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.h | 261 | ||||
-rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h | 1436 |
15 files changed, 936 insertions, 1965 deletions
diff --git a/.gitignore b/.gitignore index 237ed7db1d..8e300722ea 100644 --- a/.gitignore +++ b/.gitignore @@ -144,9 +144,6 @@ cmake_install.cmake /lib/*/win32/1 # /lib/addons/ -/lib/addons/library.kodi.guilib/Makefile -/lib/addons/library.kodi.guilib/project/VS2010Express/Release -/lib/addons/library.kodi.guilib/project/VS2010Express/Debug /lib/addons/library.xbmc.addon/Makefile /lib/addons/library.kodi.game/Makefile /lib/addons/library.xbmc.addon/project/VS2010Express/Release @@ -528,8 +525,6 @@ lib/cpluff/stamp-h1 /addons/library.xbmc.addon/libXBMC_addon.dll /addons/library.xbmc.addon/libXBMC_addon.lib -/addons/library.kodi.guilib/libKODI_guilib.dll -/addons/library.kodi.guilib/libKODI_guilib.lib /pvr-addons /adsp-addons diff --git a/Makefile.in b/Makefile.in index 257bc9d143..1889649e38 100644 --- a/Makefile.in +++ b/Makefile.in @@ -237,7 +237,6 @@ LIB_DIRS=\ LIBADDON_DIRS=\ lib/addons/library.xbmc.addon \ - lib/addons/library.kodi.guilib \ lib/addons/library.kodi.game \ ESTUARY_MEDIA=addons/skin.estuary/media @@ -357,7 +356,6 @@ dllloader: exports xbmc/cores/DllLoader/dllloader.a libaddon: exports $(MAKE) -C lib/addons/library.xbmc.addon $(MAKE) -C lib/addons/library.kodi.game - $(MAKE) -C lib/addons/library.kodi.guilib dvdpcodecs: dllloader $(MAKE) -C lib/libdvd diff --git a/Makefile.include.in b/Makefile.include.in index 30ce392a7c..7688545c60 100644 --- a/Makefile.include.in +++ b/Makefile.include.in @@ -41,7 +41,6 @@ INCLUDES+=-I@abs_top_srcdir@ INCLUDES+=-I@abs_top_srcdir@/lib INCLUDES+=-I@abs_top_srcdir@/xbmc INCLUDES+=-I@abs_top_srcdir@/xbmc/addons/kodi-addon-dev-kit/include -INCLUDES+=-I@abs_top_srcdir@/addons/library.kodi.guilib INCLUDES+=-I@abs_top_srcdir@/addons/library.xbmc.addon INCLUDES+=$(sort @INCLUDES@) INCLUDES+=-I@abs_top_srcdir@/xbmc/linux diff --git a/configure.ac b/configure.ac index cb16c21638..ca1c4da414 100644 --- a/configure.ac +++ b/configure.ac @@ -2192,9 +2192,7 @@ OUTPUT_FILES="Makefile \ xbmc/windowing/Makefile \ xbmc/windowing/egl/Makefile \ lib/addons/library.xbmc.addon/Makefile \ - lib/addons/library.kodi.audioengine/Makefile \ lib/addons/library.kodi.game/Makefile \ - lib/addons/library.kodi.guilib/Makefile \ tools/Linux/kodi.sh \ tools/Linux/kodi-standalone.sh \ tools/Linux/kodi-xsession.desktop \ diff --git a/lib/addons/library.kodi.guilib/CMakeLists.txt b/lib/addons/library.kodi.guilib/CMakeLists.txt deleted file mode 100644 index 70e11fb3e6..0000000000 --- a/lib/addons/library.kodi.guilib/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(KODI_guilib) -core_add_addon_library(${PROJECT_NAME}) diff --git a/lib/addons/library.kodi.guilib/Makefile.in b/lib/addons/library.kodi.guilib/Makefile.in deleted file mode 100644 index 350fbb26e5..0000000000 --- a/lib/addons/library.kodi.guilib/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -ARCH=@ARCH@ -INCLUDES=-I. -I../../../xbmc/addons/kodi-addon-dev-kit/include/kodi -I../../../xbmc/addons/kodi-addon-dev-kit/include -I../../../xbmc -I../../../xbmc/cores/VideoPlayer/DVDDemuxers -DEFINES+= -CXXFLAGS=-fPIC -LIBNAME=libKODI_guilib -OBJS=$(LIBNAME).o - -LIB_INTERFACE=../../../xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h - -ifeq ($(findstring osx,$(ARCH)), osx) -LIB_SHARED=../../../addons/library.kodi.guilib/$(LIBNAME)-$(ARCH).dylib -else -LIB_SHARED=../../../addons/library.kodi.guilib/$(LIBNAME)-$(ARCH).so -endif - -GENERATED_ADDON_GUILIB = ../../../addons/kodi.guilib/addon.xml -LIB_VERSION := $(shell sed -n 's/.*KODI_GUILIB_API_VERSION[[:space:]]*"\(.*\)"/\1/p' $(LIB_INTERFACE)) -LIB_VERSION_MIN := $(shell sed -n 's/.*KODI_GUILIB_MIN_API_VERSION[[:space:]]*"\(.*\)"/\1/p' $(LIB_INTERFACE)) - -all: $(LIB_SHARED) $(GENERATED_ADDON_GUILIB) - -$(LIB_SHARED): $(OBJS) $(LIB_INTERFACE) -ifeq ($(findstring osx,$(ARCH)), osx) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -dynamiclib -o $@ $(OBJS) -else - $(CXX) $(CFLAGS) $(LDFLAGS) -shared -g -o $(LIB_SHARED) $(OBJS) -endif - -$(GENERATED_ADDON_GUILIB) : $(LIB_INTERFACE) - sed -e s/@guilib_version@/$(LIB_VERSION)/g -e s/@guilib_version_min@/$(LIB_VERSION_MIN)/g $@.in > $@ - -CLEAN_FILES = \ - $(LIB_SHARED) \ - -DISTCLEAN_FILES= \ - Makefile \ - -include ../../../Makefile.include diff --git a/lib/addons/library.kodi.guilib/libKODI_guilib.cpp b/lib/addons/library.kodi.guilib/libKODI_guilib.cpp deleted file mode 100644 index 7113be7c23..0000000000 --- a/lib/addons/library.kodi.guilib/libKODI_guilib.cpp +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * Copyright (C) 2012-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string> -#include "addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.h" - -#ifdef _WIN32 -#include <windows.h> -#define DLLEXPORT __declspec(dllexport) -#else -#define DLLEXPORT -#endif - -using namespace std; -using namespace KodiAPI::V1::GUI; - -extern "C" -{ - -DLLEXPORT void* GUI_register_me(void *hdl) -{ - CB_GUILib *cb = NULL; - if (!hdl) - fprintf(stderr, "libXBMC_gui-ERROR: GUILib_register_me is called with NULL handle !!!\n"); - else - { - cb = (CB_GUILib*)((AddonCB*)hdl)->GUILib_RegisterMe(((AddonCB*)hdl)->addonData); - if (!cb) - fprintf(stderr, "libXBMC_gui-ERROR: GUILib_register_me can't get callback table from XBMC !!!\n"); - } - return cb; -} - -DLLEXPORT void GUI_unregister_me(void *hdl, void *cb) -{ - if (hdl && cb) - ((AddonCB*)hdl)->GUILib_UnRegisterMe(((AddonCB*)hdl)->addonData, (CB_GUILib*)cb); -} - -DLLEXPORT void GUI_lock(void *hdl, void *cb) -{ - ((CB_GUILib*)cb)->Lock(); -} - -DLLEXPORT void GUI_unlock(void *hdl, void *cb) -{ - ((CB_GUILib*)cb)->Unlock(); -} - -DLLEXPORT int GUI_get_screen_height(void *hdl, void *cb) -{ - return ((CB_GUILib*)cb)->GetScreenHeight(); -} - -DLLEXPORT int GUI_get_screen_width(void *hdl, void *cb) -{ - return ((CB_GUILib*)cb)->GetScreenWidth(); -} - -DLLEXPORT int GUI_get_video_resolution(void *hdl, void *cb) -{ - return ((CB_GUILib*)cb)->GetVideoResolution(); -} - -/*! @name GUI Keyboard functions */ -//@{ -DLLEXPORT bool GUI_dialog_keyboard_show_and_get_input_with_head(void *hdl, void *cb, char &aTextString, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndGetInputWithHead(aTextString, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_show_and_get_input(void *hdl, void *cb, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndGetInput(aTextString, iMaxStringSize, allowEmptyResult, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_show_and_get_new_password_with_head(void *hdl, void *cb, char &newPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndGetNewPasswordWithHead(newPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_show_and_get_new_password(void *hdl, void *cb, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndGetNewPassword(strNewPassword, iMaxStringSize, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_show_and_verify_new_password_with_head(void *hdl, void *cb, char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead(strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_show_and_verify_new_password(void *hdl, void *cb, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndVerifyNewPassword(strNewPassword, iMaxStringSize, autoCloseMs); -} - -DLLEXPORT int GUI_dialog_keyboard_show_and_verify_password(void *hdl, void *cb, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndVerifyPassword(strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_show_and_get_filter(void *hdl, void *cb, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_ShowAndGetFilter(aTextString, iMaxStringSize, searching, autoCloseMs); -} - -DLLEXPORT bool GUI_dialog_keyboard_send_text_to_active_keyboard(void *hdl, void *cb, const char *aTextString, bool closeKeyboard) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_SendTextToActiveKeyboard(aTextString, closeKeyboard); -} - -DLLEXPORT bool GUI_dialog_keyboard_is_activated(void *hdl, void *cb) -{ - return ((CB_GUILib*)cb)->Dialog_Keyboard_isKeyboardActivated(); -} -//@} - -/*! @name GUI Numeric functions */ -//@{ -DLLEXPORT bool GUI_dialog_numeric_show_and_verify_new_password(void *hdl, void *cb, char &strNewPassword, unsigned int iMaxStringSize) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndVerifyNewPassword(strNewPassword, iMaxStringSize); -} - -DLLEXPORT int GUI_dialog_numeric_show_and_verify_password(void *hdl, void *cb, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndVerifyPassword(strPassword, iMaxStringSize, strHeading, iRetries); -} - -DLLEXPORT bool GUI_dialog_numeric_show_and_verify_input(void *hdl, void *cb, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndVerifyInput(strPassword, iMaxStringSize, strHeading, bGetUserInput); -} - -DLLEXPORT bool GUI_dialog_numeric_show_and_get_time(void *hdl, void *cb, tm &time, const char *strHeading) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndGetTime(time, strHeading); -} - -DLLEXPORT bool GUI_dialog_numeric_show_and_get_date(void *hdl, void *cb, tm &date, const char *strHeading) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndGetDate(date, strHeading); -} - -DLLEXPORT bool GUI_dialog_numeric_show_and_get_ipaddress(void *hdl, void *cb, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndGetIPAddress(IPAddress, iMaxStringSize, strHeading); -} - -DLLEXPORT bool GUI_dialog_numeric_show_and_get_number(void *hdl, void *cb, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndGetNumber(strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs); -} - -DLLEXPORT bool GUI_dialog_numeric_show_and_get_seconds(void *hdl, void *cb, char &timeString, unsigned int iMaxStringSize, const char *strHeading) -{ - return ((CB_GUILib*)cb)->Dialog_Numeric_ShowAndGetSeconds(timeString, iMaxStringSize, strHeading); -} -//@} - -/*! @name GUI File browser functions */ -//@{ -DLLEXPORT bool GUI_dialog_filebrowser_show_and_get_file(void *hdl, void *cb, const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false) -{ - return ((CB_GUILib*)cb)->Dialog_FileBrowser_ShowAndGetFile(directory, mask, heading, path, iMaxStringSize, useThumbs, useFileDirectories, singleList); -} -//@} - -/*! @name GUI OK Dialog functions */ -//@{ -DLLEXPORT void GUI_dialog_ok_show_and_get_input_single_text(void *hdl, void *cb, const char *heading, const char *text) -{ - return ((CB_GUILib*)cb)->Dialog_OK_ShowAndGetInputSingleText(heading, text); -} - -DLLEXPORT void GUI_dialog_ok_show_and_get_input_line_text(void *hdl, void *cb, const char *heading, const char *line0, const char *line1, const char *line2) -{ - return ((CB_GUILib*)cb)->Dialog_OK_ShowAndGetInputLineText(heading, line0, line1, line2); -} -//@} - -/*! @name GUI OK Dialog functions */ -//@{ -DLLEXPORT bool GUI_dialog_yesno_show_and_get_input_linetext(void *hdl, void *cb, const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel) -{ - return ((CB_GUILib*)cb)->Dialog_YesNo_ShowAndGetInputLineText(heading, line0, line1, line2, noLabel, yesLabel); -} - -DLLEXPORT bool GUI_dialog_yesno_show_and_get_input_singletext(void *hdl, void *cb, const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel) -{ - return ((CB_GUILib*)cb)->Dialog_YesNo_ShowAndGetInputSingleText(heading, text, bCanceled, noLabel, yesLabel); -} - -DLLEXPORT bool GUI_dialog_yesno_show_and_get_input_linebuttontext(void *hdl, void *cb, const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel) -{ - return ((CB_GUILib*)cb)->Dialog_YesNo_ShowAndGetInputLineButtonText(heading, line0, line1, line2, bCanceled, noLabel, yesLabel); -} -//@} - -/*! @name GUI Text viewer Dialog */ -//@{ -DLLEXPORT void GUI_dialog_text_viewer(void *hdl, void *cb, const char *heading, const char *text) -{ - return ((CB_GUILib*)cb)->Dialog_TextViewer(heading, text); -} -//@} - -/*! @name GUI select Dialog */ -//@{ -DLLEXPORT int GUI_dialog_select(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected) -{ - return ((CB_GUILib*)cb)->Dialog_Select(heading, entries, size, selected); -} -//@} - - -DLLEXPORT CAddonGUIWindow* GUI_Window_create(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) -{ - return new CAddonGUIWindow(hdl, cb, xmlFilename, defaultSkin, forceFallback, asDialog); -} - -DLLEXPORT void GUI_Window_destroy(CAddonGUIWindow* p) -{ - delete p; -} - -DLLEXPORT bool GUI_Window_OnClick(GUIHANDLE handle, int controlId) -{ - CAddonGUIWindow *window = (CAddonGUIWindow*) handle; - return window->OnClick(controlId); -} - -DLLEXPORT bool GUI_Window_OnFocus(GUIHANDLE handle, int controlId) -{ - CAddonGUIWindow *window = (CAddonGUIWindow*) handle; - return window->OnFocus(controlId); -} - -DLLEXPORT bool GUI_Window_OnInit(GUIHANDLE handle) -{ - CAddonGUIWindow *window = (CAddonGUIWindow*) handle; - return window->OnInit(); -} - -DLLEXPORT bool GUI_Window_OnAction(GUIHANDLE handle, int actionId) -{ - CAddonGUIWindow *window = (CAddonGUIWindow*) handle; - return window->OnAction(actionId); -} - -CAddonGUIWindow::CAddonGUIWindow(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) - : m_Handle(hdl) - , m_cb(cb) -{ - CBOnInit = nullptr; - CBOnClick = nullptr; - CBOnFocus = nullptr; - CBOnAction = nullptr; - m_WindowHandle = nullptr; - m_cbhdl = nullptr; - - if (hdl && cb) - { - m_WindowHandle = ((CB_GUILib*)m_cb)->Window_New(((AddonCB*)m_Handle)->addonData, xmlFilename, defaultSkin, forceFallback, asDialog); - if (!m_WindowHandle) - fprintf(stderr, "libXBMC_gui-ERROR: cGUIWindow can't create window class from XBMC !!!\n"); - - ((CB_GUILib*)m_cb)->Window_SetCallbacks(((AddonCB*)m_Handle)->addonData, m_WindowHandle, this, GUI_Window_OnInit, GUI_Window_OnClick, GUI_Window_OnFocus, GUI_Window_OnAction); - } -} - -CAddonGUIWindow::~CAddonGUIWindow() -{ - if (m_Handle && m_cb && m_WindowHandle) - { - ((CB_GUILib*)m_cb)->Window_Delete(((AddonCB*)m_Handle)->addonData, m_WindowHandle); - m_WindowHandle = NULL; - } -} - -bool CAddonGUIWindow::Show() -{ - return ((CB_GUILib*)m_cb)->Window_Show(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -void CAddonGUIWindow::Close() -{ - ((CB_GUILib*)m_cb)->Window_Close(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -void CAddonGUIWindow::DoModal() -{ - ((CB_GUILib*)m_cb)->Window_DoModal(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -bool CAddonGUIWindow::OnInit() -{ - if (!CBOnInit) - return false; - - return CBOnInit(m_cbhdl); -} - -bool CAddonGUIWindow::OnClick(int controlId) -{ - if (!CBOnClick) - return false; - - return CBOnClick(m_cbhdl, controlId); -} - -bool CAddonGUIWindow::OnFocus(int controlId) -{ - if (!CBOnFocus) - return false; - - return CBOnFocus(m_cbhdl, controlId); -} - -bool CAddonGUIWindow::OnAction(int actionId) -{ - if (!CBOnAction) - return false; - - return CBOnAction(m_cbhdl, actionId); -} - -bool CAddonGUIWindow::SetFocusId(int iControlId) -{ - return ((CB_GUILib*)m_cb)->Window_SetFocusId(((AddonCB*)m_Handle)->addonData, m_WindowHandle, iControlId); -} - -int CAddonGUIWindow::GetFocusId() -{ - return ((CB_GUILib*)m_cb)->Window_GetFocusId(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -bool CAddonGUIWindow::SetCoordinateResolution(int res) -{ - return ((CB_GUILib*)m_cb)->Window_SetCoordinateResolution(((AddonCB*)m_Handle)->addonData, m_WindowHandle, res); -} - -void CAddonGUIWindow::SetProperty(const char *key, const char *value) -{ - ((CB_GUILib*)m_cb)->Window_SetProperty(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key, value); -} - -void CAddonGUIWindow::SetPropertyInt(const char *key, int value) -{ - ((CB_GUILib*)m_cb)->Window_SetPropertyInt(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key, value); -} - -void CAddonGUIWindow::SetPropertyBool(const char *key, bool value) -{ - ((CB_GUILib*)m_cb)->Window_SetPropertyBool(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key, value); -} - -void CAddonGUIWindow::SetPropertyDouble(const char *key, double value) -{ - ((CB_GUILib*)m_cb)->Window_SetPropertyDouble(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key, value); -} - -const char *CAddonGUIWindow::GetProperty(const char *key) const -{ - return ((CB_GUILib*)m_cb)->Window_GetProperty(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key); -} - -int CAddonGUIWindow::GetPropertyInt(const char *key) const -{ - return ((CB_GUILib*)m_cb)->Window_GetPropertyInt(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key); -} - -bool CAddonGUIWindow::GetPropertyBool(const char *key) const -{ - return ((CB_GUILib*)m_cb)->Window_GetPropertyBool(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key); -} - -double CAddonGUIWindow::GetPropertyDouble(const char *key) const -{ - return ((CB_GUILib*)m_cb)->Window_GetPropertyDouble(((AddonCB*)m_Handle)->addonData, m_WindowHandle, key); -} - -void CAddonGUIWindow::ClearProperties() -{ - ((CB_GUILib*)m_cb)->Window_ClearProperties(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -int CAddonGUIWindow::GetListSize() -{ - return ((CB_GUILib*)m_cb)->Window_GetListSize(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -void CAddonGUIWindow::ClearList() -{ - ((CB_GUILib*)m_cb)->Window_ClearList(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -GUIHANDLE CAddonGUIWindow::AddStringItem(const char *name, int itemPosition) -{ - return ((CB_GUILib*)m_cb)->Window_AddStringItem(((AddonCB*)m_Handle)->addonData, m_WindowHandle, name, itemPosition); -} - -void CAddonGUIWindow::AddItem(GUIHANDLE item, int itemPosition) -{ - ((CB_GUILib*)m_cb)->Window_AddItem(((AddonCB*)m_Handle)->addonData, m_WindowHandle, item, itemPosition); -} - -void CAddonGUIWindow::AddItem(CAddonListItem *item, int itemPosition) -{ - ((CB_GUILib*)m_cb)->Window_AddItem(((AddonCB*)m_Handle)->addonData, m_WindowHandle, item->m_ListItemHandle, itemPosition); -} - -void CAddonGUIWindow::RemoveItem(int itemPosition) -{ - ((CB_GUILib*)m_cb)->Window_RemoveItem(((AddonCB*)m_Handle)->addonData, m_WindowHandle, itemPosition); -} - -GUIHANDLE CAddonGUIWindow::GetListItem(int listPos) -{ - return ((CB_GUILib*)m_cb)->Window_GetListItem(((AddonCB*)m_Handle)->addonData, m_WindowHandle, listPos); -} - -void CAddonGUIWindow::SetCurrentListPosition(int listPos) -{ - ((CB_GUILib*)m_cb)->Window_SetCurrentListPosition(((AddonCB*)m_Handle)->addonData, m_WindowHandle, listPos); -} - -int CAddonGUIWindow::GetCurrentListPosition() -{ - return ((CB_GUILib*)m_cb)->Window_GetCurrentListPosition(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -void CAddonGUIWindow::SetControlLabel(int controlId, const char *label) -{ - ((CB_GUILib*)m_cb)->Window_SetControlLabel(((AddonCB*)m_Handle)->addonData, m_WindowHandle, controlId, label); -} - -void CAddonGUIWindow::MarkDirtyRegion() -{ - ((CB_GUILib*)m_cb)->Window_MarkDirtyRegion(((AddonCB*)m_Handle)->addonData, m_WindowHandle); -} - -///------------------------------------- -/// cGUISpinControl - -DLLEXPORT CAddonGUISpinControl* GUI_control_get_spin(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) -{ - return new CAddonGUISpinControl(hdl, cb, window, controlId); -} - -DLLEXPORT void GUI_control_release_spin(CAddonGUISpinControl* p) -{ - delete p; -} - -CAddonGUISpinControl::CAddonGUISpinControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) - : m_Window(window) -{ - m_Handle = hdl; - m_cb = cb; - m_SpinHandle = ((CB_GUILib*)m_cb)->Window_GetControl_Spin(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId); -} - -void CAddonGUISpinControl::SetVisible(bool yesNo) -{ - if (m_SpinHandle) - ((CB_GUILib*)m_cb)->Control_Spin_SetVisible(((AddonCB*)m_Handle)->addonData, m_SpinHandle, yesNo); -} - -void CAddonGUISpinControl::SetText(const char *label) -{ - if (m_SpinHandle) - ((CB_GUILib*)m_cb)->Control_Spin_SetText(((AddonCB*)m_Handle)->addonData, m_SpinHandle, label); -} - -void CAddonGUISpinControl::Clear() -{ - if (m_SpinHandle) - ((CB_GUILib*)m_cb)->Control_Spin_Clear(((AddonCB*)m_Handle)->addonData, m_SpinHandle); -} - -void CAddonGUISpinControl::AddLabel(const char *label, int iValue) -{ - if (m_SpinHandle) - ((CB_GUILib*)m_cb)->Control_Spin_AddLabel(((AddonCB*)m_Handle)->addonData, m_SpinHandle, label, iValue); -} - -int CAddonGUISpinControl::GetValue() -{ - if (!m_SpinHandle) - return -1; - - return ((CB_GUILib*)m_cb)->Control_Spin_GetValue(((AddonCB*)m_Handle)->addonData, m_SpinHandle); -} - -void CAddonGUISpinControl::SetValue(int iValue) -{ - if (m_SpinHandle) - ((CB_GUILib*)m_cb)->Control_Spin_SetValue(((AddonCB*)m_Handle)->addonData, m_SpinHandle, iValue); -} - -///--m_cb----------------------------------- -/// cGUIRadioButton - -DLLEXPORT CAddonGUIRadioButton* GUI_control_get_radiobutton(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) -{ - return new CAddonGUIRadioButton(hdl, cb, window, controlId); -} - -DLLEXPORT void GUI_control_release_radiobutton(CAddonGUIRadioButton* p) -{ - delete p; -} - -CAddonGUIRadioButton::CAddonGUIRadioButton(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) - : m_Window(window) - , m_Handle(hdl) - , m_cb(cb) -{ - m_ButtonHandle = ((CB_GUILib*)m_cb)->Window_GetControl_RadioButton(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId); -} - -void CAddonGUIRadioButton::SetVisible(bool yesNo) -{ - if (m_ButtonHandle) - ((CB_GUILib*)m_cb)->Control_RadioButton_SetVisible(((AddonCB*)m_Handle)->addonData, m_ButtonHandle, yesNo); -} - -void CAddonGUIRadioButton::SetText(const char *label) -{ - if (m_ButtonHandle) - ((CB_GUILib*)m_cb)->Control_RadioButton_SetText(((AddonCB*)m_Handle)->addonData, m_ButtonHandle, label); -} - -void CAddonGUIRadioButton::SetSelected(bool yesNo) -{ - if (m_ButtonHandle) - ((CB_GUILib*)m_cb)->Control_RadioButton_SetSelected(((AddonCB*)m_Handle)->addonData, m_ButtonHandle, yesNo); -} - -bool CAddonGUIRadioButton::IsSelected() -{ - if (!m_ButtonHandle) - return false; - - return ((CB_GUILib*)m_cb)->Control_RadioButton_IsSelected(((AddonCB*)m_Handle)->addonData, m_ButtonHandle); -} - - -///------------------------------------- -/// cGUIProgressControl - -DLLEXPORT CAddonGUIProgressControl* GUI_control_get_progress(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) -{ - return new CAddonGUIProgressControl(hdl, cb, window, controlId); -} - -DLLEXPORT void GUI_control_release_progress(CAddonGUIProgressControl* p) -{ - delete p; -} - -CAddonGUIProgressControl::CAddonGUIProgressControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) - : m_Window(window) - , m_Handle(hdl) - , m_cb(cb) -{ - m_ProgressHandle = ((CB_GUILib*)m_cb)->Window_GetControl_Progress(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId); -} - -void CAddonGUIProgressControl::SetPercentage(float fPercent) -{ - if (m_ProgressHandle) - ((CB_GUILib*)m_cb)->Control_Progress_SetPercentage(((AddonCB*)m_Handle)->addonData, m_ProgressHandle, fPercent); -} - -float CAddonGUIProgressControl::GetPercentage() const -{ - if (!m_ProgressHandle) - return 0.0f; - - return ((CB_GUILib*)m_cb)->Control_Progress_GetPercentage(((AddonCB*)m_Handle)->addonData, m_ProgressHandle); -} - -void CAddonGUIProgressControl::SetInfo(int iInfo) -{ - if (m_ProgressHandle) - ((CB_GUILib*)m_cb)->Control_Progress_SetInfo(((AddonCB*)m_Handle)->addonData, m_ProgressHandle, iInfo); -} - -int CAddonGUIProgressControl::GetInfo() const -{ - if (!m_ProgressHandle) - return -1; - - return ((CB_GUILib*)m_cb)->Control_Progress_GetInfo(((AddonCB*)m_Handle)->addonData, m_ProgressHandle); -} - -string CAddonGUIProgressControl::GetDescription() const -{ - if (!m_ProgressHandle) - return ""; - - return ((CB_GUILib*)m_cb)->Control_Progress_GetDescription(((AddonCB*)m_Handle)->addonData, m_ProgressHandle); -} - - -///------------------------------------- -/// cGUISliderControl - -DLLEXPORT CAddonGUISliderControl* GUI_control_get_slider(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) -{ - return new CAddonGUISliderControl(hdl, cb, window, controlId); -} - -DLLEXPORT void GUI_control_release_slider(CAddonGUISliderControl* p) -{ - delete p; -} - -CAddonGUISliderControl::CAddonGUISliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) - : m_Window(window) - , m_Handle(hdl) - , m_cb(cb) -{ - m_SliderHandle = ((CB_GUILib*)m_cb)->Window_GetControl_Slider(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId); -} - -void CAddonGUISliderControl::SetVisible(bool yesNo) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetVisible(((AddonCB*)m_Handle)->addonData, m_SliderHandle, yesNo); -} - -string CAddonGUISliderControl::GetDescription() const -{ - if (!m_SliderHandle) - return ""; - - return ((CB_GUILib*)m_cb)->Control_Slider_GetDescription(((AddonCB*)m_Handle)->addonData, m_SliderHandle); -} - -void CAddonGUISliderControl::SetIntRange(int iStart, int iEnd) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetIntRange(((AddonCB*)m_Handle)->addonData, m_SliderHandle, iStart, iEnd); -} - -void CAddonGUISliderControl::SetIntValue(int iValue) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetIntValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle, iValue); -} - -int CAddonGUISliderControl::GetIntValue() const -{ - if (!m_SliderHandle) - return 0; - return ((CB_GUILib*)m_cb)->Control_Slider_GetIntValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle); -} - -void CAddonGUISliderControl::SetIntInterval(int iInterval) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetIntInterval(((AddonCB*)m_Handle)->addonData, m_SliderHandle, iInterval); -} - -void CAddonGUISliderControl::SetPercentage(float fPercent) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetPercentage(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fPercent); -} - -float CAddonGUISliderControl::GetPercentage() const -{ - if (!m_SliderHandle) - return 0.0f; - - return ((CB_GUILib*)m_cb)->Control_Slider_GetPercentage(((AddonCB*)m_Handle)->addonData, m_SliderHandle); -} - -void CAddonGUISliderControl::SetFloatRange(float fStart, float fEnd) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetFloatRange(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fStart, fEnd); -} - -void CAddonGUISliderControl::SetFloatValue(float fValue) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetFloatValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fValue); -} - -float CAddonGUISliderControl::GetFloatValue() const -{ - if (!m_SliderHandle) - return 0.0f; - return ((CB_GUILib*)m_cb)->Control_Slider_GetFloatValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle); -} - -void CAddonGUISliderControl::SetFloatInterval(float fInterval) -{ - if (m_SliderHandle) - ((CB_GUILib*)m_cb)->Control_Slider_SetFloatInterval(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fInterval); -} - - -///------------------------------------- -/// cGUISettingsSliderControl - -DLLEXPORT CAddonGUISettingsSliderControl* GUI_control_get_settings_slider(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) -{ - return new CAddonGUISettingsSliderControl(hdl, cb, window, controlId); -} - -DLLEXPORT void GUI_control_release_settings_slider(CAddonGUISettingsSliderControl* p) -{ - delete p; -} - -CAddonGUISettingsSliderControl::CAddonGUISettingsSliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) - : m_Window(window) - , m_Handle(hdl) - , m_cb(cb) -{ - m_SettingsSliderHandle = ((CB_GUILib*)m_cb)->Window_GetControl_SettingsSlider(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId); -} - -void CAddonGUISettingsSliderControl::SetVisible(bool yesNo) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetVisible(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, yesNo); -} - -void CAddonGUISettingsSliderControl::SetText(const char *label) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetText(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, label); -} - -string CAddonGUISettingsSliderControl::GetDescription() const -{ - if (!m_SettingsSliderHandle) - return ""; - - return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetDescription(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle); -} - -void CAddonGUISettingsSliderControl::SetIntRange(int iStart, int iEnd) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetIntRange(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, iStart, iEnd); -} - -void CAddonGUISettingsSliderControl::SetIntValue(int iValue) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetIntValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, iValue); -} - -int CAddonGUISettingsSliderControl::GetIntValue() const -{ - if (!m_SettingsSliderHandle) - return 0; - return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetIntValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle); -} - -void CAddonGUISettingsSliderControl::SetIntInterval(int iInterval) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetIntInterval(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, iInterval); -} - -void CAddonGUISettingsSliderControl::SetPercentage(float fPercent) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetPercentage(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fPercent); -} - -float CAddonGUISettingsSliderControl::GetPercentage() const -{ - if (!m_SettingsSliderHandle) - return 0.0f; - - return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetPercentage(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle); -} - -void CAddonGUISettingsSliderControl::SetFloatRange(float fStart, float fEnd) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetFloatRange(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fStart, fEnd); -} - -void CAddonGUISettingsSliderControl::SetFloatValue(float fValue) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetFloatValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fValue); -} - -float CAddonGUISettingsSliderControl::GetFloatValue() const -{ - if (!m_SettingsSliderHandle) - return 0.0f; - return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetFloatValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle); -} - -void CAddonGUISettingsSliderControl::SetFloatInterval(float fInterval) -{ - if (m_SettingsSliderHandle) - ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetFloatInterval(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fInterval); -} - - -///------------------------------------- -/// cListItem - -DLLEXPORT CAddonListItem* GUI_ListItem_create(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) -{ - return new CAddonListItem(hdl, cb, label, label2, iconImage, thumbnailImage, path); -} - -DLLEXPORT void GUI_ListItem_destroy(CAddonListItem* p) -{ - delete p; -} - - -CAddonListItem::CAddonListItem(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) - : m_Handle(hdl) - , m_cb(cb) -{ - m_ListItemHandle = ((CB_GUILib*)m_cb)->ListItem_Create(((AddonCB*)m_Handle)->addonData, label, label2, iconImage, thumbnailImage, path); -} - -const char *CAddonListItem::GetLabel() -{ - if (!m_ListItemHandle) - return ""; - - return ((CB_GUILib*)m_cb)->ListItem_GetLabel(((AddonCB*)m_Handle)->addonData, m_ListItemHandle); -} - -void CAddonListItem::SetLabel(const char *label) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetLabel(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, label); -} - -const char *CAddonListItem::GetLabel2() -{ - if (!m_ListItemHandle) - return ""; - - return ((CB_GUILib*)m_cb)->ListItem_GetLabel2(((AddonCB*)m_Handle)->addonData, m_ListItemHandle); -} - -void CAddonListItem::SetLabel2(const char *label) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetLabel2(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, label); -} - -void CAddonListItem::SetIconImage(const char *image) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetIconImage(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, image); -} - -void CAddonListItem::SetThumbnailImage(const char *image) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetThumbnailImage(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, image); -} - -void CAddonListItem::SetInfo(const char *Info) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetInfo(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, Info); -} - -void CAddonListItem::SetProperty(const char *key, const char *value) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetProperty(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, key, value); -} - -const char *CAddonListItem::GetProperty(const char *key) const -{ - if (!m_ListItemHandle) - return ""; - - return ((CB_GUILib*)m_cb)->ListItem_GetProperty(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, key); -} - -void CAddonListItem::SetPath(const char *Path) -{ - if (m_ListItemHandle) - ((CB_GUILib*)m_cb)->ListItem_SetPath(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, Path); -} - -///------------------------------------- -/// cGUIRenderingControl - -DLLEXPORT CAddonGUIRenderingControl* GUI_control_get_rendering(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) -{ - return new CAddonGUIRenderingControl(hdl, cb, window, controlId); -} - -DLLEXPORT void GUI_control_release_rendering(CAddonGUIRenderingControl* p) -{ - delete p; -} - -DLLEXPORT bool GUI_control_rendering_create(GUIHANDLE handle, int x, int y, int w, int h, void *device) -{ - CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle; - return pControl->Create(x,y,w,h,device); -} - -DLLEXPORT void GUI_control_rendering_render(GUIHANDLE handle) -{ - CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle; - pControl->Render(); -} - -DLLEXPORT void GUI_control_rendering_stop(GUIHANDLE handle) -{ - CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle; - pControl->Stop(); -} - -DLLEXPORT bool GUI_control_rendering_dirty(GUIHANDLE handle) -{ - CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle; - return pControl->Dirty(); -} - -CAddonGUIRenderingControl::CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId) - : m_cbhdl(nullptr) - , CBCreate(nullptr) - , CBRender(nullptr) - , CBStop(nullptr) - , CBDirty(nullptr) - , m_Window(window) - , m_Handle(hdl) - , m_cb(cb) -{ - m_RenderingHandle = ((CB_GUILib*)m_cb)->Window_GetControl_RenderAddon(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId); -} - -CAddonGUIRenderingControl::~CAddonGUIRenderingControl() -{ - ((CB_GUILib*)m_cb)->RenderAddon_Delete(((AddonCB*)m_Handle)->addonData, m_RenderingHandle); -} - -void CAddonGUIRenderingControl::Init() -{ - ((CB_GUILib*)m_cb)->RenderAddon_SetCallbacks(((AddonCB*)m_Handle)->addonData, m_RenderingHandle, this, GUI_control_rendering_create, GUI_control_rendering_render, GUI_control_rendering_stop, GUI_control_rendering_dirty); -} - -bool CAddonGUIRenderingControl::Create(int x, int y, int w, int h, void *device) -{ - if (!CBCreate) - return false; - - return CBCreate(m_cbhdl, x, y, w, h, device); -} - -void CAddonGUIRenderingControl::Render() -{ - if (!CBRender) - return; - - CBRender(m_cbhdl); -} - -void CAddonGUIRenderingControl::Stop() -{ - if (!CBStop) - return; - - CBStop(m_cbhdl); -} - -bool CAddonGUIRenderingControl::Dirty() -{ - if (!CBDirty) - return true; - - return CBDirty(m_cbhdl); -} -}; diff --git a/lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj b/lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj deleted file mode 100644 index fd63cdc5f1..0000000000 --- a/lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\libKODI_guilib.cpp" /> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}</ProjectGuid> - <RootNamespace>XBMC_VDR</RootNamespace> - <Keyword>Win32Proj</Keyword> - <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(SolutionDir)\XBMC.core-defaults.props" /> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets"> - <Import Project="$(SolutionDir)\XBMC.defaults.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\..\addons\library.kodi.guilib\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\..\addons\library.kodi.guilib\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir> - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\..\addons\library.xbmc.addon\;$(IncludePath)</IncludePath> - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\..\addons\library.xbmc.addon\;$(IncludePath)</IncludePath> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\kodi-addon-dev-kit\include\kodi;..\..\..\..\..\xbmc\cores\VideoPlayer\DVDDemuxers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling>Sync</ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <OutputFile>..\..\..\..\..\addons\library.kodi.guilib\$(ProjectName).dll</OutputFile> - </Link> - <PostBuildEvent> - <Command>powershell -ExecutionPolicy ByPass -File $(ProjectDir)\post-build.ps1 $(ProjectDir)</Command> - </PostBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\kodi-addon-dev-kit\include\kodi;..\..\..\..\..\xbmc\cores\VideoPlayer\DVDDemuxers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>HAS_SDL;_USRDLL;XBMC_VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling>Sync</ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <OutputFile>../../../../../addons/library.kodi.guilib/$(ProjectName).dll</OutputFile> - </Link> - <PostBuildEvent> - <Command>powershell -ExecutionPolicy ByPass -File $(ProjectDir)\post-build.ps1 $(ProjectDir)</Command> - </PostBuildEvent> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj.filters b/lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj.filters deleted file mode 100644 index e823d63633..0000000000 --- a/lib/addons/library.kodi.guilib/project/VS2010Express/libKODI_guilib.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\libKODI_guilib.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/lib/addons/library.kodi.guilib/project/VS2010Express/post-build.ps1 b/lib/addons/library.kodi.guilib/project/VS2010Express/post-build.ps1 deleted file mode 100644 index 910d16a543..0000000000 --- a/lib/addons/library.kodi.guilib/project/VS2010Express/post-build.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -param ( -[string]$ProjectDir -) - -$LIB_INTERFACE = "$ProjectDir\..\..\..\..\..\xbmc\addons\kodi-addon-dev-kit\include\kodi\libKODI_guilib.h" -$GENERATED_ADDON_GUILIB = "$ProjectDir\..\..\..\..\..\addons\kodi.guilib\addon.xml" - -$LIB_VERSION = "" -$LIB_VERSION_MIN = "" -cat $LIB_INTERFACE | %{ -if ($_ -match 'KODI_GUILIB_API_VERSION\s*"(.*)"'){ - $LIB_VERSION = $matches[1] - } -if ($_ -match 'KODI_GUILIB_MIN_API_VERSION\s*"(.*)"'){ - $LIB_VERSION_MIN = $matches[1] - } -} - -$ADDON_GUILIB = get-content "$GENERATED_ADDON_GUILIB.in" -foreach ($i in 0 .. ($ADDON_GUILIB.Length -1)) { - $ADDON_GUILIB[$i] = $ADDON_GUILIB[$i].Replace("@guilib_version@", $LIB_VERSION).Replace("@guilib_version_min@", $LIB_VERSION_MIN) -} - -#WriteAllLines does not overwrite so remove the existing file here. -del $GENERATED_ADDON_GUILIB -Force - -#create utf8 encoding without bom -$U8 = New-Object System.Text.UTF8Encoding($False) -[System.IO.File]::WriteAllLines($GENERATED_ADDON_GUILIB, $ADDON_GUILIB, $U8) diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt index b807bd5366..cca552e750 100644 --- a/project/cmake/installdata/common/addons.txt +++ b/project/cmake/installdata/common/addons.txt @@ -19,7 +19,6 @@ addons/xbmc.pvr/* addons/xbmc.python/* addons/xbmc.webinterface/* addons/library.kodi.game/* -addons/library.kodi.guilib/* addons/library.xbmc.addon/* addons/repository.xbmc.org/* addons/webinterface.default/* diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt index e1243d9261..650534e98f 100644 --- a/project/cmake/treedata/common/addons.txt +++ b/project/cmake/treedata/common/addons.txt @@ -1,3 +1,2 @@ lib/addons/library.kodi.game KODI_game -lib/addons/library.kodi.guilib KODI_guilib lib/addons/library.xbmc.addon XBMC_addon diff --git a/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.cpp b/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.cpp index c1736262f9..aade70fcac 100644 --- a/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.cpp +++ b/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.cpp @@ -256,7 +256,6 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam /* Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the addon */ strSkinPath = g_SkinInfo->GetSkinPath(xmlFilename, &res); - if (!XFILE::CFile::Exists(strSkinPath)) { /* Check for the matching folder for the skin in the fallback skins folder */ @@ -296,6 +295,7 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam return NULL; } } + // window id's 14000 - 14100 are reserved for addons // get first window id that is not in use int id = WINDOW_ADDON_START; diff --git a/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.h b/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.h index 5f077ec887..b04e3ec24e 100644 --- a/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.h +++ b/xbmc/addons/binary/interfaces/api1/GUI/AddonCallbacksGUI.h @@ -35,267 +35,6 @@ namespace V1 namespace GUI { -typedef void (*GUILock)(); -typedef void (*GUIUnlock)(); -typedef int (*GUIGetScreenHeight)(); -typedef int (*GUIGetScreenWidth)(); -typedef int (*GUIGetVideoResolution)(); -typedef GUIHANDLE (*GUIWindow_New)(void *addonData, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); -typedef void (*GUIWindow_Delete)(void *addonData, GUIHANDLE handle); -typedef void (*GUIWindow_SetCallbacks)(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*)(GUIHANDLE handle), bool (*)(GUIHANDLE handle, int), bool (*)(GUIHANDLE handle, int), bool (*)(GUIHANDLE handle, int)); -typedef bool (*GUIWindow_Show)(void *addonData, GUIHANDLE handle); -typedef bool (*GUIWindow_Close)(void *addonData, GUIHANDLE handle); -typedef bool (*GUIWindow_DoModal)(void *addonData, GUIHANDLE handle); -typedef bool (*GUIWindow_SetFocusId)(void *addonData, GUIHANDLE handle, int iControlId); -typedef int (*GUIWindow_GetFocusId)(void *addonData, GUIHANDLE handle); -typedef bool (*GUIWindow_SetCoordinateResolution)(void *addonData, GUIHANDLE handle, int res); -typedef void (*GUIWindow_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value); -typedef void (*GUIWindow_SetPropertyInt)(void *addonData, GUIHANDLE handle, const char *key, int value); -typedef void (*GUIWindow_SetPropertyBool)(void *addonData, GUIHANDLE handle, const char *key, bool value); -typedef void (*GUIWindow_SetPropertyDouble)(void *addonData, GUIHANDLE handle, const char *key, double value); -typedef const char* (*GUIWindow_GetProperty)(void *addonData, GUIHANDLE handle, const char *key); -typedef int (*GUIWindow_GetPropertyInt)(void *addonData, GUIHANDLE handle, const char *key); -typedef bool (*GUIWindow_GetPropertyBool)(void *addonData, GUIHANDLE handle, const char *key); -typedef double (*GUIWindow_GetPropertyDouble)(void *addonData, GUIHANDLE handle, const char *key); -typedef void (*GUIWindow_ClearProperties)(void *addonData, GUIHANDLE handle); -typedef int (*GUIWindow_GetListSize)(void *addonData, GUIHANDLE handle); -typedef void (*GUIWindow_ClearList)(void *addonData, GUIHANDLE handle); -typedef GUIHANDLE (*GUIWindow_AddItem)(void *addonData, GUIHANDLE handle, GUIHANDLE item, int itemPosition); -typedef GUIHANDLE (*GUIWindow_AddStringItem)(void *addonData, GUIHANDLE handle, const char *itemName, int itemPosition); -typedef void (*GUIWindow_RemoveItem)(void *addonData, GUIHANDLE handle, int itemPosition); -typedef GUIHANDLE (*GUIWindow_GetListItem)(void *addonData, GUIHANDLE handle, int listPos); -typedef void (*GUIWindow_SetCurrentListPosition)(void *addonData, GUIHANDLE handle, int listPos); -typedef int (*GUIWindow_GetCurrentListPosition)(void *addonData, GUIHANDLE handle); -typedef GUIHANDLE (*GUIWindow_GetControl_Spin)(void *addonData, GUIHANDLE handle, int controlId); -typedef GUIHANDLE (*GUIWindow_GetControl_Button)(void *addonData, GUIHANDLE handle, int controlId); -typedef GUIHANDLE (*GUIWindow_GetControl_RadioButton)(void *addonData, GUIHANDLE handle, int controlId); -typedef GUIHANDLE (*GUIWindow_GetControl_Edit)(void *addonData, GUIHANDLE handle, int controlId); -typedef GUIHANDLE (*GUIWindow_GetControl_Progress)(void *addonData, GUIHANDLE handle, int controlId); -typedef GUIHANDLE (*GUIWindow_GetControl_RenderAddon)(void *addonData, GUIHANDLE handle, int controlId); -typedef void (*GUIWindow_SetControlLabel)(void *addonData, GUIHANDLE handle, int controlId, const char *label); -typedef void (*GUIWindow_MarkDirtyRegion)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Spin_SetVisible)(void *addonData, GUIHANDLE spinhandle, bool yesNo); -typedef void (*GUIControl_Spin_SetText)(void *addonData, GUIHANDLE spinhandle, const char *label); -typedef void (*GUIControl_Spin_Clear)(void *addonData, GUIHANDLE spinhandle); -typedef void (*GUIControl_Spin_AddLabel)(void *addonData, GUIHANDLE spinhandle, const char *label, int iValue); -typedef int (*GUIControl_Spin_GetValue)(void *addonData, GUIHANDLE spinhandle); -typedef void (*GUIControl_Spin_SetValue)(void *addonData, GUIHANDLE spinhandle, int iValue); -typedef void (*GUIControl_RadioButton_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo); -typedef void (*GUIControl_RadioButton_SetText)(void *addonData, GUIHANDLE handle, const char *label); -typedef void (*GUIControl_RadioButton_SetSelected)(void *addonData, GUIHANDLE handle, bool yesNo); -typedef bool (*GUIControl_RadioButton_IsSelected)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Progress_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent); -typedef float (*GUIControl_Progress_GetPercentage)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Progress_SetInfo)(void *addonData, GUIHANDLE handle, int iInfo); -typedef int (*GUIControl_Progress_GetInfo)(void *addonData, GUIHANDLE handle); -typedef const char* (*GUIControl_Progress_GetDescription)(void *addonData, GUIHANDLE handle); -typedef GUIHANDLE (*GUIWindow_GetControl_Slider)(void *addonData, GUIHANDLE handle, int controlId); -typedef void (*GUIControl_Slider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo); -typedef const char *(*GUIControl_Slider_GetDescription)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Slider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd); -typedef void (*GUIControl_Slider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue); -typedef int (*GUIControl_Slider_GetIntValue)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Slider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval); -typedef void (*GUIControl_Slider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent); -typedef float (*GUIControl_Slider_GetPercentage)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Slider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd); -typedef void (*GUIControl_Slider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue); -typedef float (*GUIControl_Slider_GetFloatValue)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_Slider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval); -typedef GUIHANDLE (*GUIWindow_GetControl_SettingsSlider)(void *addonData, GUIHANDLE handle, int controlId); -typedef void (*GUIControl_SettingsSlider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo); -typedef void (*GUIControl_SettingsSlider_SetText)(void *addonData, GUIHANDLE handle, const char *label); -typedef const char *(*GUIControl_SettingsSlider_GetDescription)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_SettingsSlider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd); -typedef void (*GUIControl_SettingsSlider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue); -typedef int (*GUIControl_SettingsSlider_GetIntValue)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_SettingsSlider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval); -typedef void (*GUIControl_SettingsSlider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent); -typedef float (*GUIControl_SettingsSlider_GetPercentage)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_SettingsSlider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd); -typedef void (*GUIControl_SettingsSlider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue); -typedef float (*GUIControl_SettingsSlider_GetFloatValue)(void *addonData, GUIHANDLE handle); -typedef void (*GUIControl_SettingsSlider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval); -typedef GUIHANDLE (*GUIListItem_Create)(void *addonData, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); -typedef const char* (*GUIListItem_GetLabel)(void *addonData, GUIHANDLE handle); -typedef void (*GUIListItem_SetLabel)(void *addonData, GUIHANDLE handle, const char *label); -typedef const char* (*GUIListItem_GetLabel2)(void *addonData, GUIHANDLE handle); -typedef void (*GUIListItem_SetLabel2)(void *addonData, GUIHANDLE handle, const char *label); -typedef void (*GUIListItem_SetIconImage)(void *addonData, GUIHANDLE handle, const char *image); -typedef void (*GUIListItem_SetThumbnailImage)(void *addonData, GUIHANDLE handle, const char *image); -typedef void (*GUIListItem_SetInfo)(void *addonData, GUIHANDLE handle, const char *info); -typedef void (*GUIListItem_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value); -typedef const char* (*GUIListItem_GetProperty)(void *addonData, GUIHANDLE handle, const char *key); -typedef void (*GUIListItem_SetPath)(void *addonData, GUIHANDLE handle, const char *path); -typedef void (*GUIRenderAddon_SetCallbacks)(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*createCB)(GUIHANDLE,int,int,int,int,void*), void (*renderCB)(GUIHANDLE), void (*stopCB)(GUIHANDLE), bool (*dirtyCB)(GUIHANDLE)); -typedef void (*GUIRenderAddon_Delete)(void *addonData, GUIHANDLE handle); -typedef void (*GUIRenderAddon_MarkDirty)(void *addonData, GUIHANDLE handle); - -typedef bool (*GUIDialog_Keyboard_ShowAndGetInputWithHead)(char &strTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_ShowAndGetInput)(char &strTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_ShowAndGetNewPasswordWithHead)(char &newPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_ShowAndGetNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_ShowAndVerifyNewPasswordWithHead)(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmpty, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); -typedef int (*GUIDialog_Keyboard_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_ShowAndGetFilter)(char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs); -typedef bool (*GUIDialog_Keyboard_SendTextToActiveKeyboard)(const char *aTextString, bool closeKeyboard); -typedef bool (*GUIDialog_Keyboard_isKeyboardActivated)(); - -typedef bool (*GUIDialog_Numeric_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize); -typedef int (*GUIDialog_Numeric_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries); -typedef bool (*GUIDialog_Numeric_ShowAndVerifyInput)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput); -typedef bool (*GUIDialog_Numeric_ShowAndGetTime)(tm &time, const char *strHeading); -typedef bool (*GUIDialog_Numeric_ShowAndGetDate)(tm &date, const char *strHeading); -typedef bool (*GUIDialog_Numeric_ShowAndGetIPAddress)(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading); -typedef bool (*GUIDialog_Numeric_ShowAndGetNumber)(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs); -typedef bool (*GUIDialog_Numeric_ShowAndGetSeconds)(char &timeString, unsigned int iMaxStringSize, const char *strHeading); - -typedef bool (*GUIDialog_FileBrowser_ShowAndGetFile)(const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList); - -typedef void (*GUIDialog_OK_ShowAndGetInputSingleText)(const char *heading, const char *text); -typedef void (*GUIDialog_OK_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2); - -typedef bool (*GUIDialog_YesNo_ShowAndGetInputSingleText)(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel); -typedef bool (*GUIDialog_YesNo_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel); -typedef bool (*GUIDialog_YesNo_ShowAndGetInputLineButtonText)(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel); - -typedef void (*GUIDialog_TextViewer)(const char *heading, const char *text); - -typedef int (*GUIDialog_Select)(const char *heading, const char *entries[], unsigned int size, int selected); - -typedef struct CB_GUILib -{ - GUILock Lock; - GUIUnlock Unlock; - GUIGetScreenHeight GetScreenHeight; - GUIGetScreenWidth GetScreenWidth; - GUIGetVideoResolution GetVideoResolution; - GUIWindow_New Window_New; - GUIWindow_Delete Window_Delete; - GUIWindow_SetCallbacks Window_SetCallbacks; - GUIWindow_Show Window_Show; - GUIWindow_Close Window_Close; - GUIWindow_DoModal Window_DoModal; - GUIWindow_SetFocusId Window_SetFocusId; - GUIWindow_GetFocusId Window_GetFocusId; - GUIWindow_SetCoordinateResolution Window_SetCoordinateResolution; - GUIWindow_SetProperty Window_SetProperty; - GUIWindow_SetPropertyInt Window_SetPropertyInt; - GUIWindow_SetPropertyBool Window_SetPropertyBool; - GUIWindow_SetPropertyDouble Window_SetPropertyDouble; - GUIWindow_GetProperty Window_GetProperty; - GUIWindow_GetPropertyInt Window_GetPropertyInt; - GUIWindow_GetPropertyBool Window_GetPropertyBool; - GUIWindow_GetPropertyDouble Window_GetPropertyDouble; - GUIWindow_ClearProperties Window_ClearProperties; - GUIWindow_GetListSize Window_GetListSize; - GUIWindow_ClearList Window_ClearList; - GUIWindow_AddItem Window_AddItem; - GUIWindow_AddStringItem Window_AddStringItem; - GUIWindow_RemoveItem Window_RemoveItem; - GUIWindow_GetListItem Window_GetListItem; - GUIWindow_SetCurrentListPosition Window_SetCurrentListPosition; - GUIWindow_GetCurrentListPosition Window_GetCurrentListPosition; - GUIWindow_GetControl_Spin Window_GetControl_Spin; - GUIWindow_GetControl_Button Window_GetControl_Button; - GUIWindow_GetControl_RadioButton Window_GetControl_RadioButton; - GUIWindow_GetControl_Edit Window_GetControl_Edit; - GUIWindow_GetControl_Progress Window_GetControl_Progress; - GUIWindow_GetControl_RenderAddon Window_GetControl_RenderAddon; - GUIWindow_SetControlLabel Window_SetControlLabel; - GUIWindow_MarkDirtyRegion Window_MarkDirtyRegion; - GUIControl_Spin_SetVisible Control_Spin_SetVisible; - GUIControl_Spin_SetText Control_Spin_SetText; - GUIControl_Spin_Clear Control_Spin_Clear; - GUIControl_Spin_AddLabel Control_Spin_AddLabel; - GUIControl_Spin_GetValue Control_Spin_GetValue; - GUIControl_Spin_SetValue Control_Spin_SetValue; - GUIControl_RadioButton_SetVisible Control_RadioButton_SetVisible; - GUIControl_RadioButton_SetText Control_RadioButton_SetText; - GUIControl_RadioButton_SetSelected Control_RadioButton_SetSelected; - GUIControl_RadioButton_IsSelected Control_RadioButton_IsSelected; - GUIControl_Progress_SetPercentage Control_Progress_SetPercentage; - GUIControl_Progress_GetPercentage Control_Progress_GetPercentage; - GUIControl_Progress_SetInfo Control_Progress_SetInfo; - GUIControl_Progress_GetInfo Control_Progress_GetInfo; - GUIControl_Progress_GetDescription Control_Progress_GetDescription; - GUIListItem_Create ListItem_Create; - GUIListItem_GetLabel ListItem_GetLabel; - GUIListItem_SetLabel ListItem_SetLabel; - GUIListItem_GetLabel2 ListItem_GetLabel2; - GUIListItem_SetLabel2 ListItem_SetLabel2; - GUIListItem_SetIconImage ListItem_SetIconImage; - GUIListItem_SetThumbnailImage ListItem_SetThumbnailImage; - GUIListItem_SetInfo ListItem_SetInfo; - GUIListItem_SetProperty ListItem_SetProperty; - GUIListItem_GetProperty ListItem_GetProperty; - GUIListItem_SetPath ListItem_SetPath; - GUIRenderAddon_SetCallbacks RenderAddon_SetCallbacks; - GUIRenderAddon_Delete RenderAddon_Delete; - - GUIWindow_GetControl_Slider Window_GetControl_Slider; - GUIControl_Slider_SetVisible Control_Slider_SetVisible; - GUIControl_Slider_GetDescription Control_Slider_GetDescription; - GUIControl_Slider_SetIntRange Control_Slider_SetIntRange; - GUIControl_Slider_SetIntValue Control_Slider_SetIntValue; - GUIControl_Slider_GetIntValue Control_Slider_GetIntValue; - GUIControl_Slider_SetIntInterval Control_Slider_SetIntInterval; - GUIControl_Slider_SetPercentage Control_Slider_SetPercentage; - GUIControl_Slider_GetPercentage Control_Slider_GetPercentage; - GUIControl_Slider_SetFloatRange Control_Slider_SetFloatRange; - GUIControl_Slider_SetFloatValue Control_Slider_SetFloatValue; - GUIControl_Slider_GetFloatValue Control_Slider_GetFloatValue; - GUIControl_Slider_SetFloatInterval Control_Slider_SetFloatInterval; - - GUIWindow_GetControl_SettingsSlider Window_GetControl_SettingsSlider; - GUIControl_SettingsSlider_SetVisible Control_SettingsSlider_SetVisible; - GUIControl_SettingsSlider_SetText Control_SettingsSlider_SetText; - GUIControl_SettingsSlider_GetDescription Control_SettingsSlider_GetDescription; - GUIControl_SettingsSlider_SetIntRange Control_SettingsSlider_SetIntRange; - GUIControl_SettingsSlider_SetIntValue Control_SettingsSlider_SetIntValue; - GUIControl_SettingsSlider_GetIntValue Control_SettingsSlider_GetIntValue; - GUIControl_SettingsSlider_SetIntInterval Control_SettingsSlider_SetIntInterval; - GUIControl_SettingsSlider_SetPercentage Control_SettingsSlider_SetPercentage; - GUIControl_SettingsSlider_GetPercentage Control_SettingsSlider_GetPercentage; - GUIControl_SettingsSlider_SetFloatRange Control_SettingsSlider_SetFloatRange; - GUIControl_SettingsSlider_SetFloatValue Control_SettingsSlider_SetFloatValue; - GUIControl_SettingsSlider_GetFloatValue Control_SettingsSlider_GetFloatValue; - GUIControl_SettingsSlider_SetFloatInterval Control_SettingsSlider_SetFloatInterval; - - GUIDialog_Keyboard_ShowAndGetInputWithHead Dialog_Keyboard_ShowAndGetInputWithHead; - GUIDialog_Keyboard_ShowAndGetInput Dialog_Keyboard_ShowAndGetInput; - GUIDialog_Keyboard_ShowAndGetNewPasswordWithHead Dialog_Keyboard_ShowAndGetNewPasswordWithHead; - GUIDialog_Keyboard_ShowAndGetNewPassword Dialog_Keyboard_ShowAndGetNewPassword; - GUIDialog_Keyboard_ShowAndVerifyNewPasswordWithHead Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead; - GUIDialog_Keyboard_ShowAndVerifyNewPassword Dialog_Keyboard_ShowAndVerifyNewPassword; - GUIDialog_Keyboard_ShowAndVerifyPassword Dialog_Keyboard_ShowAndVerifyPassword; - GUIDialog_Keyboard_ShowAndGetFilter Dialog_Keyboard_ShowAndGetFilter; - GUIDialog_Keyboard_SendTextToActiveKeyboard Dialog_Keyboard_SendTextToActiveKeyboard; - GUIDialog_Keyboard_isKeyboardActivated Dialog_Keyboard_isKeyboardActivated; - - GUIDialog_Numeric_ShowAndVerifyNewPassword Dialog_Numeric_ShowAndVerifyNewPassword; - GUIDialog_Numeric_ShowAndVerifyPassword Dialog_Numeric_ShowAndVerifyPassword; - GUIDialog_Numeric_ShowAndVerifyInput Dialog_Numeric_ShowAndVerifyInput; - GUIDialog_Numeric_ShowAndGetTime Dialog_Numeric_ShowAndGetTime; - GUIDialog_Numeric_ShowAndGetDate Dialog_Numeric_ShowAndGetDate; - GUIDialog_Numeric_ShowAndGetIPAddress Dialog_Numeric_ShowAndGetIPAddress; - GUIDialog_Numeric_ShowAndGetNumber Dialog_Numeric_ShowAndGetNumber; - GUIDialog_Numeric_ShowAndGetSeconds Dialog_Numeric_ShowAndGetSeconds; - - GUIDialog_FileBrowser_ShowAndGetFile Dialog_FileBrowser_ShowAndGetFile; - - GUIDialog_OK_ShowAndGetInputSingleText Dialog_OK_ShowAndGetInputSingleText; - GUIDialog_OK_ShowAndGetInputLineText Dialog_OK_ShowAndGetInputLineText; - - GUIDialog_YesNo_ShowAndGetInputSingleText Dialog_YesNo_ShowAndGetInputSingleText; - GUIDialog_YesNo_ShowAndGetInputLineText Dialog_YesNo_ShowAndGetInputLineText; - GUIDialog_YesNo_ShowAndGetInputLineButtonText Dialog_YesNo_ShowAndGetInputLineButtonText; - - GUIDialog_TextViewer Dialog_TextViewer; - GUIDialog_Select Dialog_Select; -} CB_GUILib; - class CAddonCallbacksGUI : public ADDON::IAddonInterface { public: 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 b699fa092d..5cca3a2b3e 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,8 +28,149 @@ typedef void* GUIHANDLE; -#define GUI_HELPER_DLL KODI_DLL("guilib") -#define GUI_HELPER_DLL_NAME KODI_DLL_NAME("guilib") +namespace KodiAPI +{ +namespace V1 +{ +namespace GUI +{ + +typedef struct CB_GUILib +{ + void (*Lock)(); + void (*Unlock)(); + int (*GetScreenHeight)(); + int (*GetScreenWidth)(); + int (*GetVideoResolution)(); + GUIHANDLE (*Window_New)(void *addonData, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); + void (*Window_Delete)(void *addonData, GUIHANDLE handle); + void (*Window_SetCallbacks)(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*)(GUIHANDLE handle), bool (*)(GUIHANDLE handle, int), bool (*)(GUIHANDLE handle, int), bool (*)(GUIHANDLE handle, int)); + bool (*Window_Show)(void *addonData, GUIHANDLE handle); + bool (*Window_Close)(void *addonData, GUIHANDLE handle); + bool (*Window_DoModal)(void *addonData, GUIHANDLE handle); + bool (*Window_SetFocusId)(void *addonData, GUIHANDLE handle, int iControlId); + int (*Window_GetFocusId)(void *addonData, GUIHANDLE handle); + bool (*Window_SetCoordinateResolution)(void *addonData, GUIHANDLE handle, int res); + void (*Window_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value); + void (*Window_SetPropertyInt)(void *addonData, GUIHANDLE handle, const char *key, int value); + void (*Window_SetPropertyBool)(void *addonData, GUIHANDLE handle, const char *key, bool value); + void (*Window_SetPropertyDouble)(void *addonData, GUIHANDLE handle, const char *key, double value); + const char* (*Window_GetProperty)(void *addonData, GUIHANDLE handle, const char *key); + int (*Window_GetPropertyInt)(void *addonData, GUIHANDLE handle, const char *key); + bool (*Window_GetPropertyBool)(void *addonData, GUIHANDLE handle, const char *key); + double (*Window_GetPropertyDouble)(void *addonData, GUIHANDLE handle, const char *key); + void (*Window_ClearProperties)(void *addonData, GUIHANDLE handle); + int (*Window_GetListSize)(void *addonData, GUIHANDLE handle); + void (*Window_ClearList)(void *addonData, GUIHANDLE handle); + GUIHANDLE (*Window_AddItem)(void *addonData, GUIHANDLE handle, GUIHANDLE item, int itemPosition); + GUIHANDLE (*Window_AddStringItem)(void *addonData, GUIHANDLE handle, const char *itemName, int itemPosition); + void (*Window_RemoveItem)(void *addonData, GUIHANDLE handle, int itemPosition); + GUIHANDLE (*Window_GetListItem)(void *addonData, GUIHANDLE handle, int listPos); + void (*Window_SetCurrentListPosition)(void *addonData, GUIHANDLE handle, int listPos); + int (*Window_GetCurrentListPosition)(void *addonData, GUIHANDLE handle); + GUIHANDLE (*Window_GetControl_Spin)(void *addonData, GUIHANDLE handle, int controlId); + GUIHANDLE (*Window_GetControl_Button)(void *addonData, GUIHANDLE handle, int controlId); + GUIHANDLE (*Window_GetControl_RadioButton)(void *addonData, GUIHANDLE handle, int controlId); + GUIHANDLE (*Window_GetControl_Edit)(void *addonData, GUIHANDLE handle, int controlId); + GUIHANDLE (*Window_GetControl_Progress)(void *addonData, GUIHANDLE handle, int controlId); + GUIHANDLE (*Window_GetControl_RenderAddon)(void *addonData, GUIHANDLE handle, int controlId); + void (*Window_SetControlLabel)(void *addonData, GUIHANDLE handle, int controlId, const char *label); + void (*Window_MarkDirtyRegion)(void *addonData, GUIHANDLE handle); + void (*Control_Spin_SetVisible)(void *addonData, GUIHANDLE spinhandle, bool yesNo); + void (*Control_Spin_SetText)(void *addonData, GUIHANDLE spinhandle, const char *label); + void (*Control_Spin_Clear)(void *addonData, GUIHANDLE spinhandle); + void (*Control_Spin_AddLabel)(void *addonData, GUIHANDLE spinhandle, const char *label, int iValue); + int (*Control_Spin_GetValue)(void *addonData, GUIHANDLE spinhandle); + void (*Control_Spin_SetValue)(void *addonData, GUIHANDLE spinhandle, int iValue); + void (*Control_RadioButton_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo); + void (*Control_RadioButton_SetText)(void *addonData, GUIHANDLE handle, const char *label); + void (*Control_RadioButton_SetSelected)(void *addonData, GUIHANDLE handle, bool yesNo); + bool (*Control_RadioButton_IsSelected)(void *addonData, GUIHANDLE handle); + void (*Control_Progress_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent); + float (*Control_Progress_GetPercentage)(void *addonData, GUIHANDLE handle); + void (*Control_Progress_SetInfo)(void *addonData, GUIHANDLE handle, int iInfo); + int (*Control_Progress_GetInfo)(void *addonData, GUIHANDLE handle); + const char* (*Control_Progress_GetDescription)(void *addonData, GUIHANDLE handle); + GUIHANDLE (*Window_GetControl_Slider)(void *addonData, GUIHANDLE handle, int controlId); + void (*Control_Slider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo); + const char *(*Control_Slider_GetDescription)(void *addonData, GUIHANDLE handle); + void (*Control_Slider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd); + void (*Control_Slider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue); + int (*Control_Slider_GetIntValue)(void *addonData, GUIHANDLE handle); + void (*Control_Slider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval); + void (*Control_Slider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent); + float (*Control_Slider_GetPercentage)(void *addonData, GUIHANDLE handle); + void (*Control_Slider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd); + void (*Control_Slider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue); + float (*Control_Slider_GetFloatValue)(void *addonData, GUIHANDLE handle); + void (*Control_Slider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval); + GUIHANDLE (*Window_GetControl_SettingsSlider)(void *addonData, GUIHANDLE handle, int controlId); + void (*Control_SettingsSlider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo); + void (*Control_SettingsSlider_SetText)(void *addonData, GUIHANDLE handle, const char *label); + const char *(*Control_SettingsSlider_GetDescription)(void *addonData, GUIHANDLE handle); + void (*Control_SettingsSlider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd); + void (*Control_SettingsSlider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue); + int (*Control_SettingsSlider_GetIntValue)(void *addonData, GUIHANDLE handle); + void (*Control_SettingsSlider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval); + void (*Control_SettingsSlider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent); + float (*Control_SettingsSlider_GetPercentage)(void *addonData, GUIHANDLE handle); + void (*Control_SettingsSlider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd); + void (*Control_SettingsSlider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue); + float (*Control_SettingsSlider_GetFloatValue)(void *addonData, GUIHANDLE handle); + void (*Control_SettingsSlider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval); + GUIHANDLE (*ListItem_Create)(void *addonData, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); + const char* (*ListItem_GetLabel)(void *addonData, GUIHANDLE handle); + void (*ListItem_SetLabel)(void *addonData, GUIHANDLE handle, const char *label); + const char* (*ListItem_GetLabel2)(void *addonData, GUIHANDLE handle); + void (*ListItem_SetLabel2)(void *addonData, GUIHANDLE handle, const char *label); + void (*ListItem_SetIconImage)(void *addonData, GUIHANDLE handle, const char *image); + void (*ListItem_SetThumbnailImage)(void *addonData, GUIHANDLE handle, const char *image); + void (*ListItem_SetInfo)(void *addonData, GUIHANDLE handle, const char *info); + void (*ListItem_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value); + const char* (*ListItem_GetProperty)(void *addonData, GUIHANDLE handle, const char *key); + void (*ListItem_SetPath)(void *addonData, GUIHANDLE handle, const char *path); + 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)); + void (*RenderAddon_Delete)(void *addonData, GUIHANDLE handle); + void (*RenderAddon_MarkDirty)(void *addonData, GUIHANDLE handle); + + bool (*Dialog_Keyboard_ShowAndGetInputWithHead)(char &strTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_ShowAndGetInput)(char &strTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_ShowAndGetNewPasswordWithHead)(char &newPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_ShowAndGetNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead)(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmpty, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); + int (*Dialog_Keyboard_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_ShowAndGetFilter)(char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs); + bool (*Dialog_Keyboard_SendTextToActiveKeyboard)(const char *aTextString, bool closeKeyboard); + bool (*Dialog_Keyboard_isKeyboardActivated)(); + + bool (*Dialog_Numeric_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize); + int (*Dialog_Numeric_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries); + bool (*Dialog_Numeric_ShowAndVerifyInput)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput); + bool (*Dialog_Numeric_ShowAndGetTime)(tm &time, const char *strHeading); + bool (*Dialog_Numeric_ShowAndGetDate)(tm &date, const char *strHeading); + bool (*Dialog_Numeric_ShowAndGetIPAddress)(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading); + bool (*Dialog_Numeric_ShowAndGetNumber)(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs); + bool (*Dialog_Numeric_ShowAndGetSeconds)(char &timeString, unsigned int iMaxStringSize, const char *strHeading); + + bool (*Dialog_FileBrowser_ShowAndGetFile)(const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList); + + void (*Dialog_OK_ShowAndGetInputSingleText)(const char *heading, const char *text); + void (*Dialog_OK_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2); + + bool (*Dialog_YesNo_ShowAndGetInputSingleText)(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel); + bool (*Dialog_YesNo_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel); + bool (*Dialog_YesNo_ShowAndGetInputLineButtonText)(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel); + + void (*Dialog_TextViewer)(const char *heading, const char *text); + + int (*Dialog_Select)(const char *heading, const char *entries[], unsigned int size, int selected); +} CB_GUILib; + +} /* namespace GUI */ +} /* namespace V1 */ +} /* namespace KodiAPI */ + /* current ADDONGUI API version */ #define KODI_GUILIB_API_VERSION "5.11.0" @@ -41,403 +182,977 @@ typedef void* GUIHANDLE; #define ADDON_ACTION_CLOSE_DIALOG 51 #define ADDON_ACTION_NAV_BACK 92 -class CAddonGUIWindow; class CAddonGUISpinControl; class CAddonGUIRadioButton; class CAddonGUIProgressControl; -class CAddonListItem; class CAddonGUIRenderingControl; class CAddonGUISliderControl; class CAddonGUISettingsSliderControl; -class CHelper_libKODI_guilib +class CAddonListItem { +friend class CAddonGUIWindow; + public: - CHelper_libKODI_guilib() + CAddonListItem(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) + : m_Handle(hdl) + , m_cb(cb) { - m_libKODI_guilib = NULL; - m_Handle = NULL; + m_ListItemHandle = m_cb->ListItem_Create(m_Handle->addonData, label, label2, iconImage, thumbnailImage, path); } - ~CHelper_libKODI_guilib() + virtual ~CAddonListItem(void) {} + + const char *GetLabel() + { + if (!m_ListItemHandle) + return ""; + + return m_cb->ListItem_GetLabel(m_Handle->addonData, m_ListItemHandle); + } + + void SetLabel(const char *label) + { + if (m_ListItemHandle) + m_cb->ListItem_SetLabel(m_Handle->addonData, m_ListItemHandle, label); + } + + const char *GetLabel2() + { + if (!m_ListItemHandle) + return ""; + + return m_cb->ListItem_GetLabel2(m_Handle->addonData, m_ListItemHandle); + } + + void SetLabel2(const char *label) + { + if (m_ListItemHandle) + m_cb->ListItem_SetLabel2(m_Handle->addonData, m_ListItemHandle, label); + } + + void SetIconImage(const char *image) + { + if (m_ListItemHandle) + m_cb->ListItem_SetIconImage(m_Handle->addonData, m_ListItemHandle, image); + } + + void SetThumbnailImage(const char *image) + { + if (m_ListItemHandle) + m_cb->ListItem_SetThumbnailImage(m_Handle->addonData, m_ListItemHandle, image); + } + + void SetInfo(const char *Info) + { + if (m_ListItemHandle) + m_cb->ListItem_SetInfo(m_Handle->addonData, m_ListItemHandle, Info); + } + + void SetProperty(const char *key, const char *value) + { + if (m_ListItemHandle) + m_cb->ListItem_SetProperty(m_Handle->addonData, m_ListItemHandle, key, value); + } + + const char *GetProperty(const char *key) const + { + if (!m_ListItemHandle) + return ""; + + return m_cb->ListItem_GetProperty(m_Handle->addonData, m_ListItemHandle, key); + } + + void SetPath(const char *Path) { - if (m_libKODI_guilib) + if (m_ListItemHandle) + m_cb->ListItem_SetPath(m_Handle->addonData, m_ListItemHandle, Path); + } + +protected: + GUIHANDLE m_ListItemHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; +}; + +class CAddonGUIWindow +{ +friend class CAddonGUISpinControl; +friend class CAddonGUIRadioButton; +friend class CAddonGUIProgressControl; +friend class CAddonGUIRenderingControl; +friend class CAddonGUISliderControl; +friend class CAddonGUISettingsSliderControl; + +public: + CAddonGUIWindow(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) + : m_Handle(hdl), + m_cb(cb) + { + CBOnInit = nullptr; + CBOnClick = nullptr; + CBOnFocus = nullptr; + CBOnAction = nullptr; + m_WindowHandle = nullptr; + m_cbhdl = nullptr; + + if (hdl && cb) { - GUI_unregister_me(m_Handle, m_Callbacks); - dlclose(m_libKODI_guilib); + m_WindowHandle = m_cb->Window_New(m_Handle->addonData, xmlFilename, defaultSkin, forceFallback, asDialog); + if (!m_WindowHandle) + fprintf(stderr, "libXBMC_gui-ERROR: cGUIWindow can't create window class from XBMC !!!\n"); + + m_cb->Window_SetCallbacks(m_Handle->addonData, m_WindowHandle, this, OnInitCB, OnClickCB, OnFocusCB, OnActionCB); } } - bool RegisterMe(void *Handle) + virtual ~CAddonGUIWindow() { - m_Handle = Handle; + if (m_Handle && m_cb && m_WindowHandle) + { + m_cb->Window_Delete(m_Handle->addonData, m_WindowHandle); + m_WindowHandle = NULL; + } + } - std::string libBasePath; - libBasePath = ((cb_array*)m_Handle)->libPath; - libBasePath += GUI_HELPER_DLL; + bool Show() + { + return m_cb->Window_Show(m_Handle->addonData, m_WindowHandle); + } - m_libKODI_guilib = dlopen(libBasePath.c_str(), RTLD_LAZY); - if (m_libKODI_guilib == NULL) - { - fprintf(stderr, "Unable to load %s\n", dlerror()); + void Close() + { + m_cb->Window_Close(m_Handle->addonData, m_WindowHandle); + } + + void DoModal() + { + m_cb->Window_DoModal(m_Handle->addonData, m_WindowHandle); + } + + bool SetFocusId(int iControlId) + { + return m_cb->Window_SetFocusId(m_Handle->addonData, m_WindowHandle, iControlId); + } + + int GetFocusId() + { + return m_cb->Window_GetFocusId(m_Handle->addonData, m_WindowHandle); + } + + bool SetCoordinateResolution(int res) + { + return m_cb->Window_SetCoordinateResolution(m_Handle->addonData, m_WindowHandle, res); + } + + void SetProperty(const char *key, const char *value) + { + m_cb->Window_SetProperty(m_Handle->addonData, m_WindowHandle, key, value); + } + + void SetPropertyInt(const char *key, int value) + { + m_cb->Window_SetPropertyInt(m_Handle->addonData, m_WindowHandle, key, value); + } + + void SetPropertyBool(const char *key, bool value) + { + m_cb->Window_SetPropertyBool(m_Handle->addonData, m_WindowHandle, key, value); + } + + void SetPropertyDouble(const char *key, double value) + { + m_cb->Window_SetPropertyDouble(m_Handle->addonData, m_WindowHandle, key, value); + } + + const char *GetProperty(const char *key) const + { + return m_cb->Window_GetProperty(m_Handle->addonData, m_WindowHandle, key); + } + + int GetPropertyInt(const char *key) const + { + return m_cb->Window_GetPropertyInt(m_Handle->addonData, m_WindowHandle, key); + } + + bool GetPropertyBool(const char *key) const + { + return m_cb->Window_GetPropertyBool(m_Handle->addonData, m_WindowHandle, key); + } + + double GetPropertyDouble(const char *key) const + { + return m_cb->Window_GetPropertyDouble(m_Handle->addonData, m_WindowHandle, key); + } + + void ClearProperties() + { + m_cb->Window_ClearProperties(m_Handle->addonData, m_WindowHandle); + } + + int GetListSize() + { + return m_cb->Window_GetListSize(m_Handle->addonData, m_WindowHandle); + } + + void ClearList() + { + m_cb->Window_ClearList(m_Handle->addonData, m_WindowHandle); + } + + GUIHANDLE AddStringItem(const char *name, int itemPosition = -1) + { + return m_cb->Window_AddStringItem(m_Handle->addonData, m_WindowHandle, name, itemPosition); + } + + void AddItem(GUIHANDLE item, int itemPosition = -1) + { + m_cb->Window_AddItem(m_Handle->addonData, m_WindowHandle, item, itemPosition); + } + + void AddItem(CAddonListItem *item, int itemPosition = -1) + { + m_cb->Window_AddItem(m_Handle->addonData, m_WindowHandle, item->m_ListItemHandle, itemPosition); + } + + void RemoveItem(int itemPosition) + { + m_cb->Window_RemoveItem(m_Handle->addonData, m_WindowHandle, itemPosition); + } + + GUIHANDLE GetListItem(int listPos) + { + return m_cb->Window_GetListItem(m_Handle->addonData, m_WindowHandle, listPos); + } + + void SetCurrentListPosition(int listPos) + { + m_cb->Window_SetCurrentListPosition(m_Handle->addonData, m_WindowHandle, listPos); + } + + int GetCurrentListPosition() + { + return m_cb->Window_GetCurrentListPosition(m_Handle->addonData, m_WindowHandle); + } + + void SetControlLabel(int controlId, const char *label) + { + m_cb->Window_SetControlLabel(m_Handle->addonData, m_WindowHandle, controlId, label); + } + + void MarkDirtyRegion() + { + m_cb->Window_MarkDirtyRegion(m_Handle->addonData, m_WindowHandle); + } + + bool OnClick(int controlId) + { + if (!CBOnClick) return false; - } - GUI_register_me = (void* (*)(void *HANDLE)) - dlsym(m_libKODI_guilib, "GUI_register_me"); - if (GUI_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return CBOnClick(m_cbhdl, controlId); + } + + bool OnFocus(int controlId) + { + if (!CBOnFocus) + return false; + + return CBOnFocus(m_cbhdl, controlId); + } + + bool OnInit() + { + if (!CBOnInit) + return false; + + return CBOnInit(m_cbhdl); + } + + bool OnAction(int actionId) + { + if (!CBOnAction) + return false; + + return CBOnAction(m_cbhdl, actionId); + } + + GUIHANDLE m_cbhdl; + bool (*CBOnInit)(GUIHANDLE cbhdl); + bool (*CBOnFocus)(GUIHANDLE cbhdl, int controlId); + bool (*CBOnClick)(GUIHANDLE cbhdl, int controlId); + bool (*CBOnAction)(GUIHANDLE cbhdl, int actionId); + +protected: + GUIHANDLE m_WindowHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; + + static bool OnInitCB(GUIHANDLE cbhdl); + static bool OnClickCB(GUIHANDLE cbhdl, int controlId); + static bool OnFocusCB(GUIHANDLE cbhdl, int controlId); + static bool OnActionCB(GUIHANDLE cbhdl, int actionId); +}; + + +inline bool CAddonGUIWindow::OnInitCB(GUIHANDLE cbhdl) +{ + return static_cast<CAddonGUIWindow*>(cbhdl)->OnInit(); +} + +inline bool CAddonGUIWindow::OnClickCB(GUIHANDLE cbhdl, int controlId) +{ + return static_cast<CAddonGUIWindow*>(cbhdl)->OnClick(controlId); +} + +inline bool CAddonGUIWindow::OnFocusCB(GUIHANDLE cbhdl, int controlId) +{ + return static_cast<CAddonGUIWindow*>(cbhdl)->OnFocus(controlId); +} + +inline bool CAddonGUIWindow::OnActionCB(GUIHANDLE cbhdl, int actionId) +{ + return static_cast<CAddonGUIWindow*>(cbhdl)->OnAction(actionId); +} + +class CAddonGUISpinControl +{ +public: + CAddonGUISpinControl(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId) + : m_Window(window), + m_Handle(hdl), + m_cb(cb) + { + m_SpinHandle = m_cb->Window_GetControl_Spin(m_Handle->addonData, m_Window->m_WindowHandle, controlId); + } + ~CAddonGUISpinControl(void) {} + + void SetVisible(bool yesNo) + { + if (m_SpinHandle) + m_cb->Control_Spin_SetVisible(m_Handle->addonData, m_SpinHandle, yesNo); + } + + void SetText(const char *label) + { + if (m_SpinHandle) + m_cb->Control_Spin_SetText(m_Handle->addonData, m_SpinHandle, label); + } + + void Clear() + { + if (m_SpinHandle) + m_cb->Control_Spin_Clear(m_Handle->addonData, m_SpinHandle); + } + + void AddLabel(const char *label, int iValue) + { + if (m_SpinHandle) + m_cb->Control_Spin_AddLabel(m_Handle->addonData, m_SpinHandle, label, iValue); + } + + int GetValue() + { + if (!m_SpinHandle) + return -1; + + return m_cb->Control_Spin_GetValue(m_Handle->addonData, m_SpinHandle); + } + + void SetValue(int iValue) + { + if (m_SpinHandle) + m_cb->Control_Spin_SetValue(m_Handle->addonData, m_SpinHandle, iValue); + } + +private: + CAddonGUIWindow* m_Window; + GUIHANDLE m_SpinHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; +}; + +class CAddonGUIRadioButton +{ +public: + CAddonGUIRadioButton(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId) + : m_Window(window) + , m_Handle(hdl) + , m_cb(cb) + { + m_ButtonHandle = m_cb->Window_GetControl_RadioButton(m_Handle->addonData, m_Window->m_WindowHandle, controlId); + } + ~CAddonGUIRadioButton() {} + + void SetVisible(bool yesNo) + { + if (m_ButtonHandle) + m_cb->Control_RadioButton_SetVisible(m_Handle->addonData, m_ButtonHandle, yesNo); + } + + void SetText(const char *label) + { + if (m_ButtonHandle) + m_cb->Control_RadioButton_SetText(m_Handle->addonData, m_ButtonHandle, label); + } + + void SetSelected(bool yesNo) + { + if (m_ButtonHandle) + m_cb->Control_RadioButton_SetSelected(m_Handle->addonData, m_ButtonHandle, yesNo); + } + + bool IsSelected() + { + if (!m_ButtonHandle) + return false; + + return m_cb->Control_RadioButton_IsSelected(m_Handle->addonData, m_ButtonHandle); + } + +private: + CAddonGUIWindow* m_Window; + GUIHANDLE m_ButtonHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; +}; + +class CAddonGUIProgressControl +{ +public: + CAddonGUIProgressControl(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId) + : m_Window(window) + , m_Handle(hdl) + , m_cb(cb) + { + m_ProgressHandle = m_cb->Window_GetControl_Progress(m_Handle->addonData, m_Window->m_WindowHandle, controlId); + } - GUI_unregister_me = (void (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_unregister_me"); - if (GUI_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + ~CAddonGUIProgressControl(void) {} - GUI_lock = (void (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_lock"); - if (GUI_lock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetPercentage(float fPercent) + { + if (m_ProgressHandle) + m_cb->Control_Progress_SetPercentage(m_Handle->addonData, m_ProgressHandle, fPercent); + } - GUI_unlock = (void (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_unlock"); - if (GUI_unlock == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + float GetPercentage() const + { + if (!m_ProgressHandle) + return 0.0f; - GUI_get_screen_height = (int (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_get_screen_height"); - if (GUI_get_screen_height == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_Progress_GetPercentage(m_Handle->addonData, m_ProgressHandle); + } - GUI_get_screen_width = (int (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_get_screen_width"); - if (GUI_get_screen_width == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetInfo(int iInfo) + { + if (m_ProgressHandle) + m_cb->Control_Progress_SetInfo(m_Handle->addonData, m_ProgressHandle, iInfo); + } - GUI_get_video_resolution = (int (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_get_video_resolution"); - if (GUI_get_video_resolution == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + int GetInfo() const + { + if (!m_ProgressHandle) + return -1; - GUI_Window_create = (CAddonGUIWindow* (*)(void *HANDLE, void *CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog)) - dlsym(m_libKODI_guilib, "GUI_Window_create"); - if (GUI_Window_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_Progress_GetInfo(m_Handle->addonData, m_ProgressHandle); + } - GUI_Window_destroy = (void (*)(CAddonGUIWindow* p)) - dlsym(m_libKODI_guilib, "GUI_Window_destroy"); - if (GUI_Window_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + std::string GetDescription() const + { + if (!m_ProgressHandle) + return ""; - GUI_control_get_spin = (CAddonGUISpinControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) - dlsym(m_libKODI_guilib, "GUI_control_get_spin"); - if (GUI_control_get_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_Progress_GetDescription(m_Handle->addonData, m_ProgressHandle); + } - GUI_control_release_spin = (void (*)(CAddonGUISpinControl* p)) - dlsym(m_libKODI_guilib, "GUI_control_release_spin"); - if (GUI_control_release_spin == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +private: + CAddonGUIWindow* m_Window; + GUIHANDLE m_ProgressHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; +}; - GUI_control_get_radiobutton = (CAddonGUIRadioButton* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) - dlsym(m_libKODI_guilib, "GUI_control_get_radiobutton"); - if (GUI_control_get_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +class CAddonGUISliderControl +{ +public: + CAddonGUISliderControl(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId) + : m_Window(window) + , m_Handle(hdl) + , m_cb(cb) + { + m_SliderHandle = m_cb->Window_GetControl_Slider(m_Handle->addonData, m_Window->m_WindowHandle, controlId); + } - GUI_control_release_radiobutton = (void (*)(CAddonGUIRadioButton* p)) - dlsym(m_libKODI_guilib, "GUI_control_release_radiobutton"); - if (GUI_control_release_radiobutton == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + ~CAddonGUISliderControl(void) {} - GUI_control_get_progress = (CAddonGUIProgressControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) - dlsym(m_libKODI_guilib, "GUI_control_get_progress"); - if (GUI_control_get_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetVisible(bool yesNo) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetVisible(m_Handle->addonData, m_SliderHandle, yesNo); + } - GUI_control_release_progress = (void (*)(CAddonGUIProgressControl* p)) - dlsym(m_libKODI_guilib, "GUI_control_release_progress"); - if (GUI_control_release_progress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + std::string GetDescription() const + { + if (!m_SliderHandle) + return ""; - GUI_ListItem_create = (CAddonListItem* (*)(void *HANDLE, void *CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)) - dlsym(m_libKODI_guilib, "GUI_ListItem_create"); - if (GUI_ListItem_create == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_Slider_GetDescription(m_Handle->addonData, m_SliderHandle); + } - GUI_ListItem_destroy = (void (*)(CAddonListItem* p)) - dlsym(m_libKODI_guilib, "GUI_ListItem_destroy"); - if (GUI_ListItem_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetIntRange(int iStart, int iEnd) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetIntRange(m_Handle->addonData, m_SliderHandle, iStart, iEnd); + } - GUI_control_get_rendering = (CAddonGUIRenderingControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) - dlsym(m_libKODI_guilib, "GUI_control_get_rendering"); - if (GUI_control_get_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetIntValue(int iValue) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetIntValue(m_Handle->addonData, m_SliderHandle, iValue); + } - GUI_control_release_rendering = (void (*)(CAddonGUIRenderingControl* p)) - dlsym(m_libKODI_guilib, "GUI_control_release_rendering"); - if (GUI_control_release_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + int GetIntValue() const + { + if (!m_SliderHandle) + return 0; + return m_cb->Control_Slider_GetIntValue(m_Handle->addonData, m_SliderHandle); + } - GUI_control_get_slider = (CAddonGUISliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) - dlsym(m_libKODI_guilib, "GUI_control_get_slider"); - if (GUI_control_get_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetIntInterval(int iInterval) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetIntInterval(m_Handle->addonData, m_SliderHandle, iInterval); + } - GUI_control_release_slider = (void (*)(CAddonGUISliderControl* p)) - dlsym(m_libKODI_guilib, "GUI_control_release_slider"); - if (GUI_control_release_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetPercentage(float fPercent) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetPercentage(m_Handle->addonData, m_SliderHandle, fPercent); + } - GUI_control_get_settings_slider = (CAddonGUISettingsSliderControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId)) - dlsym(m_libKODI_guilib, "GUI_control_get_settings_slider"); - if (GUI_control_get_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + float GetPercentage() const + { + if (!m_SliderHandle) + return 0.0f; - GUI_control_release_settings_slider = (void (*)(CAddonGUISettingsSliderControl* p)) - dlsym(m_libKODI_guilib, "GUI_control_release_settings_slider"); - if (GUI_control_release_settings_slider == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_Slider_GetPercentage(m_Handle->addonData, m_SliderHandle); + } - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input_with_head"); - if (GUI_dialog_keyboard_show_and_get_input_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetFloatRange(float fStart, float fEnd) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetFloatRange(m_Handle->addonData, m_SliderHandle, fStart, fEnd); + } - GUI_dialog_keyboard_show_and_get_input = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_input"); - if (GUI_dialog_keyboard_show_and_get_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetFloatValue(float fValue) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetFloatValue(m_Handle->addonData, m_SliderHandle, fValue); + } - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password_with_head"); - if (GUI_dialog_keyboard_show_and_get_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + float GetFloatValue() const + { + if (!m_SliderHandle) + return 0.0f; + return m_cb->Control_Slider_GetFloatValue(m_Handle->addonData, m_SliderHandle); + } - GUI_dialog_keyboard_show_and_get_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_new_password"); - if (GUI_dialog_keyboard_show_and_get_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetFloatInterval(float fInterval) + { + if (m_SliderHandle) + m_cb->Control_Slider_SetFloatInterval(m_Handle->addonData, m_SliderHandle, fInterval); + } - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password_with_head"); - if (GUI_dialog_keyboard_show_and_verify_new_password_with_head == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +private: + CAddonGUIWindow* m_Window; + GUIHANDLE m_SliderHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; +}; - GUI_dialog_keyboard_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_new_password"); - if (GUI_dialog_keyboard_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +class CAddonGUISettingsSliderControl +{ +public: + CAddonGUISettingsSliderControl(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId) + : m_Window(window) + , m_Handle(hdl) + , m_cb(cb) + { + m_SettingsSliderHandle = m_cb->Window_GetControl_SettingsSlider(m_Handle->addonData, m_Window->m_WindowHandle, controlId); + } + + ~CAddonGUISettingsSliderControl(void) {} - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_verify_password"); - if (GUI_dialog_keyboard_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetVisible(bool yesNo) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetVisible(m_Handle->addonData, m_SettingsSliderHandle, yesNo); + } - GUI_dialog_keyboard_show_and_get_filter = (bool (*)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_show_and_get_filter"); - if (GUI_dialog_keyboard_show_and_get_filter == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetText(const char *label) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetText(m_Handle->addonData, m_SettingsSliderHandle, label); + } - GUI_dialog_keyboard_send_text_to_active_keyboard = (bool (*)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_send_text_to_active_keyboard"); - if (GUI_dialog_keyboard_send_text_to_active_keyboard == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + std::string GetDescription() const + { + if (!m_SettingsSliderHandle) + return ""; - GUI_dialog_keyboard_is_activated = (bool (*)(void *HANDLE, void *CB)) - dlsym(m_libKODI_guilib, "GUI_dialog_keyboard_is_activated"); - if (GUI_dialog_keyboard_is_activated == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_SettingsSlider_GetDescription(m_Handle->addonData, m_SettingsSliderHandle); + } - GUI_dialog_numeric_show_and_verify_new_password = (bool (*)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_new_password"); - if (GUI_dialog_numeric_show_and_verify_new_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetIntRange(int iStart, int iEnd) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetIntRange(m_Handle->addonData, m_SettingsSliderHandle, iStart, iEnd); + } - GUI_dialog_numeric_show_and_verify_password = (int (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_password"); - if (GUI_dialog_numeric_show_and_verify_password == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetIntValue(int iValue) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetIntValue(m_Handle->addonData, m_SettingsSliderHandle, iValue); + } - GUI_dialog_numeric_show_and_verify_input = (bool (*)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_verify_input"); - if (GUI_dialog_numeric_show_and_verify_input == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + int GetIntValue() const + { + if (!m_SettingsSliderHandle) + return 0; + return m_cb->Control_SettingsSlider_GetIntValue(m_Handle->addonData, m_SettingsSliderHandle); + } - GUI_dialog_numeric_show_and_get_time = (bool (*)(void *HANDLE, void *CB, tm &time, const char *strHeading)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_time"); - if (GUI_dialog_numeric_show_and_get_time == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetIntInterval(int iInterval) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetIntInterval(m_Handle->addonData, m_SettingsSliderHandle, iInterval); + } - GUI_dialog_numeric_show_and_get_date = (bool (*)(void *HANDLE, void *CB, tm &date, const char *strHeading)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_date"); - if (GUI_dialog_numeric_show_and_get_date == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetPercentage(float fPercent) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetPercentage(m_Handle->addonData, m_SettingsSliderHandle, fPercent); + } - GUI_dialog_numeric_show_and_get_ipaddress = (bool (*)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_ipaddress"); - if (GUI_dialog_numeric_show_and_get_ipaddress == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + float GetPercentage() const + { + if (!m_SettingsSliderHandle) + return 0.0f; - GUI_dialog_numeric_show_and_get_number = (bool (*)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_number"); - if (GUI_dialog_numeric_show_and_get_number == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + return m_cb->Control_SettingsSlider_GetPercentage(m_Handle->addonData, m_SettingsSliderHandle); + } - GUI_dialog_numeric_show_and_get_seconds = (bool (*)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading)) - dlsym(m_libKODI_guilib, "GUI_dialog_numeric_show_and_get_seconds"); - if (GUI_dialog_numeric_show_and_get_seconds == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetFloatRange(float fStart, float fEnd) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetFloatRange(m_Handle->addonData, m_SettingsSliderHandle, fStart, fEnd); + } + + void SetFloatValue(float fValue) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetFloatValue(m_Handle->addonData, m_SettingsSliderHandle, fValue); + } + + float GetFloatValue() const + { + if (!m_SettingsSliderHandle) + return 0.0f; + return m_cb->Control_SettingsSlider_GetFloatValue(m_Handle->addonData, m_SettingsSliderHandle); + } - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_filebrowser_show_and_get_file"); - if (GUI_dialog_filebrowser_show_and_get_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + void SetFloatInterval(float fInterval) + { + if (m_SettingsSliderHandle) + m_cb->Control_SettingsSlider_SetFloatInterval(m_Handle->addonData, m_SettingsSliderHandle, fInterval); + } - GUI_dialog_ok_show_and_get_input_single_text = (void (*)(void *HANDLE, void *CB, const char *heading, const char *text)) - dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_single_text"); - if (GUI_dialog_ok_show_and_get_input_single_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +private: + CAddonGUIWindow* m_Window; + GUIHANDLE m_SettingsSliderHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; +}; + +class CAddonGUIRenderingControl +{ +public: + CAddonGUIRenderingControl(AddonCB* hdl, KodiAPI::V1::GUI::CB_GUILib* cb, CAddonGUIWindow *window, int controlId) + : m_Window(window) + , m_Handle(hdl) + , m_cb(cb) + , m_cbhdl(nullptr) + , CBCreate(nullptr) + , CBRender(nullptr) + , CBStop(nullptr) + , CBDirty(nullptr) + { + m_RenderingHandle = m_cb->Window_GetControl_RenderAddon(m_Handle->addonData, m_Window->m_WindowHandle, controlId); + } + virtual ~CAddonGUIRenderingControl() + { + m_cb->RenderAddon_Delete(m_Handle->addonData, m_RenderingHandle); + } + + void Init() + { + m_cb->RenderAddon_SetCallbacks(m_Handle->addonData, m_RenderingHandle, this, OnCreateCB, OnRenderCB, OnStopCB, OnDirtyCB); + } + + bool Create(int x, int y, int w, int h, void *device) + { + if (!CBCreate) + return false; + + return CBCreate(m_cbhdl, x, y, w, h, device); + } + + void Render() + { + if (!CBRender) + return; + + CBRender(m_cbhdl); + } + + void Stop() + { + if (!CBStop) + return; + + CBStop(m_cbhdl); + } + + bool Dirty() + { + if (!CBDirty) + return true; + + return CBDirty(m_cbhdl); + } + + GUIHANDLE m_cbhdl; + bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device); + void (*CBRender)(GUIHANDLE cbhdl); + void (*CBStop)(GUIHANDLE cbhdl); + bool (*CBDirty)(GUIHANDLE cbhdl); - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_ok_show_and_get_input_line_text"); - if (GUI_dialog_ok_show_and_get_input_line_text == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +private: + CAddonGUIWindow* m_Window; + GUIHANDLE m_RenderingHandle; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_cb; + + static bool OnCreateCB(GUIHANDLE cbhdl, int x, int y, int w, int h, void* device); + static void OnRenderCB(GUIHANDLE cbhdl); + static void OnStopCB(GUIHANDLE cbhdl); + static bool OnDirtyCB(GUIHANDLE cbhdl); +}; - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_singletext"); - if (GUI_dialog_yesno_show_and_get_input_singletext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +inline bool CAddonGUIRenderingControl::OnCreateCB(GUIHANDLE cbhdl, int x, int y, int w, int h, void* device) +{ + return static_cast<CAddonGUIRenderingControl*>(cbhdl)->Create(x, y, w, h, device); +} - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linetext"); - if (GUI_dialog_yesno_show_and_get_input_linetext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +inline void CAddonGUIRenderingControl::OnRenderCB(GUIHANDLE cbhdl) +{ + static_cast<CAddonGUIRenderingControl*>(cbhdl)->Render(); +} - 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)) - dlsym(m_libKODI_guilib, "GUI_dialog_yesno_show_and_get_input_linebuttontext"); - if (GUI_dialog_yesno_show_and_get_input_linebuttontext == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +inline void CAddonGUIRenderingControl::OnStopCB(GUIHANDLE cbhdl) +{ + static_cast<CAddonGUIRenderingControl*>(cbhdl)->Stop(); +} - GUI_dialog_text_viewer = (void (*)(void *hdl, void *cb, const char *heading, const char *text)) - dlsym(m_libKODI_guilib, "GUI_dialog_text_viewer"); - if (GUI_dialog_text_viewer == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } +inline bool CAddonGUIRenderingControl::OnDirtyCB(GUIHANDLE cbhdl) +{ + return static_cast<CAddonGUIRenderingControl*>(cbhdl)->Dirty(); +} + +class CHelper_libKODI_guilib +{ +public: + CHelper_libKODI_guilib() + { + m_Handle = nullptr; + m_Callbacks = nullptr; + } - GUI_dialog_select = (int (*)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected)) - dlsym(m_libKODI_guilib, "GUI_dialog_select"); - if (GUI_dialog_select == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + ~CHelper_libKODI_guilib() + { + if (m_Handle && m_Callbacks) + { + m_Handle->GUILib_UnRegisterMe(m_Handle->addonData, m_Callbacks); + } + } - m_Callbacks = GUI_register_me(m_Handle); - return m_Callbacks != NULL; + bool RegisterMe(void *handle) + { + m_Handle = static_cast<AddonCB*>(handle); + if (m_Handle) + m_Callbacks = (KodiAPI::V1::GUI::CB_GUILib*)m_Handle->GUILib_RegisterMe(m_Handle->addonData); + if (!m_Callbacks) + fprintf(stderr, "libKODI_guilib-ERROR: GUILib_RegisterMe can't get callback table from Kodi !!!\n"); + + return m_Callbacks != nullptr; } void Lock() { - return GUI_lock(m_Handle, m_Callbacks); + m_Callbacks->Lock(); } void Unlock() { - return GUI_unlock(m_Handle, m_Callbacks); + m_Callbacks->Unlock(); } int GetScreenHeight() { - return GUI_get_screen_height(m_Handle, m_Callbacks); + return m_Callbacks->GetScreenHeight(); } int GetScreenWidth() { - return GUI_get_screen_width(m_Handle, m_Callbacks); + return m_Callbacks->GetScreenWidth(); } int GetVideoResolution() { - return GUI_get_video_resolution(m_Handle, m_Callbacks); + return m_Callbacks->GetVideoResolution(); } CAddonGUIWindow* Window_create(const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog) { - return GUI_Window_create(m_Handle, m_Callbacks, xmlFilename, defaultSkin, forceFallback, asDialog); + return new CAddonGUIWindow(m_Handle, m_Callbacks, xmlFilename, defaultSkin, forceFallback, asDialog); } void Window_destroy(CAddonGUIWindow* p) { - return GUI_Window_destroy(p); + delete p; } CAddonGUISpinControl* Control_getSpin(CAddonGUIWindow *window, int controlId) { - return GUI_control_get_spin(m_Handle, m_Callbacks, window, controlId); + return new CAddonGUISpinControl(m_Handle, m_Callbacks, window, controlId); } void Control_releaseSpin(CAddonGUISpinControl* p) { - return GUI_control_release_spin(p); + delete p; } CAddonGUIRadioButton* Control_getRadioButton(CAddonGUIWindow *window, int controlId) { - return GUI_control_get_radiobutton(m_Handle, m_Callbacks, window, controlId); + return new CAddonGUIRadioButton(m_Handle, m_Callbacks, window, controlId); } void Control_releaseRadioButton(CAddonGUIRadioButton* p) { - return GUI_control_release_radiobutton(p); + delete p; } CAddonGUIProgressControl* Control_getProgress(CAddonGUIWindow *window, int controlId) { - return GUI_control_get_progress(m_Handle, m_Callbacks, window, controlId); + return new CAddonGUIProgressControl(m_Handle, m_Callbacks, window, controlId); } void Control_releaseProgress(CAddonGUIProgressControl* p) { - return GUI_control_release_progress(p); + delete p; } CAddonListItem* ListItem_create(const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path) { - return GUI_ListItem_create(m_Handle, m_Callbacks, label, label2, iconImage, thumbnailImage, path); + return new CAddonListItem(m_Handle, m_Callbacks, label, label2, iconImage, thumbnailImage, path); } void ListItem_destroy(CAddonListItem* p) { - return GUI_ListItem_destroy(p); + delete p; } CAddonGUIRenderingControl* Control_getRendering(CAddonGUIWindow *window, int controlId) { - return GUI_control_get_rendering(m_Handle, m_Callbacks, window, controlId); + return new CAddonGUIRenderingControl(m_Handle, m_Callbacks, window, controlId); } void Control_releaseRendering(CAddonGUIRenderingControl* p) { - return GUI_control_release_rendering(p); + delete p; } CAddonGUISliderControl* Control_getSlider(CAddonGUIWindow *window, int controlId) { - return GUI_control_get_slider(m_Handle, m_Callbacks, window, controlId); + return new CAddonGUISliderControl(m_Handle, m_Callbacks, window, controlId); } void Control_releaseSlider(CAddonGUISliderControl* p) { - return GUI_control_release_slider(p); + delete p; } CAddonGUISettingsSliderControl* Control_getSettingsSlider(CAddonGUIWindow *window, int controlId) { - return GUI_control_get_settings_slider(m_Handle, m_Callbacks, window, controlId); + return new CAddonGUISettingsSliderControl(m_Handle, m_Callbacks, window, controlId); } void Control_releaseSettingsSlider(CAddonGUISettingsSliderControl* p) { - return GUI_control_release_settings_slider(p); + delete p; } /*! @name GUI Keyboard functions */ //@{ bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_get_input_with_head(m_Handle, m_Callbacks, strText, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndGetInputWithHead(strText, iMaxStringSize, strHeading, allowEmptyResult, hiddenInput, autoCloseMs); } bool Dialog_Keyboard_ShowAndGetInput(char &strText, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_get_input(m_Handle, m_Callbacks, strText, iMaxStringSize, allowEmptyResult, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndGetInput(strText, iMaxStringSize, allowEmptyResult, autoCloseMs); } bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_get_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndGetNewPasswordWithHead(strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); } bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_get_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndGetNewPassword(strNewPassword, iMaxStringSize, autoCloseMs); } bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_verify_new_password_with_head(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead(strNewPassword, iMaxStringSize, strHeading, allowEmptyResult, autoCloseMs); } bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndVerifyNewPassword(strNewPassword, iMaxStringSize, autoCloseMs); } int Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndVerifyPassword(strPassword, iMaxStringSize, strHeading, iRetries, autoCloseMs); } bool Dialog_Keyboard_ShowAndGetFilter(char &strText, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs = 0) { - return GUI_dialog_keyboard_show_and_get_filter(m_Handle, m_Callbacks, strText, iMaxStringSize, searching, autoCloseMs); + return m_Callbacks->Dialog_Keyboard_ShowAndGetFilter(strText, iMaxStringSize, searching, autoCloseMs); } bool Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard = false) { - return GUI_dialog_keyboard_send_text_to_active_keyboard(m_Handle, m_Callbacks, aTextString, closeKeyboard); + return m_Callbacks->Dialog_Keyboard_SendTextToActiveKeyboard(aTextString, closeKeyboard); } bool Dialog_Keyboard_isKeyboardActivated() { - return GUI_dialog_keyboard_is_activated(m_Handle, m_Callbacks); + return m_Callbacks->Dialog_Keyboard_isKeyboardActivated(); } //@} @@ -445,42 +1160,42 @@ public: //@{ bool Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize) { - return GUI_dialog_numeric_show_and_verify_new_password(m_Handle, m_Callbacks, strNewPassword, iMaxStringSize); + return m_Callbacks->Dialog_Numeric_ShowAndVerifyNewPassword(strNewPassword, iMaxStringSize); } int Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries) { - return GUI_dialog_numeric_show_and_verify_password(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, iRetries); + return m_Callbacks->Dialog_Numeric_ShowAndVerifyPassword(strPassword, iMaxStringSize, strHeading, iRetries); } bool Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput) { - return GUI_dialog_numeric_show_and_verify_input(m_Handle, m_Callbacks, strPassword, iMaxStringSize, strHeading, bGetUserInput); + return m_Callbacks->Dialog_Numeric_ShowAndVerifyInput(strPassword, iMaxStringSize, strHeading, bGetUserInput); } bool Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading) { - return GUI_dialog_numeric_show_and_get_time(m_Handle, m_Callbacks, time, strHeading); + return m_Callbacks->Dialog_Numeric_ShowAndGetTime(time, strHeading); } bool Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading) { - return GUI_dialog_numeric_show_and_get_date(m_Handle, m_Callbacks, date, strHeading); + return m_Callbacks->Dialog_Numeric_ShowAndGetDate(date, strHeading); } bool Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading) { - return GUI_dialog_numeric_show_and_get_ipaddress(m_Handle, m_Callbacks, strIPAddress, iMaxStringSize, strHeading); + return m_Callbacks->Dialog_Numeric_ShowAndGetIPAddress(strIPAddress, iMaxStringSize, strHeading); } bool Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs = 0) { - return GUI_dialog_numeric_show_and_get_number(m_Handle, m_Callbacks, strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs); + return m_Callbacks->Dialog_Numeric_ShowAndGetNumber(strInput, iMaxStringSize, strHeading, iAutoCloseTimeoutMs); } bool Dialog_Numeric_ShowAndGetSeconds(char &strTime, unsigned int iMaxStringSize, const char *strHeading) { - return GUI_dialog_numeric_show_and_get_seconds(m_Handle, m_Callbacks, strTime, iMaxStringSize, strHeading); + return m_Callbacks->Dialog_Numeric_ShowAndGetSeconds(strTime, iMaxStringSize, strHeading); } //@} @@ -488,7 +1203,7 @@ public: //@{ 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) { - return GUI_dialog_filebrowser_show_and_get_file(m_Handle, m_Callbacks, directory, mask, heading, strPath, iMaxStringSize, useThumbs, useFileDirectories, singleList); + return m_Callbacks->Dialog_FileBrowser_ShowAndGetFile(directory, mask, heading, strPath, iMaxStringSize, useThumbs, useFileDirectories, singleList); } //@} @@ -496,12 +1211,12 @@ public: //@{ void Dialog_OK_ShowAndGetInput(const char *heading, const char *text) { - GUI_dialog_ok_show_and_get_input_single_text(m_Handle, m_Callbacks, heading, text); + return m_Callbacks->Dialog_OK_ShowAndGetInputSingleText(heading, text); } void Dialog_OK_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2) { - GUI_dialog_ok_show_and_get_input_line_text(m_Handle, m_Callbacks, heading, line0, line1, line2); + return m_Callbacks->Dialog_OK_ShowAndGetInputLineText(heading, line0, line1, line2); } //@} @@ -509,17 +1224,17 @@ public: //@{ bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *text, bool& bCanceled, const char *noLabel = "", const char *yesLabel = "") { - return GUI_dialog_yesno_show_and_get_input_singletext(m_Handle, m_Callbacks, heading, text, bCanceled, noLabel, yesLabel); + return m_Callbacks->Dialog_YesNo_ShowAndGetInputSingleText(heading, text, bCanceled, noLabel, yesLabel); } bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel = "", const char *yesLabel = "") { - return GUI_dialog_yesno_show_and_get_input_linetext(m_Handle, m_Callbacks, heading, line0, line1, line2, noLabel, yesLabel); + return m_Callbacks->Dialog_YesNo_ShowAndGetInputLineText(heading, line0, line1, line2, noLabel, yesLabel); } bool Dialog_YesNo_ShowAndGetInput(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel = "", const char *yesLabel = "") { - return GUI_dialog_yesno_show_and_get_input_linebuttontext(m_Handle, m_Callbacks, heading, line0, line1, line2, bCanceled, noLabel, yesLabel); + return m_Callbacks->Dialog_YesNo_ShowAndGetInputLineButtonText(heading, line0, line1, line2, bCanceled, noLabel, yesLabel); } //@} @@ -527,7 +1242,7 @@ public: //@{ void Dialog_TextViewer(const char *heading, const char *text) { - return GUI_dialog_text_viewer(m_Handle, m_Callbacks, heading, text); + return m_Callbacks->Dialog_TextViewer(heading, text); } //@} @@ -535,292 +1250,11 @@ public: //@{ int Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected = -1) { - return GUI_dialog_select(m_Handle, m_Callbacks, heading, entries, size, selected); + return m_Callbacks->Dialog_Select(heading, entries, size, selected); } //@} -protected: - void* (*GUI_register_me)(void *HANDLE); - void (*GUI_unregister_me)(void *HANDLE, void* CB); - void (*GUI_lock)(void *HANDLE, void* CB); - void (*GUI_unlock)(void *HANDLE, void* CB); - int (*GUI_get_screen_height)(void *HANDLE, void* CB); - int (*GUI_get_screen_width)(void *HANDLE, void* CB); - int (*GUI_get_video_resolution)(void *HANDLE, void* CB); - CAddonGUIWindow* (*GUI_Window_create)(void *HANDLE, void* CB, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); - void (*GUI_Window_destroy)(CAddonGUIWindow* p); - CAddonGUISpinControl* (*GUI_control_get_spin)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); - void (*GUI_control_release_spin)(CAddonGUISpinControl* p); - CAddonGUIRadioButton* (*GUI_control_get_radiobutton)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); - void (*GUI_control_release_radiobutton)(CAddonGUIRadioButton* p); - CAddonGUIProgressControl* (*GUI_control_get_progress)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); - void (*GUI_control_release_progress)(CAddonGUIProgressControl* p); - CAddonListItem* (*GUI_ListItem_create)(void *HANDLE, void* CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); - void (*GUI_ListItem_destroy)(CAddonListItem* p); - CAddonGUIRenderingControl* (*GUI_control_get_rendering)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); - void (*GUI_control_release_rendering)(CAddonGUIRenderingControl* p); - CAddonGUISliderControl* (*GUI_control_get_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); - void (*GUI_control_release_slider)(CAddonGUISliderControl* p); - CAddonGUISettingsSliderControl* (*GUI_control_get_settings_slider)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId); - void (*GUI_control_release_settings_slider)(CAddonGUISettingsSliderControl* p); - 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); - bool (*GUI_dialog_keyboard_show_and_get_input)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs); - 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); - bool (*GUI_dialog_keyboard_show_and_get_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); - 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); - bool (*GUI_dialog_keyboard_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs); - 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); - bool (*GUI_dialog_keyboard_show_and_get_filter)(void *HANDLE, void *CB, char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs); - bool (*GUI_dialog_keyboard_send_text_to_active_keyboard)(void *HANDLE, void *CB, const char *aTextString, bool closeKeyboard); - bool (*GUI_dialog_keyboard_is_activated)(void *HANDLE, void *CB); - bool (*GUI_dialog_numeric_show_and_verify_new_password)(void *HANDLE, void *CB, char &strNewPassword, unsigned int iMaxStringSize); - int (*GUI_dialog_numeric_show_and_verify_password)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries); - bool (*GUI_dialog_numeric_show_and_verify_input)(void *HANDLE, void *CB, char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput); - bool (*GUI_dialog_numeric_show_and_get_time)(void *HANDLE, void *CB, tm &time, const char *strHeading); - bool (*GUI_dialog_numeric_show_and_get_date)(void *HANDLE, void *CB, tm &date, const char *strHeading); - bool (*GUI_dialog_numeric_show_and_get_ipaddress)(void *HANDLE, void *CB, char &IPAddress, unsigned int iMaxStringSize, const char *strHeading); - bool (*GUI_dialog_numeric_show_and_get_number)(void *HANDLE, void *CB, char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs); - bool (*GUI_dialog_numeric_show_and_get_seconds)(void *HANDLE, void *CB, char &strTime, unsigned int iMaxStringSize, const char *strHeading); - 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); - void (*GUI_dialog_ok_show_and_get_input_single_text)(void *HANDLE, void *CB, const char *heading, const char *text); - 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); - 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); - 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); - 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); - void (*GUI_dialog_text_viewer)(void *hdl, void *cb, const char *heading, const char *text); - int (*GUI_dialog_select)(void *hdl, void *cb, const char *heading, const char *entries[], unsigned int size, int selected); - -private: - void *m_libKODI_guilib; - void *m_Handle; - void *m_Callbacks; - struct cb_array - { - const char* libPath; - }; -}; - -class CAddonGUISpinControl -{ -public: - CAddonGUISpinControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); - virtual ~CAddonGUISpinControl(void) {} - - virtual void SetVisible(bool yesNo); - virtual void SetText(const char *label); - virtual void Clear(); - virtual void AddLabel(const char *label, int iValue); - virtual int GetValue(); - virtual void SetValue(int iValue); - -private: - CAddonGUIWindow *m_Window; - GUIHANDLE m_SpinHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonGUIRadioButton -{ -public: - CAddonGUIRadioButton(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); - virtual ~CAddonGUIRadioButton() {} - - virtual void SetVisible(bool yesNo); - virtual void SetText(const char *label); - virtual void SetSelected(bool yesNo); - virtual bool IsSelected(); - -private: - CAddonGUIWindow *m_Window; - GUIHANDLE m_ButtonHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonGUIProgressControl -{ -public: - CAddonGUIProgressControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); - virtual ~CAddonGUIProgressControl(void) {} - - virtual void SetPercentage(float fPercent); - virtual float GetPercentage() const; - virtual void SetInfo(int iInfo); - virtual int GetInfo() const; - virtual std::string GetDescription() const; - -private: - CAddonGUIWindow *m_Window; - GUIHANDLE m_ProgressHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonGUISliderControl -{ -public: - CAddonGUISliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); - virtual ~CAddonGUISliderControl(void) {} - - virtual void SetVisible(bool yesNo); - virtual std::string GetDescription() const; - - virtual void SetIntRange(int iStart, int iEnd); - virtual void SetIntValue(int iValue); - virtual int GetIntValue() const; - virtual void SetIntInterval(int iInterval); - - virtual void SetPercentage(float fPercent); - virtual float GetPercentage() const; - - virtual void SetFloatRange(float fStart, float fEnd); - virtual void SetFloatValue(float fValue); - virtual float GetFloatValue() const; - virtual void SetFloatInterval(float fInterval); - -private: - CAddonGUIWindow *m_Window; - GUIHANDLE m_SliderHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonGUISettingsSliderControl -{ -public: - CAddonGUISettingsSliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); - virtual ~CAddonGUISettingsSliderControl(void) {} - - virtual void SetVisible(bool yesNo); - virtual void SetText(const char *label); - virtual std::string GetDescription() const; - - virtual void SetIntRange(int iStart, int iEnd); - virtual void SetIntValue(int iValue); - virtual int GetIntValue() const; - virtual void SetIntInterval(int iInterval); - - virtual void SetPercentage(float fPercent); - virtual float GetPercentage() const; - - virtual void SetFloatRange(float fStart, float fEnd); - virtual void SetFloatValue(float fValue); - virtual float GetFloatValue() const; - virtual void SetFloatInterval(float fInterval); - -private: - CAddonGUIWindow *m_Window; - GUIHANDLE m_SettingsSliderHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonListItem -{ -friend class CAddonGUIWindow; - -public: - CAddonListItem(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path); - virtual ~CAddonListItem(void) {} - - virtual const char *GetLabel(); - virtual void SetLabel(const char *label); - virtual const char *GetLabel2(); - virtual void SetLabel2(const char *label); - virtual void SetIconImage(const char *image); - virtual void SetThumbnailImage(const char *image); - virtual void SetInfo(const char *Info); - virtual void SetProperty(const char *key, const char *value); - virtual const char *GetProperty(const char *key) const; - virtual void SetPath(const char *Path); - -// {(char*)"select(); -// {(char*)"isSelected(); -protected: - GUIHANDLE m_ListItemHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonGUIWindow -{ -friend class CAddonGUISpinControl; -friend class CAddonGUIRadioButton; -friend class CAddonGUIProgressControl; -friend class CAddonGUIRenderingControl; -friend class CAddonGUISliderControl; -friend class CAddonGUISettingsSliderControl; - -public: - CAddonGUIWindow(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog); - virtual ~CAddonGUIWindow(); - - virtual bool Show(); - virtual void Close(); - virtual void DoModal(); - virtual bool SetFocusId(int iControlId); - virtual int GetFocusId(); - virtual bool SetCoordinateResolution(int res); - virtual void SetProperty(const char *key, const char *value); - virtual void SetPropertyInt(const char *key, int value); - virtual void SetPropertyBool(const char *key, bool value); - virtual void SetPropertyDouble(const char *key, double value); - virtual const char *GetProperty(const char *key) const; - virtual int GetPropertyInt(const char *key) const; - virtual bool GetPropertyBool(const char *key) const; - virtual double GetPropertyDouble(const char *key) const; - virtual void ClearProperties(); - virtual int GetListSize(); - virtual void ClearList(); - virtual GUIHANDLE AddStringItem(const char *name, int itemPosition = -1); - virtual void AddItem(GUIHANDLE item, int itemPosition = -1); - virtual void AddItem(CAddonListItem *item, int itemPosition = -1); - virtual void RemoveItem(int itemPosition); - virtual GUIHANDLE GetListItem(int listPos); - virtual void SetCurrentListPosition(int listPos); - virtual int GetCurrentListPosition(); - virtual void SetControlLabel(int controlId, const char *label); - virtual void MarkDirtyRegion(); - - virtual bool OnClick(int controlId); - virtual bool OnFocus(int controlId); - virtual bool OnInit(); - virtual bool OnAction(int actionId); - - GUIHANDLE m_cbhdl; - bool (*CBOnInit)(GUIHANDLE cbhdl); - bool (*CBOnFocus)(GUIHANDLE cbhdl, int controlId); - bool (*CBOnClick)(GUIHANDLE cbhdl, int controlId); - bool (*CBOnAction)(GUIHANDLE cbhdl, int actionId); - -protected: - GUIHANDLE m_WindowHandle; - void *m_Handle; - void *m_cb; -}; - -class CAddonGUIRenderingControl -{ -public: - CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId); - virtual ~CAddonGUIRenderingControl(); - virtual void Init(); - - virtual bool Create(int x, int y, int w, int h, void *device); - virtual void Render(); - virtual void Stop(); - virtual bool Dirty(); - - GUIHANDLE m_cbhdl; - bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device); - void (*CBRender)(GUIHANDLE cbhdl); - void (*CBStop)(GUIHANDLE cbhdl); - bool (*CBDirty)(GUIHANDLE cbhdl); - private: - CAddonGUIWindow *m_Window; - GUIHANDLE m_RenderingHandle; - void *m_Handle; - void *m_cb; + AddonCB* m_Handle; + KodiAPI::V1::GUI::CB_GUILib* m_Callbacks; }; |