summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/interfaces/gui/controls
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/addons/interfaces/gui/controls
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/addons/interfaces/gui/controls')
-rw-r--r--xbmc/addons/interfaces/gui/controls/Button.cpp146
-rw-r--r--xbmc/addons/interfaces/gui/controls/Button.h56
-rw-r--r--xbmc/addons/interfaces/gui/controls/CMakeLists.txt27
-rw-r--r--xbmc/addons/interfaces/gui/controls/Edit.cpp239
-rw-r--r--xbmc/addons/interfaces/gui/controls/Edit.h67
-rw-r--r--xbmc/addons/interfaces/gui/controls/FadeLabel.cpp130
-rw-r--r--xbmc/addons/interfaces/gui/controls/FadeLabel.h57
-rw-r--r--xbmc/addons/interfaces/gui/controls/Image.cpp92
-rw-r--r--xbmc/addons/interfaces/gui/controls/Image.h57
-rw-r--r--xbmc/addons/interfaces/gui/controls/Label.cpp92
-rw-r--r--xbmc/addons/interfaces/gui/controls/Label.h53
-rw-r--r--xbmc/addons/interfaces/gui/controls/Progress.cpp88
-rw-r--r--xbmc/addons/interfaces/gui/controls/Progress.h53
-rw-r--r--xbmc/addons/interfaces/gui/controls/RadioButton.cpp146
-rw-r--r--xbmc/addons/interfaces/gui/controls/RadioButton.h57
-rw-r--r--xbmc/addons/interfaces/gui/controls/Rendering.cpp148
-rw-r--r--xbmc/addons/interfaces/gui/controls/Rendering.h89
-rw-r--r--xbmc/addons/interfaces/gui/controls/SettingsSlider.cpp311
-rw-r--r--xbmc/addons/interfaces/gui/controls/SettingsSlider.h77
-rw-r--r--xbmc/addons/interfaces/gui/controls/Slider.cpp305
-rw-r--r--xbmc/addons/interfaces/gui/controls/Slider.h78
-rw-r--r--xbmc/addons/interfaces/gui/controls/Spin.cpp346
-rw-r--r--xbmc/addons/interfaces/gui/controls/Spin.h86
-rw-r--r--xbmc/addons/interfaces/gui/controls/TextBox.cpp147
-rw-r--r--xbmc/addons/interfaces/gui/controls/TextBox.h57
25 files changed, 3004 insertions, 0 deletions
diff --git a/xbmc/addons/interfaces/gui/controls/Button.cpp b/xbmc/addons/interfaces/gui/controls/Button.cpp
new file mode 100644
index 0000000..24a9994
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Button.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Button.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Button.h"
+#include "guilib/GUIButtonControl.h"
+#include "utils/StringUtils.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlButton::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_button =
+ new AddonToKodiFuncTable_kodi_gui_control_button();
+
+ addonInterface->toKodi->kodi_gui->control_button->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_button->set_enabled = set_enabled;
+
+ addonInterface->toKodi->kodi_gui->control_button->set_label = set_label;
+ addonInterface->toKodi->kodi_gui->control_button->get_label = get_label;
+
+ addonInterface->toKodi->kodi_gui->control_button->set_label2 = set_label2;
+ addonInterface->toKodi->kodi_gui->control_button->get_label2 = get_label2;
+}
+
+void Interface_GUIControlButton::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_button;
+}
+
+void Interface_GUIControlButton::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIButtonControl* control = static_cast<CGUIButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlButton::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlButton::set_enabled(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool enabled)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIButtonControl* control = static_cast<CGUIButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlButton::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetEnabled(enabled);
+}
+
+void Interface_GUIControlButton::set_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIButtonControl* control = static_cast<CGUIButtonControl*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlButton::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetLabel(label);
+}
+
+char* Interface_GUIControlButton::get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIButtonControl* control = static_cast<CGUIButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlButton::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetLabel().c_str());
+}
+
+void Interface_GUIControlButton::set_label2(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIButtonControl* control = static_cast<CGUIButtonControl*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlButton::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetLabel2(label);
+}
+
+char* Interface_GUIControlButton::get_label2(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIButtonControl* control = static_cast<CGUIButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlButton::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetLabel2().c_str());
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Button.h b/xbmc/addons/interfaces/gui/controls/Button.h
new file mode 100644
index 0000000..221ae4e
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Button.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/button.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Button.h"
+ */
+ struct Interface_GUIControlButton
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+
+ static void set_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* label);
+ static char* get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_label2(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* label);
+ static char* get_label2(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/CMakeLists.txt b/xbmc/addons/interfaces/gui/controls/CMakeLists.txt
new file mode 100644
index 0000000..0a708c6
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(SOURCES Button.cpp
+ Edit.cpp
+ FadeLabel.cpp
+ Image.cpp
+ Label.cpp
+ Progress.cpp
+ RadioButton.cpp
+ Rendering.cpp
+ SettingsSlider.cpp
+ Slider.cpp
+ Spin.cpp
+ TextBox.cpp)
+
+set(HEADERS Button.h
+ Edit.h
+ FadeLabel.h
+ Image.h
+ Label.h
+ Progress.h
+ RadioButton.h
+ Rendering.h
+ SettingsSlider.h
+ Slider.h
+ Spin.h
+ TextBox.h)
+
+core_add_library(addons_interfaces_gui_controls)
diff --git a/xbmc/addons/interfaces/gui/controls/Edit.cpp b/xbmc/addons/interfaces/gui/controls/Edit.cpp
new file mode 100644
index 0000000..b537279
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Edit.cpp
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Edit.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Edit.h"
+#include "guilib/GUIEditControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlEdit::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_edit = new AddonToKodiFuncTable_kodi_gui_control_edit();
+
+ addonInterface->toKodi->kodi_gui->control_edit->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_edit->set_enabled = set_enabled;
+ addonInterface->toKodi->kodi_gui->control_edit->set_input_type = set_input_type;
+ addonInterface->toKodi->kodi_gui->control_edit->set_label = set_label;
+ addonInterface->toKodi->kodi_gui->control_edit->get_label = get_label;
+ addonInterface->toKodi->kodi_gui->control_edit->set_text = set_text;
+ addonInterface->toKodi->kodi_gui->control_edit->get_text = get_text;
+ addonInterface->toKodi->kodi_gui->control_edit->set_cursor_position = set_cursor_position;
+ addonInterface->toKodi->kodi_gui->control_edit->get_cursor_position = get_cursor_position;
+}
+
+void Interface_GUIControlEdit::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_edit;
+}
+
+void Interface_GUIControlEdit::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlEdit::set_enabled(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool enable)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetEnabled(enable);
+}
+
+void Interface_GUIControlEdit::set_input_type(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int type,
+ const char* heading)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control || !heading)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "heading='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(heading),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIEditControl::INPUT_TYPE kodiType;
+ switch (static_cast<AddonGUIInputType>(type))
+ {
+ case ADDON_INPUT_TYPE_TEXT:
+ kodiType = CGUIEditControl::INPUT_TYPE_TEXT;
+ break;
+ case ADDON_INPUT_TYPE_NUMBER:
+ kodiType = CGUIEditControl::INPUT_TYPE_NUMBER;
+ break;
+ case ADDON_INPUT_TYPE_SECONDS:
+ kodiType = CGUIEditControl::INPUT_TYPE_SECONDS;
+ break;
+ case ADDON_INPUT_TYPE_TIME:
+ kodiType = CGUIEditControl::INPUT_TYPE_TIME;
+ break;
+ case ADDON_INPUT_TYPE_DATE:
+ kodiType = CGUIEditControl::INPUT_TYPE_DATE;
+ break;
+ case ADDON_INPUT_TYPE_IPADDRESS:
+ kodiType = CGUIEditControl::INPUT_TYPE_IPADDRESS;
+ break;
+ case ADDON_INPUT_TYPE_PASSWORD:
+ kodiType = CGUIEditControl::INPUT_TYPE_PASSWORD;
+ break;
+ case ADDON_INPUT_TYPE_PASSWORD_MD5:
+ kodiType = CGUIEditControl::INPUT_TYPE_PASSWORD_MD5;
+ break;
+ case ADDON_INPUT_TYPE_SEARCH:
+ kodiType = CGUIEditControl::INPUT_TYPE_SEARCH;
+ break;
+ case ADDON_INPUT_TYPE_FILTER:
+ kodiType = CGUIEditControl::INPUT_TYPE_FILTER;
+ break;
+ case ADDON_INPUT_TYPE_READONLY:
+ default:
+ kodiType = CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW;
+ }
+
+ control->SetInputType(kodiType, heading);
+}
+
+void Interface_GUIControlEdit::set_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetLabel(label);
+}
+
+char* Interface_GUIControlEdit::get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetLabel().c_str());
+}
+
+void Interface_GUIControlEdit::set_text(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* text)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control || !text)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "text='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(text),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetLabel2(text);
+}
+
+char* Interface_GUIControlEdit::get_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetLabel2().c_str());
+}
+
+void Interface_GUIControlEdit::set_cursor_position(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ unsigned int position)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetCursorPosition(position);
+}
+
+unsigned int Interface_GUIControlEdit::get_cursor_position(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlEdit::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0;
+ }
+
+ return control->GetCursorPosition();
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Edit.h b/xbmc/addons/interfaces/gui/controls/Edit.h
new file mode 100644
index 0000000..9dda1e2
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Edit.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/edit.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Edit.h"
+ */
+ struct Interface_GUIControlEdit
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+
+ static void set_input_type(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int type,
+ const char* heading);
+
+ static void set_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* label);
+ static char* get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* text);
+ static char* get_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_cursor_position(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ unsigned int position);
+ static unsigned int get_cursor_position(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/FadeLabel.cpp b/xbmc/addons/interfaces/gui/controls/FadeLabel.cpp
new file mode 100644
index 0000000..13c5604
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/FadeLabel.cpp
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "FadeLabel.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h"
+#include "guilib/GUIFadeLabelControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlFadeLabel::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_fade_label =
+ new AddonToKodiFuncTable_kodi_gui_control_fade_label();
+
+ addonInterface->toKodi->kodi_gui->control_fade_label->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_fade_label->add_label = add_label;
+ addonInterface->toKodi->kodi_gui->control_fade_label->get_label = get_label;
+ addonInterface->toKodi->kodi_gui->control_fade_label->set_scrolling = set_scrolling;
+ addonInterface->toKodi->kodi_gui->control_fade_label->reset = reset;
+}
+
+void Interface_GUIControlFadeLabel::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_fade_label;
+}
+
+void Interface_GUIControlFadeLabel::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIFadeLabelControl* control = static_cast<CGUIFadeLabelControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlFadeLabel::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlFadeLabel::add_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIFadeLabelControl* control = static_cast<CGUIFadeLabelControl*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlFadeLabel::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}', label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_ADD, control->GetParentID(), control->GetID());
+ msg.SetLabel(label);
+ control->OnMessage(msg);
+}
+
+char* Interface_GUIControlFadeLabel::get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIFadeLabelControl* control = static_cast<CGUIFadeLabelControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlFadeLabel::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ CGUIMessage msg(GUI_MSG_ITEM_SELECTED, control->GetParentID(), control->GetID());
+ control->OnMessage(msg);
+ std::string text = msg.GetLabel();
+ return strdup(text.c_str());
+}
+
+void Interface_GUIControlFadeLabel::set_scrolling(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool scroll)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIFadeLabelControl* control = static_cast<CGUIFadeLabelControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlFadeLabel::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetScrolling(scroll);
+}
+
+void Interface_GUIControlFadeLabel::reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIFadeLabelControl* control = static_cast<CGUIFadeLabelControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlFadeLabel::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_RESET, control->GetParentID(), control->GetID());
+ control->OnMessage(msg);
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/FadeLabel.h b/xbmc/addons/interfaces/gui/controls/FadeLabel.h
new file mode 100644
index 0000000..2c3cd68
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/FadeLabel.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/fade_label.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h"
+ */
+ struct Interface_GUIControlFadeLabel
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+ static void set_selected(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool selected);
+
+ static void add_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* label);
+ static char* get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_scrolling(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool scroll);
+ static void reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/Image.cpp b/xbmc/addons/interfaces/gui/controls/Image.cpp
new file mode 100644
index 0000000..88f368c
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Image.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Image.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Image.h"
+#include "guilib/GUIImage.h"
+#include "utils/log.h"
+
+using namespace KODI;
+
+namespace ADDON
+{
+
+void Interface_GUIControlImage::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_image =
+ new AddonToKodiFuncTable_kodi_gui_control_image();
+
+ addonInterface->toKodi->kodi_gui->control_image->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_image->set_filename = set_filename;
+ addonInterface->toKodi->kodi_gui->control_image->set_color_diffuse = set_color_diffuse;
+}
+
+void Interface_GUIControlImage::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_image;
+}
+
+void Interface_GUIControlImage::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIImage* control = static_cast<CGUIImage*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlImage::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlImage::set_filename(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* filename,
+ bool use_cache)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIImage* control = static_cast<CGUIImage*>(handle);
+ if (!addon || !control || !filename)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlImage::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "filename='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(filename),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetFileName(filename, false, use_cache);
+}
+
+void Interface_GUIControlImage::set_color_diffuse(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ uint32_t colorDiffuse)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIImage* control = static_cast<CGUIImage*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlImage::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetColorDiffuse(GUILIB::GUIINFO::CGUIInfoColor(colorDiffuse));
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Image.h b/xbmc/addons/interfaces/gui/controls/Image.h
new file mode 100644
index 0000000..b12bece
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Image.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/image.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Image.h"
+ */
+ struct Interface_GUIControlImage
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_filename(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* filename,
+ bool use_cache);
+ static void set_color_diffuse(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ uint32_t color_diffuse);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/Label.cpp b/xbmc/addons/interfaces/gui/controls/Label.cpp
new file mode 100644
index 0000000..3922e3f
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Label.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Label.h"
+
+#include "ServiceBroker.h"
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Label.h"
+#include "guilib/GUIComponent.h"
+#include "guilib/GUILabelControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlLabel::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_label =
+ new AddonToKodiFuncTable_kodi_gui_control_label();
+
+ addonInterface->toKodi->kodi_gui->control_label->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_label->set_label = set_label;
+ addonInterface->toKodi->kodi_gui->control_label->get_label = get_label;
+}
+
+void Interface_GUIControlLabel::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_label;
+}
+
+void Interface_GUIControlLabel::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUILabelControl* control = static_cast<CGUILabelControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlLabel::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlLabel::set_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUILabelControl* control = static_cast<CGUILabelControl*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlLabel::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_SET, control->GetParentID(), control->GetID());
+ msg.SetLabel(label);
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+char* Interface_GUIControlLabel::get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUILabelControl* control = static_cast<CGUILabelControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlLabel::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetDescription().c_str());
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Label.h b/xbmc/addons/interfaces/gui/controls/Label.h
new file mode 100644
index 0000000..020c3d5
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Label.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/label.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h"
+ */
+ struct Interface_GUIControlLabel
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+
+ static void set_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* label);
+ static char* get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/Progress.cpp b/xbmc/addons/interfaces/gui/controls/Progress.cpp
new file mode 100644
index 0000000..639d079
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Progress.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Progress.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Progress.h"
+#include "guilib/GUIProgressControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlProgress::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_progress =
+ new AddonToKodiFuncTable_kodi_gui_control_progress();
+
+ addonInterface->toKodi->kodi_gui->control_progress->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_progress->set_percentage = set_percentage;
+ addonInterface->toKodi->kodi_gui->control_progress->get_percentage = get_percentage;
+}
+
+void Interface_GUIControlProgress::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_progress;
+}
+
+void Interface_GUIControlProgress::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIProgressControl* control = static_cast<CGUIProgressControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlProgress::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlProgress::set_percentage(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float percent)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIProgressControl* control = static_cast<CGUIProgressControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlProgress::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetPercentage(percent);
+}
+
+float Interface_GUIControlProgress::get_percentage(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIProgressControl* control = static_cast<CGUIProgressControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlProgress::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0.0f;
+ }
+
+ return control->GetPercentage();
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Progress.h b/xbmc/addons/interfaces/gui/controls/Progress.h
new file mode 100644
index 0000000..c3368fa
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Progress.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/progress.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Progress.h"
+ */
+ struct Interface_GUIControlProgress
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+
+ static void set_percentage(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, float percent);
+ static float get_percentage(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/RadioButton.cpp b/xbmc/addons/interfaces/gui/controls/RadioButton.cpp
new file mode 100644
index 0000000..9d3b826
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/RadioButton.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "RadioButton.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/RadioButton.h"
+#include "guilib/GUIRadioButtonControl.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlRadioButton::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_radio_button =
+ new AddonToKodiFuncTable_kodi_gui_control_radio_button();
+
+ addonInterface->toKodi->kodi_gui->control_radio_button->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_radio_button->set_enabled = set_enabled;
+
+ addonInterface->toKodi->kodi_gui->control_radio_button->set_label = set_label;
+ addonInterface->toKodi->kodi_gui->control_radio_button->get_label = get_label;
+
+ addonInterface->toKodi->kodi_gui->control_radio_button->set_selected = set_selected;
+ addonInterface->toKodi->kodi_gui->control_radio_button->is_selected = is_selected;
+}
+
+void Interface_GUIControlRadioButton::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_radio_button;
+}
+
+void Interface_GUIControlRadioButton::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIRadioButtonControl* control = static_cast<CGUIRadioButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlRadioButton::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlRadioButton::set_enabled(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool enabled)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIRadioButtonControl* control = static_cast<CGUIRadioButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlRadioButton::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetEnabled(enabled);
+}
+
+void Interface_GUIControlRadioButton::set_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIRadioButtonControl* control = static_cast<CGUIRadioButtonControl*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlRadioButton::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}', label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetLabel(label);
+}
+
+char* Interface_GUIControlRadioButton::get_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIRadioButtonControl* control = static_cast<CGUIRadioButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlRadioButton::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetLabel().c_str());
+}
+
+void Interface_GUIControlRadioButton::set_selected(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool selected)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIRadioButtonControl* control = static_cast<CGUIRadioButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlRadioButton::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetSelected(selected);
+}
+
+bool Interface_GUIControlRadioButton::is_selected(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIRadioButtonControl* control = static_cast<CGUIRadioButtonControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlRadioButton::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return false;
+ }
+
+ return control->IsSelected();
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/RadioButton.h b/xbmc/addons/interfaces/gui/controls/RadioButton.h
new file mode 100644
index 0000000..dd7ed4e
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/RadioButton.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/radio_button.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/RadioButton.h"
+ */
+ struct Interface_GUIControlRadioButton
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+
+ static void set_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* label);
+ static char* get_label(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_selected(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool selected);
+ static bool is_selected(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/Rendering.cpp b/xbmc/addons/interfaces/gui/controls/Rendering.cpp
new file mode 100644
index 0000000..a26a27f
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Rendering.cpp
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Rendering.h"
+
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/interfaces/gui/General.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Rendering.h"
+#include "guilib/GUIRenderingControl.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlAddonRendering::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_rendering =
+ new AddonToKodiFuncTable_kodi_gui_control_rendering();
+
+ addonInterface->toKodi->kodi_gui->control_rendering->set_callbacks = set_callbacks;
+ addonInterface->toKodi->kodi_gui->control_rendering->destroy = destroy;
+}
+
+void Interface_GUIControlAddonRendering::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_rendering;
+}
+
+void Interface_GUIControlAddonRendering::set_callbacks(
+ KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ KODI_GUI_CLIENT_HANDLE clienthandle,
+ bool (*createCB)(KODI_GUI_CLIENT_HANDLE, int, int, int, int, ADDON_HARDWARE_CONTEXT),
+ void (*renderCB)(KODI_GUI_CLIENT_HANDLE),
+ void (*stopCB)(KODI_GUI_CLIENT_HANDLE),
+ bool (*dirtyCB)(KODI_GUI_CLIENT_HANDLE))
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIAddonRenderingControl* control = static_cast<CGUIAddonRenderingControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlAddonRendering::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ Interface_GUIGeneral::lock();
+ control->m_clientHandle = clienthandle;
+ control->CBCreate = createCB;
+ control->CBRender = renderCB;
+ control->CBStop = stopCB;
+ control->CBDirty = dirtyCB;
+ control->m_addon = addon;
+ Interface_GUIGeneral::unlock();
+
+ control->m_control->InitCallback(control);
+}
+
+void Interface_GUIControlAddonRendering::destroy(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUIAddonRenderingControl* control = static_cast<CGUIAddonRenderingControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlAddonRendering::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ Interface_GUIGeneral::lock();
+ static_cast<CGUIAddonRenderingControl*>(handle)->Delete();
+ Interface_GUIGeneral::unlock();
+}
+
+
+CGUIAddonRenderingControl::CGUIAddonRenderingControl(CGUIRenderingControl* control)
+ : CBCreate{nullptr},
+ CBRender{nullptr},
+ CBStop{nullptr},
+ CBDirty{nullptr},
+ m_clientHandle{nullptr},
+ m_addon{nullptr},
+ m_control{control},
+ m_refCount{1}
+{
+}
+
+bool CGUIAddonRenderingControl::Create(int x, int y, int w, int h, void* device)
+{
+ if (CBCreate)
+ {
+ if (CBCreate(m_clientHandle, x, y, w, h, device))
+ {
+ ++m_refCount;
+ return true;
+ }
+ }
+ return false;
+}
+
+void CGUIAddonRenderingControl::Render()
+{
+ if (CBRender)
+ {
+ CBRender(m_clientHandle);
+ }
+}
+
+void CGUIAddonRenderingControl::Stop()
+{
+ if (CBStop)
+ {
+ CBStop(m_clientHandle);
+ }
+
+ --m_refCount;
+ if (m_refCount <= 0)
+ delete this;
+}
+
+void CGUIAddonRenderingControl::Delete()
+{
+ --m_refCount;
+ if (m_refCount <= 0)
+ delete this;
+}
+
+bool CGUIAddonRenderingControl::IsDirty()
+{
+ bool ret = true;
+ if (CBDirty)
+ {
+ ret = CBDirty(m_clientHandle);
+ }
+ return ret;
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Rendering.h b/xbmc/addons/interfaces/gui/controls/Rendering.h
new file mode 100644
index 0000000..dbd82d8
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Rendering.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/rendering.h"
+#include "guilib/IRenderingCallback.h"
+
+class CGUIRenderingControl;
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ class CAddonDll;
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Rendering.h"
+ */
+ struct Interface_GUIControlAddonRendering
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_callbacks(
+ KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ KODI_GUI_CLIENT_HANDLE clienthandle,
+ bool (*createCB)(KODI_GUI_CLIENT_HANDLE, int, int, int, int, ADDON_HARDWARE_CONTEXT),
+ void (*renderCB)(KODI_GUI_CLIENT_HANDLE),
+ void (*stopCB)(KODI_GUI_CLIENT_HANDLE),
+ bool (*dirtyCB)(KODI_GUI_CLIENT_HANDLE));
+ static void destroy(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ //@}
+ };
+
+ class CGUIAddonRenderingControl : public IRenderingCallback
+ {
+ friend struct Interface_GUIControlAddonRendering;
+
+ public:
+ explicit CGUIAddonRenderingControl(CGUIRenderingControl* pControl);
+ ~CGUIAddonRenderingControl() override = default;
+
+ bool Create(int x, int y, int w, int h, void* device) override;
+ void Render() override;
+ void Stop() override;
+ bool IsDirty() override;
+ virtual void Delete();
+
+ protected:
+ bool (*CBCreate)(KODI_GUI_CLIENT_HANDLE cbhdl, int x, int y, int w, int h, void* device);
+ void (*CBRender)(KODI_GUI_CLIENT_HANDLE cbhdl);
+ void (*CBStop)(KODI_GUI_CLIENT_HANDLE cbhdl);
+ bool (*CBDirty)(KODI_GUI_CLIENT_HANDLE cbhdl);
+
+ KODI_GUI_CLIENT_HANDLE m_clientHandle;
+ CAddonDll* m_addon;
+ CGUIRenderingControl* m_control;
+ int m_refCount;
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/SettingsSlider.cpp b/xbmc/addons/interfaces/gui/controls/SettingsSlider.cpp
new file mode 100644
index 0000000..c847a64
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/SettingsSlider.cpp
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "SettingsSlider.h"
+
+#include "ServiceBroker.h"
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.h"
+#include "guilib/GUIComponent.h"
+#include "guilib/GUISettingsSliderControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlSettingsSlider::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_settings_slider =
+ new AddonToKodiFuncTable_kodi_gui_control_settings_slider();
+
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_enabled = set_enabled;
+
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_text = set_text;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->reset = reset;
+
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_int_range = set_int_range;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_int_value = set_int_value;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->get_int_value = get_int_value;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_int_interval = set_int_interval;
+
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_percentage = set_percentage;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->get_percentage = get_percentage;
+
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_float_range = set_float_range;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_float_value = set_float_value;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->get_float_value = get_float_value;
+ addonInterface->toKodi->kodi_gui->control_settings_slider->set_float_interval =
+ set_float_interval;
+}
+
+void Interface_GUIControlSettingsSlider::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_settings_slider;
+}
+
+void Interface_GUIControlSettingsSlider::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlSettingsSlider::set_enabled(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool enabled)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetEnabled(enabled);
+}
+
+void Interface_GUIControlSettingsSlider::set_text(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* text)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control || !text)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}', text='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(text),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_SET, control->GetParentID(), control->GetID());
+ msg.SetLabel(text);
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+void Interface_GUIControlSettingsSlider::reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_RESET, control->GetParentID(), control->GetID());
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+void Interface_GUIControlSettingsSlider::set_int_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int start,
+ int end)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_INT);
+ control->SetRange(start, end);
+}
+
+void Interface_GUIControlSettingsSlider::set_int_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_INT);
+ control->SetIntValue(value);
+}
+
+int Interface_GUIControlSettingsSlider::get_int_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return -1;
+ }
+
+ return control->GetIntValue();
+}
+
+void Interface_GUIControlSettingsSlider::set_int_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int interval)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetIntInterval(interval);
+}
+
+void Interface_GUIControlSettingsSlider::set_percentage(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float percent)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_PERCENTAGE);
+ control->SetPercentage(percent);
+}
+
+float Interface_GUIControlSettingsSlider::get_percentage(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0.0f;
+ }
+
+ return control->GetPercentage();
+}
+
+void Interface_GUIControlSettingsSlider::set_float_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float start,
+ float end)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_FLOAT);
+ control->SetFloatRange(start, end);
+}
+
+void Interface_GUIControlSettingsSlider::set_float_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_FLOAT);
+ control->SetFloatValue(value);
+}
+
+float Interface_GUIControlSettingsSlider::get_float_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0.0f;
+ }
+
+ return control->GetFloatValue();
+}
+
+void Interface_GUIControlSettingsSlider::set_float_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float interval)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSettingsSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetFloatInterval(interval);
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/SettingsSlider.h b/xbmc/addons/interfaces/gui/controls/SettingsSlider.h
new file mode 100644
index 0000000..425c275
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/SettingsSlider.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/settings_slider.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.h"
+ */
+ struct Interface_GUIControlSettingsSlider
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+
+ static void set_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* text);
+ static void reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_int_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int start,
+ int end);
+ static void set_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, int value);
+ static int get_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_int_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int interval);
+
+ static void set_percentage(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, float percent);
+ static float get_percentage(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_float_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float start,
+ float end);
+ static void set_float_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, float value);
+ static float get_float_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_float_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float interval);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/Slider.cpp b/xbmc/addons/interfaces/gui/controls/Slider.cpp
new file mode 100644
index 0000000..73502d8
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Slider.cpp
@@ -0,0 +1,305 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Slider.h"
+
+#include "ServiceBroker.h"
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Slider.h"
+#include "guilib/GUIComponent.h"
+#include "guilib/GUISliderControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlSlider::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_slider =
+ new AddonToKodiFuncTable_kodi_gui_control_slider();
+
+ addonInterface->toKodi->kodi_gui->control_slider->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_slider->set_enabled = set_enabled;
+
+ addonInterface->toKodi->kodi_gui->control_slider->reset = reset;
+ addonInterface->toKodi->kodi_gui->control_slider->get_description = get_description;
+
+ addonInterface->toKodi->kodi_gui->control_slider->set_int_range = set_int_range;
+ addonInterface->toKodi->kodi_gui->control_slider->set_int_value = set_int_value;
+ addonInterface->toKodi->kodi_gui->control_slider->get_int_value = get_int_value;
+ addonInterface->toKodi->kodi_gui->control_slider->set_int_interval = set_int_interval;
+
+ addonInterface->toKodi->kodi_gui->control_slider->set_percentage = set_percentage;
+ addonInterface->toKodi->kodi_gui->control_slider->get_percentage = get_percentage;
+
+ addonInterface->toKodi->kodi_gui->control_slider->set_float_range = set_float_range;
+ addonInterface->toKodi->kodi_gui->control_slider->set_float_value = set_float_value;
+ addonInterface->toKodi->kodi_gui->control_slider->get_float_value = get_float_value;
+ addonInterface->toKodi->kodi_gui->control_slider->set_float_interval = set_float_interval;
+}
+
+void Interface_GUIControlSlider::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_slider;
+}
+
+void Interface_GUIControlSlider::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlSlider::set_enabled(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool enabled)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetEnabled(enabled);
+}
+
+void Interface_GUIControlSlider::reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_RESET, control->GetParentID(), control->GetID());
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+char* Interface_GUIControlSlider::get_description(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetDescription().c_str());
+}
+
+void Interface_GUIControlSlider::set_int_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int start,
+ int end)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_INT);
+ control->SetRange(start, end);
+}
+
+void Interface_GUIControlSlider::set_int_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_INT);
+ control->SetIntValue(value);
+}
+
+int Interface_GUIControlSlider::get_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return -1;
+ }
+
+ return control->GetIntValue();
+}
+
+void Interface_GUIControlSlider::set_int_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int interval)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetIntInterval(interval);
+}
+
+void Interface_GUIControlSlider::set_percentage(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float percent)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_PERCENTAGE);
+ control->SetPercentage(percent);
+}
+
+float Interface_GUIControlSlider::get_percentage(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0.0f;
+ }
+
+ return control->GetPercentage();
+}
+
+void Interface_GUIControlSlider::set_float_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float start,
+ float end)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_FLOAT);
+ control->SetFloatRange(start, end);
+}
+
+void Interface_GUIControlSlider::set_float_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(SLIDER_CONTROL_TYPE_FLOAT);
+ control->SetFloatValue(value);
+}
+
+float Interface_GUIControlSlider::get_float_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0.0f;
+ }
+
+ return control->GetFloatValue();
+}
+
+void Interface_GUIControlSlider::set_float_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float interval)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISliderControl* control = static_cast<CGUISliderControl*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSlider::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetFloatInterval(interval);
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Slider.h b/xbmc/addons/interfaces/gui/controls/Slider.h
new file mode 100644
index 0000000..30afbaf
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Slider.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/slider.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Slider.h"
+ */
+ struct Interface_GUIControlSlider
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+
+ static void reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static char* get_description(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_int_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int start,
+ int end);
+ static void set_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, int value);
+ static int get_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_int_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int interval);
+
+ static void set_percentage(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, float percent);
+ static float get_percentage(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_float_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float start,
+ float end);
+ static void set_float_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, float value);
+ static float get_float_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_float_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float interval);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/Spin.cpp b/xbmc/addons/interfaces/gui/controls/Spin.cpp
new file mode 100644
index 0000000..b9eb6ea
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Spin.cpp
@@ -0,0 +1,346 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "Spin.h"
+
+#include "ServiceBroker.h"
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/Spin.h"
+#include "guilib/GUIComponent.h"
+#include "guilib/GUISpinControlEx.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlSpin::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_spin = new AddonToKodiFuncTable_kodi_gui_control_spin();
+
+ addonInterface->toKodi->kodi_gui->control_spin->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_spin->set_enabled = set_enabled;
+
+ addonInterface->toKodi->kodi_gui->control_spin->set_text = set_text;
+ addonInterface->toKodi->kodi_gui->control_spin->reset = reset;
+ addonInterface->toKodi->kodi_gui->control_spin->set_type = set_type;
+
+ addonInterface->toKodi->kodi_gui->control_spin->add_string_label = add_string_label;
+ addonInterface->toKodi->kodi_gui->control_spin->set_string_value = set_string_value;
+ addonInterface->toKodi->kodi_gui->control_spin->get_string_value = get_string_value;
+
+ addonInterface->toKodi->kodi_gui->control_spin->add_int_label = add_int_label;
+ addonInterface->toKodi->kodi_gui->control_spin->set_int_range = set_int_range;
+ addonInterface->toKodi->kodi_gui->control_spin->set_int_value = set_int_value;
+ addonInterface->toKodi->kodi_gui->control_spin->get_int_value = get_int_value;
+
+ addonInterface->toKodi->kodi_gui->control_spin->set_float_range = set_float_range;
+ addonInterface->toKodi->kodi_gui->control_spin->set_float_value = set_float_value;
+ addonInterface->toKodi->kodi_gui->control_spin->get_float_value = get_float_value;
+ addonInterface->toKodi->kodi_gui->control_spin->set_float_interval = set_float_interval;
+}
+
+void Interface_GUIControlSpin::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_spin;
+}
+
+void Interface_GUIControlSpin::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlSpin::set_enabled(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool enabled)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetEnabled(enabled);
+}
+
+void Interface_GUIControlSpin::set_text(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* text)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control || !text)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "text='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(text),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_SET, control->GetParentID(), control->GetID());
+ msg.SetLabel(text);
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+void Interface_GUIControlSpin::reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_RESET, control->GetParentID(), control->GetID());
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+void Interface_GUIControlSpin::set_type(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int type)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetType(type);
+}
+
+void Interface_GUIControlSpin::add_string_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label,
+ const char* value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control || !label || !value)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "label='{}', value='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ static_cast<const void*>(value), addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->AddLabel(std::string(label), std::string(value));
+}
+
+void Interface_GUIControlSpin::set_string_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control || !value)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "value='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(value),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetStringValue(std::string(value));
+}
+
+char* Interface_GUIControlSpin::get_string_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetStringValue().c_str());
+}
+
+void Interface_GUIControlSpin::add_int_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label,
+ int value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control || !label)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}', "
+ "label='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(label),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->AddLabel(std::string(label), value);
+}
+
+void Interface_GUIControlSpin::set_int_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int start,
+ int end)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetRange(start, end);
+}
+
+void Interface_GUIControlSpin::set_int_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetValue(value);
+}
+
+int Interface_GUIControlSpin::get_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return -1;
+ }
+
+ return control->GetValue();
+}
+
+void Interface_GUIControlSpin::set_float_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float start,
+ float end)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetFloatRange(start, end);
+}
+
+void Interface_GUIControlSpin::set_float_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float value)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetFloatValue(value);
+}
+
+float Interface_GUIControlSpin::get_float_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return 0.0f;
+ }
+
+ return control->GetFloatValue();
+}
+
+void Interface_GUIControlSpin::set_float_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float interval)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUISpinControlEx* control = static_cast<CGUISpinControlEx*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlSpin::{} - invalid handler data (kodiBase='{}', handle='{}') "
+ "on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetFloatInterval(interval);
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/Spin.h b/xbmc/addons/interfaces/gui/controls/Spin.h
new file mode 100644
index 0000000..1c7102e
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/Spin.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/spin.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Spin.h"
+ */
+ struct Interface_GUIControlSpin
+ {
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void set_enabled(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool enabled);
+
+ static void set_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* text);
+ static void reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_type(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, int type);
+
+ static void add_string_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label,
+ const char* value);
+ static void add_int_label(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* label,
+ int value);
+
+ static void set_string_value(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* value);
+ static char* get_string_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_int_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ int start,
+ int end);
+ static void set_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, int value);
+ static int get_int_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+
+ static void set_float_range(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float start,
+ float end);
+ static void set_float_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, float value);
+ static float get_float_value(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_float_interval(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ float interval);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */
diff --git a/xbmc/addons/interfaces/gui/controls/TextBox.cpp b/xbmc/addons/interfaces/gui/controls/TextBox.cpp
new file mode 100644
index 0000000..44c5f89
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/TextBox.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "TextBox.h"
+
+#include "ServiceBroker.h"
+#include "addons/binary-addons/AddonDll.h"
+#include "addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h"
+#include "guilib/GUIComponent.h"
+#include "guilib/GUITextBox.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/log.h"
+
+namespace ADDON
+{
+
+void Interface_GUIControlTextBox::Init(AddonGlobalInterface* addonInterface)
+{
+ addonInterface->toKodi->kodi_gui->control_text_box =
+ new AddonToKodiFuncTable_kodi_gui_control_text_box();
+
+ addonInterface->toKodi->kodi_gui->control_text_box->set_visible = set_visible;
+ addonInterface->toKodi->kodi_gui->control_text_box->reset = reset;
+ addonInterface->toKodi->kodi_gui->control_text_box->set_text = set_text;
+ addonInterface->toKodi->kodi_gui->control_text_box->get_text = get_text;
+ addonInterface->toKodi->kodi_gui->control_text_box->scroll = scroll;
+ addonInterface->toKodi->kodi_gui->control_text_box->set_auto_scrolling = set_auto_scrolling;
+}
+
+void Interface_GUIControlTextBox::DeInit(AddonGlobalInterface* addonInterface)
+{
+ delete addonInterface->toKodi->kodi_gui->control_text_box;
+}
+
+void Interface_GUIControlTextBox::set_visible(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ bool visible)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUITextBox* control = static_cast<CGUITextBox*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlTextBox::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetVisible(visible);
+}
+
+void Interface_GUIControlTextBox::reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUITextBox* control = static_cast<CGUITextBox*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlTextBox::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_RESET, control->GetParentID(), control->GetID());
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+void Interface_GUIControlTextBox::set_text(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ const char* text)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUITextBox* control = static_cast<CGUITextBox*>(handle);
+ if (!addon || !control || !text)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlTextBox::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}', text='{}') on addon '{}'",
+ __func__, kodiBase, handle, static_cast<const void*>(text),
+ addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ CGUIMessage msg(GUI_MSG_LABEL_SET, control->GetParentID(), control->GetID());
+ msg.SetLabel(text);
+ CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg, control->GetParentID());
+}
+
+char* Interface_GUIControlTextBox::get_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUITextBox* control = static_cast<CGUITextBox*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlTextBox::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return nullptr;
+ }
+
+ return strdup(control->GetDescription().c_str());
+}
+
+void Interface_GUIControlTextBox::scroll(KODI_HANDLE kodiBase,
+ KODI_GUI_CONTROL_HANDLE handle,
+ unsigned int position)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUITextBox* control = static_cast<CGUITextBox*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlTextBox::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->Scroll(position);
+}
+
+void Interface_GUIControlTextBox::set_auto_scrolling(
+ KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, int delay, int time, int repeat)
+{
+ CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
+ CGUITextBox* control = static_cast<CGUITextBox*>(handle);
+ if (!addon || !control)
+ {
+ CLog::Log(LOGERROR,
+ "Interface_GUIControlTextBox::{} - invalid handler data (kodiBase='{}', "
+ "handle='{}') on addon '{}'",
+ __func__, kodiBase, handle, addon ? addon->ID() : "unknown");
+ return;
+ }
+
+ control->SetAutoScrolling(delay, time, repeat);
+}
+
+} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/gui/controls/TextBox.h b/xbmc/addons/interfaces/gui/controls/TextBox.h
new file mode 100644
index 0000000..09c2ff4
--- /dev/null
+++ b/xbmc/addons/interfaces/gui/controls/TextBox.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/gui/controls/text_box.h"
+
+extern "C"
+{
+
+ struct AddonGlobalInterface;
+
+ namespace ADDON
+ {
+
+ /*!
+ * @brief Global gui Add-on to Kodi callback functions
+ *
+ * To hold general gui functions and initialize also all other gui related types not
+ * related to a instance type and usable for every add-on type.
+ *
+ * Related add-on header is "./xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h"
+ */
+ struct Interface_GUIControlTextBox
+ {
+
+ static void Init(AddonGlobalInterface* addonInterface);
+ static void DeInit(AddonGlobalInterface* addonInterface);
+
+ /*!
+ * @brief callback functions from add-on to kodi
+ *
+ * @note To add a new function use the "_" style to directly identify an
+ * add-on callback function. Everything with CamelCase is only to be used
+ * in Kodi.
+ *
+ * The parameter `kodiBase` is used to become the pointer for a `CAddonDll`
+ * class.
+ */
+ //@{
+ static void set_visible(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, bool visible);
+ static void reset(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void set_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, const char* text);
+ static char* get_text(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle);
+ static void scroll(KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, unsigned int position);
+ static void set_auto_scrolling(
+ KODI_HANDLE kodiBase, KODI_GUI_CONTROL_HANDLE handle, int delay, int time, int repeat);
+ //@}
+ };
+
+ } /* namespace ADDON */
+} /* extern "C" */