aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlwinEsch <alwin.esch@web.de>2015-02-15 15:18:07 +0100
committerAlwinEsch <alwin.esch@web.de>2015-02-15 16:39:04 +0100
commit316dc9f1a6e549fdfc2e971ae03f9c54b7db02bf (patch)
tree7043622dfa3f4ee42baf1a1ef034120d480f652f
parent4f5f1b1b0f122cba96596cc0c30eb33632ed3125 (diff)
[gui] Allow usage of slider and several dialogs on addons (GUI Ver. 5.8.0)
-rw-r--r--lib/addons/library.xbmc.gui/libXBMC_gui.cpp210
-rw-r--r--xbmc/addons/AddonCallbacks.h120
-rw-r--r--xbmc/addons/AddonCallbacksGUI.cpp611
-rw-r--r--xbmc/addons/AddonCallbacksGUI.h63
4 files changed, 1003 insertions, 1 deletions
diff --git a/lib/addons/library.xbmc.gui/libXBMC_gui.cpp b/lib/addons/library.xbmc.gui/libXBMC_gui.cpp
index a0de64c056..b7fb237069 100644
--- a/lib/addons/library.xbmc.gui/libXBMC_gui.cpp
+++ b/lib/addons/library.xbmc.gui/libXBMC_gui.cpp
@@ -595,7 +595,7 @@ void CAddonGUIProgressControl::SetPercentage(float fPercent)
float CAddonGUIProgressControl::GetPercentage() const
{
if (!m_ProgressHandle)
- return 0.0;
+ return 0.0f;
return ((CB_GUILib*)m_cb)->Control_Progress_GetPercentage(((AddonCB*)m_Handle)->addonData, m_ProgressHandle);
}
@@ -624,6 +624,214 @@ string CAddonGUIProgressControl::GetDescription() const
///-------------------------------------
+/// cGUISliderControl
+
+DLLEXPORT CAddonGUISliderControl* GUI_control_get_slider(void *hdl, void *cb, CAddonGUIWindow *window, int controlId)
+{
+ return new CAddonGUISliderControl(hdl, cb, window, controlId);
+}
+
+DLLEXPORT void GUI_control_release_slider(CAddonGUISliderControl* p)
+{
+ delete p;
+}
+
+CAddonGUISliderControl::CAddonGUISliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId)
+ : m_Window(window)
+ , m_ControlId(controlId)
+ , m_Handle(hdl)
+ , m_cb(cb)
+{
+ m_SliderHandle = ((CB_GUILib*)m_cb)->Window_GetControl_Slider(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId);
+}
+
+void CAddonGUISliderControl::SetVisible(bool yesNo)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetVisible(((AddonCB*)m_Handle)->addonData, m_SliderHandle, yesNo);
+}
+
+string CAddonGUISliderControl::GetDescription() const
+{
+ if (!m_SliderHandle)
+ return "";
+
+ return ((CB_GUILib*)m_cb)->Control_Slider_GetDescription(((AddonCB*)m_Handle)->addonData, m_SliderHandle);
+}
+
+void CAddonGUISliderControl::SetIntRange(int iStart, int iEnd)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetIntRange(((AddonCB*)m_Handle)->addonData, m_SliderHandle, iStart, iEnd);
+}
+
+void CAddonGUISliderControl::SetIntValue(int iValue)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetIntValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle, iValue);
+}
+
+int CAddonGUISliderControl::GetIntValue() const
+{
+ if (!m_SliderHandle)
+ return 0;
+ return ((CB_GUILib*)m_cb)->Control_Slider_GetIntValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle);
+}
+
+void CAddonGUISliderControl::SetIntInterval(int iInterval)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetIntInterval(((AddonCB*)m_Handle)->addonData, m_SliderHandle, iInterval);
+}
+
+void CAddonGUISliderControl::SetPercentage(float fPercent)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetPercentage(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fPercent);
+}
+
+float CAddonGUISliderControl::GetPercentage() const
+{
+ if (!m_SliderHandle)
+ return 0.0f;
+
+ return ((CB_GUILib*)m_cb)->Control_Slider_GetPercentage(((AddonCB*)m_Handle)->addonData, m_SliderHandle);
+}
+
+void CAddonGUISliderControl::SetFloatRange(float fStart, float fEnd)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetFloatRange(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fStart, fEnd);
+}
+
+void CAddonGUISliderControl::SetFloatValue(float fValue)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetFloatValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fValue);
+}
+
+float CAddonGUISliderControl::GetFloatValue() const
+{
+ if (!m_SliderHandle)
+ return 0.0f;
+ return ((CB_GUILib*)m_cb)->Control_Slider_GetFloatValue(((AddonCB*)m_Handle)->addonData, m_SliderHandle);
+}
+
+void CAddonGUISliderControl::SetFloatInterval(float fInterval)
+{
+ if (m_SliderHandle)
+ ((CB_GUILib*)m_cb)->Control_Slider_SetFloatInterval(((AddonCB*)m_Handle)->addonData, m_SliderHandle, fInterval);
+}
+
+
+///-------------------------------------
+/// cGUISettingsSliderControl
+
+DLLEXPORT CAddonGUISettingsSliderControl* GUI_control_get_settings_slider(void *hdl, void *cb, CAddonGUIWindow *window, int controlId)
+{
+ return new CAddonGUISettingsSliderControl(hdl, cb, window, controlId);
+}
+
+DLLEXPORT void GUI_control_release_settings_slider(CAddonGUISettingsSliderControl* p)
+{
+ delete p;
+}
+
+CAddonGUISettingsSliderControl::CAddonGUISettingsSliderControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId)
+ : m_Window(window)
+ , m_ControlId(controlId)
+ , m_Handle(hdl)
+ , m_cb(cb)
+{
+ m_SettingsSliderHandle = ((CB_GUILib*)m_cb)->Window_GetControl_SettingsSlider(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId);
+}
+
+void CAddonGUISettingsSliderControl::SetVisible(bool yesNo)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetVisible(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, yesNo);
+}
+
+void CAddonGUISettingsSliderControl::SetText(const char *label)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetText(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, label);
+}
+
+string CAddonGUISettingsSliderControl::GetDescription() const
+{
+ if (!m_SettingsSliderHandle)
+ return "";
+
+ return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetDescription(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle);
+}
+
+void CAddonGUISettingsSliderControl::SetIntRange(int iStart, int iEnd)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetIntRange(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, iStart, iEnd);
+}
+
+void CAddonGUISettingsSliderControl::SetIntValue(int iValue)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetIntValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, iValue);
+}
+
+int CAddonGUISettingsSliderControl::GetIntValue() const
+{
+ if (!m_SettingsSliderHandle)
+ return 0;
+ return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetIntValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle);
+}
+
+void CAddonGUISettingsSliderControl::SetIntInterval(int iInterval)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetIntInterval(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, iInterval);
+}
+
+void CAddonGUISettingsSliderControl::SetPercentage(float fPercent)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetPercentage(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fPercent);
+}
+
+float CAddonGUISettingsSliderControl::GetPercentage() const
+{
+ if (!m_SettingsSliderHandle)
+ return 0.0f;
+
+ return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetPercentage(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle);
+}
+
+void CAddonGUISettingsSliderControl::SetFloatRange(float fStart, float fEnd)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetFloatRange(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fStart, fEnd);
+}
+
+void CAddonGUISettingsSliderControl::SetFloatValue(float fValue)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetFloatValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fValue);
+}
+
+float CAddonGUISettingsSliderControl::GetFloatValue() const
+{
+ if (!m_SettingsSliderHandle)
+ return 0.0f;
+ return ((CB_GUILib*)m_cb)->Control_SettingsSlider_GetFloatValue(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle);
+}
+
+void CAddonGUISettingsSliderControl::SetFloatInterval(float fInterval)
+{
+ if (m_SettingsSliderHandle)
+ ((CB_GUILib*)m_cb)->Control_SettingsSlider_SetFloatInterval(((AddonCB*)m_Handle)->addonData, m_SettingsSliderHandle, fInterval);
+}
+
+
+///-------------------------------------
/// cListItem
DLLEXPORT CAddonListItem* GUI_ListItem_create(void *hdl, void *cb, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)
diff --git a/xbmc/addons/AddonCallbacks.h b/xbmc/addons/AddonCallbacks.h
index 9ae3242a15..f0902e4e20 100644
--- a/xbmc/addons/AddonCallbacks.h
+++ b/xbmc/addons/AddonCallbacks.h
@@ -154,6 +154,33 @@ typedef float (*GUIControl_Progress_GetPercentage)(void *addonData, GUIHAN
typedef void (*GUIControl_Progress_SetInfo)(void *addonData, GUIHANDLE handle, int iInfo);
typedef int (*GUIControl_Progress_GetInfo)(void *addonData, GUIHANDLE handle);
typedef const char* (*GUIControl_Progress_GetDescription)(void *addonData, GUIHANDLE handle);
+typedef GUIHANDLE (*GUIWindow_GetControl_Slider)(void *addonData, GUIHANDLE handle, int controlId);
+typedef void (*GUIControl_Slider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo);
+typedef const char *(*GUIControl_Slider_GetDescription)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_Slider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd);
+typedef void (*GUIControl_Slider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue);
+typedef int (*GUIControl_Slider_GetIntValue)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_Slider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval);
+typedef void (*GUIControl_Slider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent);
+typedef float (*GUIControl_Slider_GetPercentage)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_Slider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd);
+typedef void (*GUIControl_Slider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue);
+typedef float (*GUIControl_Slider_GetFloatValue)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_Slider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval);
+typedef GUIHANDLE (*GUIWindow_GetControl_SettingsSlider)(void *addonData, GUIHANDLE handle, int controlId);
+typedef void (*GUIControl_SettingsSlider_SetVisible)(void *addonData, GUIHANDLE handle, bool yesNo);
+typedef void (*GUIControl_SettingsSlider_SetText)(void *addonData, GUIHANDLE handle, const char *label);
+typedef const char *(*GUIControl_SettingsSlider_GetDescription)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_SettingsSlider_SetIntRange)(void *addonData, GUIHANDLE handle, int iStart, int iEnd);
+typedef void (*GUIControl_SettingsSlider_SetIntValue)(void *addonData, GUIHANDLE handle, int iValue);
+typedef int (*GUIControl_SettingsSlider_GetIntValue)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_SettingsSlider_SetIntInterval)(void *addonData, GUIHANDLE handle, int iInterval);
+typedef void (*GUIControl_SettingsSlider_SetPercentage)(void *addonData, GUIHANDLE handle, float fPercent);
+typedef float (*GUIControl_SettingsSlider_GetPercentage)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_SettingsSlider_SetFloatRange)(void *addonData, GUIHANDLE handle, float fStart, float fEnd);
+typedef void (*GUIControl_SettingsSlider_SetFloatValue)(void *addonData, GUIHANDLE handle, float fValue);
+typedef float (*GUIControl_SettingsSlider_GetFloatValue)(void *addonData, GUIHANDLE handle);
+typedef void (*GUIControl_SettingsSlider_SetFloatInterval)(void *addonData, GUIHANDLE handle, float fInterval);
typedef GUIHANDLE (*GUIListItem_Create)(void *addonData, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path);
typedef const char* (*GUIListItem_GetLabel)(void *addonData, GUIHANDLE handle);
typedef void (*GUIListItem_SetLabel)(void *addonData, GUIHANDLE handle, const char *label);
@@ -169,6 +196,39 @@ typedef void (*GUIRenderAddon_SetCallbacks)(void *addonData, GUIHANDLE ha
typedef void (*GUIRenderAddon_Delete)(void *addonData, GUIHANDLE handle);
typedef void (*GUIRenderAddon_MarkDirty)(void *addonData, GUIHANDLE handle);
+typedef bool (*GUIDialog_Keyboard_ShowAndGetInputWithHead)(char &strTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_ShowAndGetInput)(char &strTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_ShowAndGetNewPasswordWithHead)(char &newPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_ShowAndGetNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_ShowAndVerifyNewPasswordWithHead)(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmpty, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs);
+typedef int (*GUIDialog_Keyboard_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_ShowAndGetFilter)(char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs);
+typedef bool (*GUIDialog_Keyboard_SendTextToActiveKeyboard)(const char *aTextString, bool closeKeyboard);
+typedef bool (*GUIDialog_Keyboard_isKeyboardActivated)();
+
+typedef bool (*GUIDialog_Numeric_ShowAndVerifyNewPassword)(char &strNewPassword, unsigned int iMaxStringSize);
+typedef int (*GUIDialog_Numeric_ShowAndVerifyPassword)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries);
+typedef bool (*GUIDialog_Numeric_ShowAndVerifyInput)(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput);
+typedef bool (*GUIDialog_Numeric_ShowAndGetTime)(tm &time, const char *strHeading);
+typedef bool (*GUIDialog_Numeric_ShowAndGetDate)(tm &date, const char *strHeading);
+typedef bool (*GUIDialog_Numeric_ShowAndGetIPAddress)(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading);
+typedef bool (*GUIDialog_Numeric_ShowAndGetNumber)(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs);
+typedef bool (*GUIDialog_Numeric_ShowAndGetSeconds)(char &timeString, unsigned int iMaxStringSize, const char *strHeading);
+
+typedef bool (*GUIDialog_FileBrowser_ShowAndGetFile)(const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList);
+
+typedef void (*GUIDialog_OK_ShowAndGetInputSingleText)(const char *heading, const char *text);
+typedef void (*GUIDialog_OK_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2);
+
+typedef bool (*GUIDialog_YesNo_ShowAndGetInputSingleText)(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel);
+typedef bool (*GUIDialog_YesNo_ShowAndGetInputLineText)(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel);
+typedef bool (*GUIDialog_YesNo_ShowAndGetInputLineButtonText)(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel);
+
+typedef void (*GUIDialog_TextViewer)(const char *heading, const char *text);
+
+typedef int (*GUIDialog_Select)(const char *heading, const char *entries[], unsigned int size, int selected);
+
typedef struct CB_GUILib
{
GUILock Lock;
@@ -239,6 +299,66 @@ typedef struct CB_GUILib
GUIRenderAddon_SetCallbacks RenderAddon_SetCallbacks;
GUIRenderAddon_Delete RenderAddon_Delete;
+ GUIWindow_GetControl_Slider Window_GetControl_Slider;
+ GUIControl_Slider_SetVisible Control_Slider_SetVisible;
+ GUIControl_Slider_GetDescription Control_Slider_GetDescription;
+ GUIControl_Slider_SetIntRange Control_Slider_SetIntRange;
+ GUIControl_Slider_SetIntValue Control_Slider_SetIntValue;
+ GUIControl_Slider_GetIntValue Control_Slider_GetIntValue;
+ GUIControl_Slider_SetIntInterval Control_Slider_SetIntInterval;
+ GUIControl_Slider_SetPercentage Control_Slider_SetPercentage;
+ GUIControl_Slider_GetPercentage Control_Slider_GetPercentage;
+ GUIControl_Slider_SetFloatRange Control_Slider_SetFloatRange;
+ GUIControl_Slider_SetFloatValue Control_Slider_SetFloatValue;
+ GUIControl_Slider_GetFloatValue Control_Slider_GetFloatValue;
+ GUIControl_Slider_SetFloatInterval Control_Slider_SetFloatInterval;
+
+ GUIWindow_GetControl_SettingsSlider Window_GetControl_SettingsSlider;
+ GUIControl_SettingsSlider_SetVisible Control_SettingsSlider_SetVisible;
+ GUIControl_SettingsSlider_SetText Control_SettingsSlider_SetText;
+ GUIControl_SettingsSlider_GetDescription Control_SettingsSlider_GetDescription;
+ GUIControl_SettingsSlider_SetIntRange Control_SettingsSlider_SetIntRange;
+ GUIControl_SettingsSlider_SetIntValue Control_SettingsSlider_SetIntValue;
+ GUIControl_SettingsSlider_GetIntValue Control_SettingsSlider_GetIntValue;
+ GUIControl_SettingsSlider_SetIntInterval Control_SettingsSlider_SetIntInterval;
+ GUIControl_SettingsSlider_SetPercentage Control_SettingsSlider_SetPercentage;
+ GUIControl_SettingsSlider_GetPercentage Control_SettingsSlider_GetPercentage;
+ GUIControl_SettingsSlider_SetFloatRange Control_SettingsSlider_SetFloatRange;
+ GUIControl_SettingsSlider_SetFloatValue Control_SettingsSlider_SetFloatValue;
+ GUIControl_SettingsSlider_GetFloatValue Control_SettingsSlider_GetFloatValue;
+ GUIControl_SettingsSlider_SetFloatInterval Control_SettingsSlider_SetFloatInterval;
+
+ GUIDialog_Keyboard_ShowAndGetInputWithHead Dialog_Keyboard_ShowAndGetInputWithHead;
+ GUIDialog_Keyboard_ShowAndGetInput Dialog_Keyboard_ShowAndGetInput;
+ GUIDialog_Keyboard_ShowAndGetNewPasswordWithHead Dialog_Keyboard_ShowAndGetNewPasswordWithHead;
+ GUIDialog_Keyboard_ShowAndGetNewPassword Dialog_Keyboard_ShowAndGetNewPassword;
+ GUIDialog_Keyboard_ShowAndVerifyNewPasswordWithHead Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead;
+ GUIDialog_Keyboard_ShowAndVerifyNewPassword Dialog_Keyboard_ShowAndVerifyNewPassword;
+ GUIDialog_Keyboard_ShowAndVerifyPassword Dialog_Keyboard_ShowAndVerifyPassword;
+ GUIDialog_Keyboard_ShowAndGetFilter Dialog_Keyboard_ShowAndGetFilter;
+ GUIDialog_Keyboard_SendTextToActiveKeyboard Dialog_Keyboard_SendTextToActiveKeyboard;
+ GUIDialog_Keyboard_isKeyboardActivated Dialog_Keyboard_isKeyboardActivated;
+
+ GUIDialog_Numeric_ShowAndVerifyNewPassword Dialog_Numeric_ShowAndVerifyNewPassword;
+ GUIDialog_Numeric_ShowAndVerifyPassword Dialog_Numeric_ShowAndVerifyPassword;
+ GUIDialog_Numeric_ShowAndVerifyInput Dialog_Numeric_ShowAndVerifyInput;
+ GUIDialog_Numeric_ShowAndGetTime Dialog_Numeric_ShowAndGetTime;
+ GUIDialog_Numeric_ShowAndGetDate Dialog_Numeric_ShowAndGetDate;
+ GUIDialog_Numeric_ShowAndGetIPAddress Dialog_Numeric_ShowAndGetIPAddress;
+ GUIDialog_Numeric_ShowAndGetNumber Dialog_Numeric_ShowAndGetNumber;
+ GUIDialog_Numeric_ShowAndGetSeconds Dialog_Numeric_ShowAndGetSeconds;
+
+ GUIDialog_FileBrowser_ShowAndGetFile Dialog_FileBrowser_ShowAndGetFile;
+
+ GUIDialog_OK_ShowAndGetInputSingleText Dialog_OK_ShowAndGetInputSingleText;
+ GUIDialog_OK_ShowAndGetInputLineText Dialog_OK_ShowAndGetInputLineText;
+
+ GUIDialog_YesNo_ShowAndGetInputSingleText Dialog_YesNo_ShowAndGetInputSingleText;
+ GUIDialog_YesNo_ShowAndGetInputLineText Dialog_YesNo_ShowAndGetInputLineText;
+ GUIDialog_YesNo_ShowAndGetInputLineButtonText Dialog_YesNo_ShowAndGetInputLineButtonText;
+
+ GUIDialog_TextViewer Dialog_TextViewer;
+ GUIDialog_Select Dialog_Select;
} CB_GUILib;
typedef void (*PVRTransferEpgEntry)(void *userData, const ADDON_HANDLE handle, const EPG_TAG *epgentry);
diff --git a/xbmc/addons/AddonCallbacksGUI.cpp b/xbmc/addons/AddonCallbacksGUI.cpp
index c0ac3b234f..28e54ae6ad 100644
--- a/xbmc/addons/AddonCallbacksGUI.cpp
+++ b/xbmc/addons/AddonCallbacksGUI.cpp
@@ -38,6 +38,13 @@
#include "guilib/GUIEditControl.h"
#include "guilib/GUIProgressControl.h"
#include "guilib/GUIRenderingControl.h"
+#include "guilib/GUIKeyboardFactory.h"
+#include "dialogs/GUIDialogNumeric.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "dialogs/GUIDialogFileBrowser.h"
+#include "dialogs/GUIDialogTextViewer.h"
+#include "dialogs/GUIDialogSelect.h"
#define CONTROL_BTNVIEWASICONS 2
#define CONTROL_BTNSORTBY 3
@@ -96,6 +103,8 @@ CAddonCallbacksGUI::CAddonCallbacksGUI(CAddon* addon)
m_callbacks->Window_GetControl_Edit = CAddonCallbacksGUI::Window_GetControl_Edit;
m_callbacks->Window_GetControl_Progress = CAddonCallbacksGUI::Window_GetControl_Progress;
m_callbacks->Window_GetControl_RenderAddon = CAddonCallbacksGUI::Window_GetControl_RenderAddon;
+ m_callbacks->Window_GetControl_Slider = CAddonCallbacksGUI::Window_GetControl_Slider;
+ m_callbacks->Window_GetControl_SettingsSlider= CAddonCallbacksGUI::Window_GetControl_SettingsSlider;
m_callbacks->Window_SetControlLabel = CAddonCallbacksGUI::Window_SetControlLabel;
m_callbacks->Window_MarkDirtyRegion = CAddonCallbacksGUI::Window_MarkDirtyRegion;
@@ -132,6 +141,66 @@ CAddonCallbacksGUI::CAddonCallbacksGUI(CAddon* addon)
m_callbacks->RenderAddon_SetCallbacks = CAddonCallbacksGUI::RenderAddon_SetCallbacks;
m_callbacks->RenderAddon_Delete = CAddonCallbacksGUI::RenderAddon_Delete;
+
+ m_callbacks->Control_Slider_SetVisible = CAddonCallbacksGUI::Control_Slider_SetVisible;
+ m_callbacks->Control_Slider_GetDescription = CAddonCallbacksGUI::Control_Slider_GetDescription;
+ m_callbacks->Control_Slider_SetIntRange = CAddonCallbacksGUI::Control_Slider_SetIntRange;
+ m_callbacks->Control_Slider_SetIntValue = CAddonCallbacksGUI::Control_Slider_SetIntValue;
+ m_callbacks->Control_Slider_GetIntValue = CAddonCallbacksGUI::Control_Slider_GetIntValue;
+ m_callbacks->Control_Slider_SetIntInterval = CAddonCallbacksGUI::Control_Slider_SetIntInterval;
+ m_callbacks->Control_Slider_SetPercentage = CAddonCallbacksGUI::Control_Slider_SetPercentage;
+ m_callbacks->Control_Slider_GetPercentage = CAddonCallbacksGUI::Control_Slider_GetPercentage;
+ m_callbacks->Control_Slider_SetFloatRange = CAddonCallbacksGUI::Control_Slider_SetFloatRange;
+ m_callbacks->Control_Slider_SetFloatValue = CAddonCallbacksGUI::Control_Slider_SetFloatValue;
+ m_callbacks->Control_Slider_GetFloatValue = CAddonCallbacksGUI::Control_Slider_GetFloatValue;
+ m_callbacks->Control_Slider_SetFloatInterval = CAddonCallbacksGUI::Control_Slider_SetFloatInterval;
+
+ m_callbacks->Control_SettingsSlider_SetVisible = CAddonCallbacksGUI::Control_SettingsSlider_SetVisible;
+ m_callbacks->Control_SettingsSlider_SetText = CAddonCallbacksGUI::Control_SettingsSlider_SetText;
+ m_callbacks->Control_SettingsSlider_GetDescription = CAddonCallbacksGUI::Control_SettingsSlider_GetDescription;
+ m_callbacks->Control_SettingsSlider_SetIntRange = CAddonCallbacksGUI::Control_SettingsSlider_SetIntRange;
+ m_callbacks->Control_SettingsSlider_SetIntValue = CAddonCallbacksGUI::Control_SettingsSlider_SetIntValue;
+ m_callbacks->Control_SettingsSlider_GetIntValue = CAddonCallbacksGUI::Control_SettingsSlider_GetIntValue;
+ m_callbacks->Control_SettingsSlider_SetIntInterval = CAddonCallbacksGUI::Control_SettingsSlider_SetIntInterval;
+ m_callbacks->Control_SettingsSlider_SetPercentage = CAddonCallbacksGUI::Control_SettingsSlider_SetPercentage;
+ m_callbacks->Control_SettingsSlider_GetPercentage = CAddonCallbacksGUI::Control_SettingsSlider_GetPercentage;
+ m_callbacks->Control_SettingsSlider_SetFloatRange = CAddonCallbacksGUI::Control_SettingsSlider_SetFloatRange;
+ m_callbacks->Control_SettingsSlider_SetFloatValue = CAddonCallbacksGUI::Control_SettingsSlider_SetFloatValue;
+ m_callbacks->Control_SettingsSlider_GetFloatValue = CAddonCallbacksGUI::Control_SettingsSlider_GetFloatValue;
+ m_callbacks->Control_SettingsSlider_SetFloatInterval = CAddonCallbacksGUI::Control_SettingsSlider_SetFloatInterval;
+
+ m_callbacks->Dialog_Keyboard_ShowAndGetInputWithHead = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetInputWithHead;
+ m_callbacks->Dialog_Keyboard_ShowAndGetInput = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetInput;
+ m_callbacks->Dialog_Keyboard_ShowAndGetNewPasswordWithHead = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetNewPasswordWithHead;
+ m_callbacks->Dialog_Keyboard_ShowAndGetNewPassword = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetNewPassword;
+ m_callbacks->Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead;
+ m_callbacks->Dialog_Keyboard_ShowAndVerifyNewPassword = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndVerifyNewPassword;
+ m_callbacks->Dialog_Keyboard_ShowAndVerifyPassword = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndVerifyPassword;
+ m_callbacks->Dialog_Keyboard_ShowAndGetFilter = CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetFilter;
+ m_callbacks->Dialog_Keyboard_SendTextToActiveKeyboard = CAddonCallbacksGUI::Dialog_Keyboard_SendTextToActiveKeyboard;
+ m_callbacks->Dialog_Keyboard_isKeyboardActivated = CAddonCallbacksGUI::Dialog_Keyboard_isKeyboardActivated;
+
+ m_callbacks->Dialog_Numeric_ShowAndVerifyNewPassword = CAddonCallbacksGUI::Dialog_Numeric_ShowAndVerifyNewPassword;
+ m_callbacks->Dialog_Numeric_ShowAndVerifyPassword = CAddonCallbacksGUI::Dialog_Numeric_ShowAndVerifyPassword;
+ m_callbacks->Dialog_Numeric_ShowAndVerifyInput = CAddonCallbacksGUI::Dialog_Numeric_ShowAndVerifyInput;
+ m_callbacks->Dialog_Numeric_ShowAndGetTime = CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetTime;
+ m_callbacks->Dialog_Numeric_ShowAndGetDate = CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetDate;
+ m_callbacks->Dialog_Numeric_ShowAndGetIPAddress = CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetIPAddress;
+ m_callbacks->Dialog_Numeric_ShowAndGetNumber = CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetNumber;
+ m_callbacks->Dialog_Numeric_ShowAndGetSeconds = CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetSeconds;
+
+ m_callbacks->Dialog_FileBrowser_ShowAndGetFile = CAddonCallbacksGUI::Dialog_FileBrowser_ShowAndGetFile;
+
+ m_callbacks->Dialog_OK_ShowAndGetInputSingleText = CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputSingleText;
+ m_callbacks->Dialog_OK_ShowAndGetInputLineText = CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputLineText;
+
+ m_callbacks->Dialog_YesNo_ShowAndGetInputSingleText = CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputSingleText;
+ m_callbacks->Dialog_YesNo_ShowAndGetInputLineText = CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputLineText;
+ m_callbacks->Dialog_YesNo_ShowAndGetInputLineButtonText = CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputLineButtonText;
+
+ m_callbacks->Dialog_TextViewer = CAddonCallbacksGUI::Dialog_TextViewer;
+
+ m_callbacks->Dialog_Select = CAddonCallbacksGUI::Dialog_Select;
}
CAddonCallbacksGUI::~CAddonCallbacksGUI()
@@ -1138,6 +1207,307 @@ const char* CAddonCallbacksGUI::Control_Progress_GetDescription(void *addonData,
return buffer;
}
+/*
+ * GUI slider control callback functions
+ */
+GUIHANDLE CAddonCallbacksGUI::Window_GetControl_Slider(void *addonData, GUIHANDLE handle, int controlId)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return NULL;
+
+ CGUIAddonWindow *pAddonWindow = (CGUIAddonWindow*)handle;
+ CGUIControl* pGUIControl = (CGUIControl*)pAddonWindow->GetControl(controlId);
+ if (pGUIControl && pGUIControl->GetControlType() != CGUIControl::GUICONTROL_SLIDER)
+ return NULL;
+
+ return pGUIControl;
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetVisible(void *addonData, GUIHANDLE handle, bool yesNo)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUIControl *pControl = (CGUIControl*)handle;
+ pControl->SetVisible(yesNo);
+}
+
+const char* CAddonCallbacksGUI::Control_Slider_GetDescription(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return NULL;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ std::string string = pControl->GetDescription();
+
+ char *buffer = (char*) malloc (string.length()+1);
+ strcpy(buffer, string.c_str());
+ return buffer;
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetIntRange(void *addonData, GUIHANDLE handle, int iStart, int iEnd)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetRange(iStart, iEnd);
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetIntValue(void *addonData, GUIHANDLE handle, int iValue)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetType(SPIN_CONTROL_TYPE_INT);
+ pControl->SetIntValue(iValue);
+}
+
+int CAddonCallbacksGUI::Control_Slider_GetIntValue(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return 0;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ return pControl->GetIntValue();
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetIntInterval(void *addonData, GUIHANDLE handle, int iInterval)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetIntInterval(iInterval);
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetPercentage(void *addonData, GUIHANDLE handle, float fPercent)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetType(SPIN_CONTROL_TYPE_FLOAT);
+ pControl->SetPercentage(fPercent);
+}
+
+float CAddonCallbacksGUI::Control_Slider_GetPercentage(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return 0.0f;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ return pControl->GetPercentage();
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetFloatRange(void *addonData, GUIHANDLE handle, float fStart, float fEnd)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetFloatRange(fStart, fEnd);
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetFloatValue(void *addonData, GUIHANDLE handle, float iValue)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetType(SPIN_CONTROL_TYPE_FLOAT);
+ pControl->SetFloatValue(iValue);
+}
+
+float CAddonCallbacksGUI::Control_Slider_GetFloatValue(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return 0.0f;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ return pControl->GetFloatValue();
+}
+
+void CAddonCallbacksGUI::Control_Slider_SetFloatInterval(void *addonData, GUIHANDLE handle, float fInterval)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISliderControl *pControl = (CGUISliderControl*)handle;
+ pControl->SetFloatInterval(fInterval);
+}
+
+/*
+ * GUI settings slider control callback functions
+ */
+GUIHANDLE CAddonCallbacksGUI::Window_GetControl_SettingsSlider(void *addonData, GUIHANDLE handle, int controlId)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return NULL;
+
+ CGUIAddonWindow *pAddonWindow = (CGUIAddonWindow*)handle;
+ CGUIControl* pGUIControl = (CGUIControl*)pAddonWindow->GetControl(controlId);
+ if (pGUIControl && pGUIControl->GetControlType() != CGUIControl::GUICONTROL_SETTINGS_SLIDER)
+ return NULL;
+
+ return pGUIControl;
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetVisible(void *addonData, GUIHANDLE handle, bool yesNo)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUIControl *pControl = (CGUIControl*)handle;
+ pControl->SetVisible(yesNo);
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetText(void *addonData, GUIHANDLE handle, const char *label)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetText(label);
+}
+
+const char* CAddonCallbacksGUI::Control_SettingsSlider_GetDescription(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return NULL;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ std::string string = pControl->GetDescription();
+
+ char *buffer = (char*) malloc (string.length()+1);
+ strcpy(buffer, string.c_str());
+ return buffer;
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetIntRange(void *addonData, GUIHANDLE handle, int iStart, int iEnd)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetRange(iStart, iEnd);
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetIntValue(void *addonData, GUIHANDLE handle, int iValue)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetType(SPIN_CONTROL_TYPE_INT);
+ pControl->SetIntValue(iValue);
+}
+
+int CAddonCallbacksGUI::Control_SettingsSlider_GetIntValue(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return 0;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ return pControl->GetIntValue();
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetIntInterval(void *addonData, GUIHANDLE handle, int iInterval)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetIntInterval(iInterval);
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetPercentage(void *addonData, GUIHANDLE handle, float fPercent)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetType(SPIN_CONTROL_TYPE_FLOAT);
+ pControl->SetPercentage(fPercent);
+}
+
+float CAddonCallbacksGUI::Control_SettingsSlider_GetPercentage(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return 0.0f;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ return pControl->GetPercentage();
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetFloatRange(void *addonData, GUIHANDLE handle, float fStart, float fEnd)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetFloatRange(fStart, fEnd);
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetFloatValue(void *addonData, GUIHANDLE handle, float fValue)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetType(SPIN_CONTROL_TYPE_FLOAT);
+ pControl->SetFloatValue(fValue);
+}
+
+float CAddonCallbacksGUI::Control_SettingsSlider_GetFloatValue(void *addonData, GUIHANDLE handle)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return 0.0f;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ return pControl->GetFloatValue();
+}
+
+void CAddonCallbacksGUI::Control_SettingsSlider_SetFloatInterval(void *addonData, GUIHANDLE handle, float fInterval)
+{
+ CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+ if (!helper || !handle)
+ return;
+
+ CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl*)handle;
+ pControl->SetFloatInterval(fInterval);
+}
+
+/*
+ * GUI list item control callback functions
+ */
GUIHANDLE CAddonCallbacksGUI::ListItem_Create(void *addonData, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path)
{
CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
@@ -1294,7 +1664,248 @@ void CAddonCallbacksGUI::RenderAddon_Delete(void *addonData, GUIHANDLE handle)
Unlock();
}
+/*! @name GUI Keyboard functions */
+//@{
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetInputWithHead(char &aTextString, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs)
+{
+ std::string str = &aTextString;
+ bool bRet = CGUIKeyboardFactory::ShowAndGetInput(str, strHeading, allowEmptyResult, hiddenInput, autoCloseMs);
+ if (bRet)
+ strncpy(&aTextString, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetInput(char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs)
+{
+ std::string str = &aTextString;
+ bool bRet = CGUIKeyboardFactory::ShowAndGetInput(str, allowEmptyResult, autoCloseMs);
+ if (bRet)
+ strncpy(&aTextString, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetNewPasswordWithHead(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs)
+{
+ std::string str = &strNewPassword;
+ bool bRet = CGUIKeyboardFactory::ShowAndGetNewPassword(str, strHeading, allowEmptyResult, autoCloseMs);
+ if (bRet)
+ strncpy(&strNewPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)
+{
+ std::string str = &strNewPassword;
+ bool bRet = CGUIKeyboardFactory::ShowAndGetNewPassword(str, autoCloseMs);
+ if (bRet)
+ strncpy(&strNewPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs)
+{
+ std::string str = &strNewPassword;
+ bool bRet = CGUIKeyboardFactory::ShowAndVerifyNewPassword(str, strHeading, allowEmptyResult, autoCloseMs);
+ if (bRet)
+ strncpy(&strNewPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs)
+{
+ std::string str = &strNewPassword;
+ bool bRet = CGUIKeyboardFactory::ShowAndVerifyNewPassword(str, autoCloseMs);
+ if (bRet)
+ strncpy(&strNewPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+int CAddonCallbacksGUI::Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs)
+{
+ std::string str = &strPassword;
+ int bRet = CGUIKeyboardFactory::ShowAndVerifyNewPassword(str, strHeading, iRetries, autoCloseMs);
+ if (bRet)
+ strncpy(&strPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_ShowAndGetFilter(char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs)
+{
+ std::string strText = &aTextString;
+ bool bRet = CGUIKeyboardFactory::ShowAndGetFilter(strText, searching, autoCloseMs);
+ if (bRet)
+ strncpy(&aTextString, strText.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard)
+{
+ return CGUIKeyboardFactory::SendTextToActiveKeyboard(aTextString, closeKeyboard);
+}
+
+bool CAddonCallbacksGUI::Dialog_Keyboard_isKeyboardActivated()
+{
+ return CGUIKeyboardFactory::isKeyboardActivated();
+}
+//@}
+
+/*! @name GUI Numeric functions */
+//@{
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize)
+{
+ std::string str = &strNewPassword;
+ bool bRet = CGUIDialogNumeric::ShowAndVerifyNewPassword(str);
+ if (bRet)
+ strncpy(&strNewPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+int CAddonCallbacksGUI::Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries)
+{
+ std::string str = &strPassword;
+ int bRet = CGUIDialogNumeric::ShowAndVerifyPassword(str, strHeading, iRetries);
+ if (bRet)
+ strncpy(&strPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput)
+{
+ std::string str = &strPassword;
+ bool bRet = CGUIDialogNumeric::ShowAndVerifyInput(str, strHeading, bGetUserInput);
+ if (bRet)
+ strncpy(&strPassword, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading)
+{
+ SYSTEMTIME systemTime;
+ CDateTime dateTime(time);
+ dateTime.GetAsSystemTime(systemTime);
+ if (CGUIDialogNumeric::ShowAndGetTime(systemTime, strHeading))
+ {
+ dateTime = systemTime;
+ dateTime.GetAsTm(time);
+ return true;
+ }
+ return false;
+}
+
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading)
+{
+ SYSTEMTIME systemTime;
+ CDateTime dateTime(date);
+ dateTime.GetAsSystemTime(systemTime);
+ if (CGUIDialogNumeric::ShowAndGetDate(systemTime, strHeading))
+ {
+ dateTime = systemTime;
+ dateTime.GetAsTm(date);
+ return true;
+ }
+ return false;
+}
+
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading)
+{
+ std::string strIP = &strIPAddress;
+ bool bRet = CGUIDialogNumeric::ShowAndGetIPAddress(strIP, strHeading);
+ if (bRet)
+ strncpy(&strIPAddress, strIP.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs)
+{
+ std::string str = &strInput;
+ bool bRet = CGUIDialogNumeric::ShowAndGetNumber(str, strHeading, iAutoCloseTimeoutMs);
+ if (bRet)
+ strncpy(&strInput, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+
+bool CAddonCallbacksGUI::Dialog_Numeric_ShowAndGetSeconds(char &timeString, unsigned int iMaxStringSize, const char *strHeading)
+{
+ std::string str = &timeString;
+ bool bRet = CGUIDialogNumeric::ShowAndGetSeconds(str, strHeading);
+ if (bRet)
+ strncpy(&timeString, str.c_str(), iMaxStringSize);
+ return bRet;
+}
+//@}
+
+/*! @name GUI File browser functions */
+//@{
+bool CAddonCallbacksGUI::Dialog_FileBrowser_ShowAndGetFile(const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList)
+{
+ std::string strPath = &path;
+ bool bRet = CGUIDialogFileBrowser::ShowAndGetFile(directory, mask, heading, strPath, useThumbs, useFileDirectories, singleList);
+ if (bRet)
+ strncpy(&path, strPath.c_str(), iMaxStringSize);
+ return bRet;
+}
+//@}
+
+/*! @name GUI OK Dialog */
+//@{
+void CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputSingleText(const char *heading, const char *text)
+{
+ CGUIDialogOK::ShowAndGetInput(heading, text);
+}
+
+void CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputLineText(const char *heading, const char *line0, const char *line1, const char *line2)
+{
+ CGUIDialogOK::ShowAndGetInput(heading, line0, line1, line2);
+}
+//@}
+
+/*! @name GUI Yes No Dialog */
+//@{
+bool CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputSingleText(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel)
+{
+ return CGUIDialogYesNo::ShowAndGetInput(heading, text, bCanceled, noLabel, yesLabel);
+}
+
+bool CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputLineText(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel)
+{
+ return CGUIDialogYesNo::ShowAndGetInput(heading, line0, line1, line2, noLabel, yesLabel);
+}
+
+bool CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputLineButtonText(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel)
+{
+ return CGUIDialogYesNo::ShowAndGetInput(heading, line0, line1, line2, bCanceled, noLabel, yesLabel);
+}
+//@}
+
+/*! @name GUI Text viewer Dialog */
+//@{
+void CAddonCallbacksGUI::Dialog_TextViewer(const char *heading, const char *text)
+{
+ CGUIDialogTextViewer* pDialog = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER);
+ pDialog->SetHeading(heading);
+ pDialog->SetText(text);
+ pDialog->DoModal();
+}
+//@}
+
+/*! @name GUI select Dialog */
+//@{
+int CAddonCallbacksGUI::Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected)
+{
+ CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
+ pDialog->Reset();
+ pDialog->SetHeading(heading);
+
+ for (unsigned int i = 0; i < size; i++)
+ pDialog->Add(entries[i]);
+
+ if (selected > 0)
+ pDialog->SetSelected(selected);
+
+ pDialog->DoModal();
+ return pDialog->GetSelectedLabel();
+}
+//@}
CGUIAddonWindow::CGUIAddonWindow(int id, const std::string& strXML, CAddon* addon)
: CGUIMediaWindow(id, strXML.c_str())
diff --git a/xbmc/addons/AddonCallbacksGUI.h b/xbmc/addons/AddonCallbacksGUI.h
index 2a3df8f9c1..ae032a7873 100644
--- a/xbmc/addons/AddonCallbacksGUI.h
+++ b/xbmc/addons/AddonCallbacksGUI.h
@@ -28,6 +28,7 @@
class CGUISpinControlEx;
class CGUIButtonControl;
class CGUIRadioButtonControl;
+class CGUISliderControl;
class CGUISettingsSliderControl;
class CGUIEditControl;
class CGUIRenderingControl;
@@ -99,6 +100,36 @@ public:
static void Control_Progress_SetInfo(void *addonData, GUIHANDLE handle, int iInfo);
static int Control_Progress_GetInfo(void *addonData, GUIHANDLE handle);
static const char * Control_Progress_GetDescription(void *addonData, GUIHANDLE handle);
+
+ static GUIHANDLE Window_GetControl_Slider(void *addonData, GUIHANDLE handle, int controlId);
+ static void Control_Slider_SetVisible(void *addonData, GUIHANDLE handle, bool yesNo);
+ static const char * Control_Slider_GetDescription(void *addonData, GUIHANDLE handle);
+ static void Control_Slider_SetIntRange(void *addonData, GUIHANDLE handle, int iStart, int iEnd);
+ static void Control_Slider_SetIntValue(void *addonData, GUIHANDLE handle, int iValue);
+ static int Control_Slider_GetIntValue(void *addonData, GUIHANDLE handle);
+ static void Control_Slider_SetIntInterval(void *addonData, GUIHANDLE handle, int iInterval);
+ static void Control_Slider_SetPercentage(void *addonData, GUIHANDLE handle, float fPercent);
+ static float Control_Slider_GetPercentage(void *addonData, GUIHANDLE handle);
+ static void Control_Slider_SetFloatRange(void *addonData, GUIHANDLE handle, float fStart, float fEnd);
+ static void Control_Slider_SetFloatValue(void *addonData, GUIHANDLE handle, float fValue);
+ static float Control_Slider_GetFloatValue(void *addonData, GUIHANDLE handle);
+ static void Control_Slider_SetFloatInterval(void *addonData, GUIHANDLE handle, float fInterval);
+
+ static GUIHANDLE Window_GetControl_SettingsSlider(void *addonData, GUIHANDLE handle, int controlId);
+ static void Control_SettingsSlider_SetVisible(void *addonData, GUIHANDLE handle, bool yesNo);
+ static void Control_SettingsSlider_SetText(void *addonData, GUIHANDLE handle, const char *label);
+ static const char * Control_SettingsSlider_GetDescription(void *addonData, GUIHANDLE handle);
+ static void Control_SettingsSlider_SetIntRange(void *addonData, GUIHANDLE handle, int iStart, int iEnd);
+ static void Control_SettingsSlider_SetIntValue(void *addonData, GUIHANDLE handle, int iValue);
+ static int Control_SettingsSlider_GetIntValue(void *addonData, GUIHANDLE handle);
+ static void Control_SettingsSlider_SetIntInterval(void *addonData, GUIHANDLE handle, int iInterval);
+ static void Control_SettingsSlider_SetPercentage(void *addonData, GUIHANDLE handle, float fPercent);
+ static float Control_SettingsSlider_GetPercentage(void *addonData, GUIHANDLE handle);
+ static void Control_SettingsSlider_SetFloatRange(void *addonData, GUIHANDLE handle, float fStart, float fEnd);
+ static void Control_SettingsSlider_SetFloatValue(void *addonData, GUIHANDLE handle, float fValue);
+ static float Control_SettingsSlider_GetFloatValue(void *addonData, GUIHANDLE handle);
+ static void Control_SettingsSlider_SetFloatInterval(void *addonData, GUIHANDLE handle, float fInterval);
+
static GUIHANDLE ListItem_Create(void *addonData, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path);
static const char * ListItem_GetLabel(void *addonData, GUIHANDLE handle);
static void ListItem_SetLabel(void *addonData, GUIHANDLE handle, const char *label);
@@ -114,6 +145,38 @@ public:
static void RenderAddon_Delete(void *addonData, GUIHANDLE handle);
static void RenderAddon_MarkDirty(void *addonData, GUIHANDLE handle);
+ static bool Dialog_Keyboard_ShowAndGetInput(char &aTextString, unsigned int iMaxStringSize, bool allowEmptyResult, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_ShowAndGetInputWithHead(char &aTextString, unsigned int iMaxStringSize, const char *heading, bool allowEmptyResult, bool hiddenInput, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_ShowAndGetNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_ShowAndGetNewPasswordWithHead(char &newPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmptyResult, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_ShowAndVerifyNewPassword(char &strNewPassword, unsigned int iMaxStringSize, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_ShowAndVerifyNewPasswordWithHead(char &strNewPassword, unsigned int iMaxStringSize, const char *strHeading, bool allowEmpty, unsigned int autoCloseMs);
+ static int Dialog_Keyboard_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_ShowAndGetFilter(char &aTextString, unsigned int iMaxStringSize, bool searching, unsigned int autoCloseMs);
+ static bool Dialog_Keyboard_SendTextToActiveKeyboard(const char *aTextString, bool closeKeyboard);
+ static bool Dialog_Keyboard_isKeyboardActivated();
+
+ static bool Dialog_Numeric_ShowAndVerifyNewPassword(char &strNewPasswor, unsigned int iMaxStringSized);
+ static int Dialog_Numeric_ShowAndVerifyPassword(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, int iRetries);
+ static bool Dialog_Numeric_ShowAndVerifyInput(char &strPassword, unsigned int iMaxStringSize, const char *strHeading, bool bGetUserInput);
+ static bool Dialog_Numeric_ShowAndGetTime(tm &time, const char *strHeading);
+ static bool Dialog_Numeric_ShowAndGetDate(tm &date, const char *strHeading);
+ static bool Dialog_Numeric_ShowAndGetIPAddress(char &strIPAddress, unsigned int iMaxStringSize, const char *strHeading);
+ static bool Dialog_Numeric_ShowAndGetNumber(char &strInput, unsigned int iMaxStringSize, const char *strHeading, unsigned int iAutoCloseTimeoutMs);
+ static bool Dialog_Numeric_ShowAndGetSeconds(char &timeString, unsigned int iMaxStringSize, const char *strHeading);
+
+ static bool Dialog_FileBrowser_ShowAndGetFile(const char *directory, const char *mask, const char *heading, char &path, unsigned int iMaxStringSize, bool useThumbs, bool useFileDirectories, bool singleList);
+
+ static void Dialog_OK_ShowAndGetInputSingleText(const char *heading, const char *text);
+ static void Dialog_OK_ShowAndGetInputLineText(const char *heading, const char *line0, const char *line1, const char *line2);
+
+ static bool Dialog_YesNo_ShowAndGetInputSingleText(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel);
+ static bool Dialog_YesNo_ShowAndGetInputLineText(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel);
+ static bool Dialog_YesNo_ShowAndGetInputLineButtonText(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel);
+
+ static void Dialog_TextViewer(const char *heading, const char *text);
+ static int Dialog_Select(const char *heading, const char *entries[], unsigned int size, int selected);
+
private:
CB_GUILib *m_callbacks;
CAddon *m_addon;