summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt3
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h14
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h41
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h40
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h256
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h308
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h227
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h162
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h168
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h158
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h251
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h323
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h550
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h572
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h2
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h257
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h18
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h20
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h410
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h55
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h50
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h27
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h11
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h446
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h26
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h5
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h33
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt7
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h111
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h369
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h594
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h78
32 files changed, 3465 insertions, 2127 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt
index 91cef7f..834ec00 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt
@@ -1,7 +1,8 @@
1set(HEADERS General.h 1set(HEADERS General.h
2 ListItem.h 2 ListItem.h
3 Window.h 3 Window.h
4 definitions.h) 4 definitions.h
5 renderHelper.h)
5 6
6if(NOT ENABLE_STATIC_LIBS) 7if(NOT ENABLE_STATIC_LIBS)
7 core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui) 8 core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui)
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h
index a3b8bcb..b5a6393 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/General.h
@@ -37,7 +37,7 @@ namespace gui
37 /// \ingroup cpp_kodi_gui 37 /// \ingroup cpp_kodi_gui
38 /// @brief Performs a graphical lock of rendering engine 38 /// @brief Performs a graphical lock of rendering engine
39 /// 39 ///
40 inline void Lock() 40 inline void ATTRIBUTE_HIDDEN Lock()
41 { 41 {
42 using namespace ::kodi::addon; 42 using namespace ::kodi::addon;
43 CAddonBase::m_interface->toKodi->kodi_gui->general->lock(); 43 CAddonBase::m_interface->toKodi->kodi_gui->general->lock();
@@ -50,7 +50,7 @@ namespace gui
50 /// \ingroup cpp_kodi_gui 50 /// \ingroup cpp_kodi_gui
51 /// @brief Performs a graphical unlock of previous locked rendering engine 51 /// @brief Performs a graphical unlock of previous locked rendering engine
52 /// 52 ///
53 inline void Unlock() 53 inline void ATTRIBUTE_HIDDEN Unlock()
54 { 54 {
55 using namespace ::kodi::addon; 55 using namespace ::kodi::addon;
56 CAddonBase::m_interface->toKodi->kodi_gui->general->unlock(); 56 CAddonBase::m_interface->toKodi->kodi_gui->general->unlock();
@@ -62,7 +62,7 @@ namespace gui
62 /// \ingroup cpp_kodi_gui 62 /// \ingroup cpp_kodi_gui
63 /// @brief Return the the current screen height with pixel 63 /// @brief Return the the current screen height with pixel
64 /// 64 ///
65 inline int GetScreenHeight() 65 inline int ATTRIBUTE_HIDDEN GetScreenHeight()
66 { 66 {
67 using namespace ::kodi::addon; 67 using namespace ::kodi::addon;
68 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_screen_height(CAddonBase::m_interface->toKodi->kodiBase); 68 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_screen_height(CAddonBase::m_interface->toKodi->kodiBase);
@@ -74,7 +74,7 @@ namespace gui
74 /// \ingroup cpp_kodi_gui 74 /// \ingroup cpp_kodi_gui
75 /// @brief Return the the current screen width with pixel 75 /// @brief Return the the current screen width with pixel
76 /// 76 ///
77 inline int GetScreenWidth() 77 inline int ATTRIBUTE_HIDDEN GetScreenWidth()
78 { 78 {
79 using namespace ::kodi::addon; 79 using namespace ::kodi::addon;
80 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_screen_width(CAddonBase::m_interface->toKodi->kodiBase); 80 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_screen_width(CAddonBase::m_interface->toKodi->kodiBase);
@@ -86,7 +86,7 @@ namespace gui
86 /// \ingroup cpp_kodi_gui 86 /// \ingroup cpp_kodi_gui
87 /// @brief Return the the current screen rendering resolution 87 /// @brief Return the the current screen rendering resolution
88 /// 88 ///
89 inline int GetVideoResolution() 89 inline int ATTRIBUTE_HIDDEN GetVideoResolution()
90 { 90 {
91 using namespace ::kodi::addon; 91 using namespace ::kodi::addon;
92 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_video_resolution(CAddonBase::m_interface->toKodi->kodiBase); 92 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_video_resolution(CAddonBase::m_interface->toKodi->kodiBase);
@@ -110,7 +110,7 @@ namespace gui
110 /// .. 110 /// ..
111 /// ~~~~~~~~~~~~~ 111 /// ~~~~~~~~~~~~~
112 /// 112 ///
113 inline int GetCurrentWindowDialogId() 113 inline int ATTRIBUTE_HIDDEN GetCurrentWindowDialogId()
114 { 114 {
115 using namespace ::kodi::addon; 115 using namespace ::kodi::addon;
116 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_current_window_dialog_id(CAddonBase::m_interface->toKodi->kodiBase); 116 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_current_window_dialog_id(CAddonBase::m_interface->toKodi->kodiBase);
@@ -134,7 +134,7 @@ namespace gui
134 /// .. 134 /// ..
135 /// ~~~~~~~~~~~~~ 135 /// ~~~~~~~~~~~~~
136 /// 136 ///
137 inline int GetCurrentWindowId() 137 inline int ATTRIBUTE_HIDDEN GetCurrentWindowId()
138 { 138 {
139 using namespace ::kodi::addon; 139 using namespace ::kodi::addon;
140 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_current_window_id(CAddonBase::m_interface->toKodi->kodiBase); 140 return CAddonBase::m_interface->toKodi->kodi_gui->general->get_current_window_id(CAddonBase::m_interface->toKodi->kodiBase);
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h
index f13b96e..1af4863 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h
@@ -20,7 +20,7 @@ namespace gui
20 20
21 class CWindow; 21 class CWindow;
22 22
23 class CAddonGUIControlBase 23 class ATTRIBUTE_HIDDEN CAddonGUIControlBase
24 { 24 {
25 public: 25 public:
26 GUIHANDLE GetControlHandle() const { return m_controlHandle; } 26 GUIHANDLE GetControlHandle() const { return m_controlHandle; }
@@ -69,7 +69,7 @@ namespace gui
69 /// @brief **Library definition values** 69 /// @brief **Library definition values**
70 /// 70 ///
71 71
72 class CListItem : public CAddonGUIControlBase 72 class ATTRIBUTE_HIDDEN CListItem : public CAddonGUIControlBase
73 { 73 {
74 public: 74 public:
75 //========================================================================== 75 //==========================================================================
@@ -188,43 +188,6 @@ namespace gui
188 //========================================================================== 188 //==========================================================================
189 /// 189 ///
190 /// \ingroup cpp_kodi_gui_CListItem 190 /// \ingroup cpp_kodi_gui_CListItem
191 /// @brief To get current icon image of entry
192 ///
193 /// @return The current icon image path (if present)
194 ///
195 std::string GetIconImage()
196 {
197 std::string image;
198 char* ret = m_interface->kodi_gui->listItem->get_icon_image(m_interface->kodiBase, m_controlHandle);
199 if (ret != nullptr)
200 {
201 if (std::strlen(ret))
202 image = ret;
203 m_interface->free_string(m_interface->kodiBase, ret);
204 }
205 return image;
206 }
207 //--------------------------------------------------------------------------
208
209 //==========================================================================
210 ///
211 /// \ingroup cpp_kodi_gui_CListItem
212 /// @brief To set icon image of entry
213 ///
214 /// @param image The image to use for.
215 ///
216 /// @note Alternative can be \ref SetArt used
217 ///
218 ///
219 void SetIconImage(const std::string& image)
220 {
221 m_interface->kodi_gui->listItem->set_icon_image(m_interface->kodiBase, m_controlHandle, image.c_str());
222 }
223 //--------------------------------------------------------------------------
224
225 //==========================================================================
226 ///
227 /// \ingroup cpp_kodi_gui_CListItem
228 /// @brief Sets the listitem's art 191 /// @brief Sets the listitem's art
229 /// 192 ///
230 /// @param[in] type Type of Art to set 193 /// @param[in] type Type of Art to set
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h
index e7a8a05..5011374 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h
@@ -60,7 +60,7 @@ namespace gui
60 /// @brief <b>Library definition values</b> 60 /// @brief <b>Library definition values</b>
61 /// 61 ///
62 62
63 class CWindow : public CAddonGUIControlBase 63 class ATTRIBUTE_HIDDEN CWindow : public CAddonGUIControlBase
64 { 64 {
65 public: 65 public:
66 //========================================================================== 66 //==========================================================================
@@ -205,6 +205,36 @@ namespace gui
205 //========================================================================== 205 //==========================================================================
206 /// 206 ///
207 /// \ingroup cpp_kodi_gui_CWindow 207 /// \ingroup cpp_kodi_gui_CWindow
208 /// @brief To set the visibility on given control id
209 ///
210 /// @param[in] controlId Control id where visibility is changed
211 /// @param[in] visible Boolean value with `true` for visible, `false` for hidden
212 ///
213 ///
214 void SetControlVisible(int controlId, bool visible)
215 {
216 m_interface->kodi_gui->window->set_control_visible(m_interface->kodiBase, m_controlHandle, controlId, visible);
217 }
218 //--------------------------------------------------------------------------
219
220 //==========================================================================
221 ///
222 /// \ingroup cpp_kodi_gui_CWindow
223 /// @brief To set the selection on given control id
224 ///
225 /// @param[in] controlId Control id where selection is changed
226 /// @param[in] selected Boolean value with `true` for selected, `false` for not
227 ///
228 ///
229 void SetControlSelected(int controlId, bool selected)
230 {
231 m_interface->kodi_gui->window->set_control_selected(m_interface->kodiBase, m_controlHandle, controlId, selected);
232 }
233 //--------------------------------------------------------------------------
234
235 //==========================================================================
236 ///
237 /// \ingroup cpp_kodi_gui_CWindow
208 /// @brief Sets a window property, similar to an infolabel. 238 /// @brief Sets a window property, similar to an infolabel.
209 /// 239 ///
210 /// @param[in] key string - property name. 240 /// @param[in] key string - property name.
@@ -705,7 +735,7 @@ namespace gui
705 /// .. 735 /// ..
706 /// ~~~~~~~~~~~~~ 736 /// ~~~~~~~~~~~~~
707 /// 737 ///
708 virtual bool OnAction(int actionId) 738 virtual bool OnAction(int actionId, uint32_t buttoncode, wchar_t unicode)
709 { 739 {
710 switch (actionId) 740 switch (actionId)
711 { 741 {
@@ -811,7 +841,7 @@ namespace gui
811 bool (*CBOnInit) (GUIHANDLE cbhdl), 841 bool (*CBOnInit) (GUIHANDLE cbhdl),
812 bool (*CBOnFocus) (GUIHANDLE cbhdl, int controlId), 842 bool (*CBOnFocus) (GUIHANDLE cbhdl, int controlId),
813 bool (*CBOnClick) (GUIHANDLE cbhdl, int controlId), 843 bool (*CBOnClick) (GUIHANDLE cbhdl, int controlId),
814 bool (*CBOnAction) (GUIHANDLE cbhdl, int actionId), 844 bool (*CBOnAction) (GUIHANDLE cbhdl, int actionId, uint32_t buttoncode, wchar_t unicode),
815 void (*CBGetContextButtons) (GUIHANDLE cbhdl, int itemNumber, gui_context_menu_pair* buttons, unsigned int* size) = nullptr, 845 void (*CBGetContextButtons) (GUIHANDLE cbhdl, int itemNumber, gui_context_menu_pair* buttons, unsigned int* size) = nullptr,
816 bool (*CBOnContextButton) (GUIHANDLE cbhdl, int itemNumber, unsigned int button) = nullptr) 846 bool (*CBOnContextButton) (GUIHANDLE cbhdl, int itemNumber, unsigned int button) = nullptr)
817 { 847 {
@@ -845,9 +875,9 @@ namespace gui
845 return static_cast<CWindow*>(cbhdl)->OnClick(controlId); 875 return static_cast<CWindow*>(cbhdl)->OnClick(controlId);
846 } 876 }
847 877
848 static bool CBOnAction(GUIHANDLE cbhdl, int actionId) 878 static bool CBOnAction(GUIHANDLE cbhdl, int actionId, uint32_t buttoncode, wchar_t unicode)
849 { 879 {
850 return static_cast<CWindow*>(cbhdl)->OnAction(actionId); 880 return static_cast<CWindow*>(cbhdl)->OnAction(actionId, buttoncode, unicode);
851 } 881 }
852 882
853 static void CBGetContextButtons(GUIHANDLE cbhdl, int itemNumber, gui_context_menu_pair* buttons, unsigned int* size) 883 static void CBGetContextButtons(GUIHANDLE cbhdl, int itemNumber, gui_context_menu_pair* buttons, unsigned int* size)
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
index a38de1a..081ab06 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
@@ -18,147 +18,153 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CButton Control Button
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CButton }
26/// **Standard push button control for window**
27///
28/// The button control is used for creating push buttons in Kodi. You can
29/// choose the position, size, and look of the button, as well as choosing
30/// what action(s) should be performed when pushed.
31///
32/// It has the header \ref Button.h "#include <kodi/gui/controls/Button.h>"
33/// be included to enjoy it.
34///
35/// Here you find the needed skin part for a \ref skin_Button_control "button control"
36///
37/// @note The call of the control is only possible from the corresponding
38/// window as its class and identification number is required.
39///
40class ATTRIBUTE_HIDDEN CButton : public CAddonGUIControlBase
41{
42public:
43 //==========================================================================
44 ///
45 /// @ingroup cpp_kodi_gui_control_CButton
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
22 /// 50 ///
23 /// \defgroup cpp_kodi_gui_controls_CButton Control Button 51 CButton(CWindow* window, int controlId) : CAddonGUIControlBase(window)
24 /// \ingroup cpp_kodi_gui 52 {
25 /// @brief \cpp_class{ kodi::gui::controls::CButton } 53 m_controlHandle = m_interface->kodi_gui->window->get_control_button(
26 /// **Standard push button control for window** 54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CButton can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
27 /// 61 ///
28 /// The button control is used for creating push buttons in Kodi. You can 62 /// @ingroup cpp_kodi_gui_control_CButton
29 /// choose the position, size, and look of the button, as well as choosing 63 /// @brief Destructor
30 /// what action(s) should be performed when pushed.
31 /// 64 ///
32 /// It has the header \ref Button.h "#include <kodi/gui/controls/Button.h>" 65 ~CButton() override = default;
33 /// be included to enjoy it. 66 //--------------------------------------------------------------------------
67
68 //==========================================================================
34 /// 69 ///
35 /// Here you find the needed skin part for a \ref skin_Button_control "button control" 70 /// @ingroup cpp_kodi_gui_control_CButton
71 /// @brief Set the control on window to visible
36 /// 72 ///
37 /// @note The call of the control is only possible from the corresponding 73 /// @param[in] visible If true visible, otherwise hidden
38 /// window as its class and identification number is required.
39 /// 74 ///
40 class CButton : public CAddonGUIControlBase 75 void SetVisible(bool visible)
41 { 76 {
42 public: 77 m_interface->kodi_gui->control_button->set_visible(m_interface->kodiBase, m_controlHandle,
43 //========================================================================== 78 visible);
44 /// 79 }
45 /// @ingroup cpp_kodi_gui_control_CButton 80 //--------------------------------------------------------------------------
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
50 ///
51 CButton(CWindow* window, int controlId)
52 : CAddonGUIControlBase(window)
53 {
54 m_controlHandle = m_interface->kodi_gui->window->get_control_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CButton can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59 81
60 //========================================================================== 82 //==========================================================================
61 /// 83 ///
62 /// @ingroup cpp_kodi_gui_control_CButton 84 /// @ingroup cpp_kodi_gui_control_CButton
63 /// @brief Destructor 85 /// @brief Set's the control's enabled/disabled state
64 /// 86 ///
65 ~CButton() override = default; 87 /// @param[in] enabled If true enabled, otherwise disabled
66 //-------------------------------------------------------------------------- 88 ///
67 89 void SetEnabled(bool enabled)
68 //========================================================================== 90 {
69 /// 91 m_interface->kodi_gui->control_button->set_enabled(m_interface->kodiBase, m_controlHandle,
70 /// @ingroup cpp_kodi_gui_control_CButton 92 enabled);
71 /// @brief Set the control on window to visible 93 }
72 /// 94 //--------------------------------------------------------------------------
73 /// @param[in] visible If true visible, otherwise hidden
74 ///
75 void SetVisible(bool visible)
76 {
77 m_interface->kodi_gui->control_button->set_visible(m_interface->kodiBase, m_controlHandle, visible);
78 }
79 //--------------------------------------------------------------------------
80
81 //==========================================================================
82 ///
83 /// @ingroup cpp_kodi_gui_control_CButton
84 /// @brief Set's the control's enabled/disabled state
85 ///
86 /// @param[in] enabled If true enabled, otherwise disabled
87 ///
88 void SetEnabled(bool enabled)
89 {
90 m_interface->kodi_gui->control_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
91 }
92 //--------------------------------------------------------------------------
93 95
94 //========================================================================== 96 //==========================================================================
95 /// 97 ///
96 /// @ingroup cpp_kodi_gui_control_CButton 98 /// @ingroup cpp_kodi_gui_control_CButton
97 /// @brief To set the text string on button 99 /// @brief To set the text string on button
98 /// 100 ///
99 /// @param[in] label Text to show 101 /// @param[in] label Text to show
100 /// 102 ///
101 void SetLabel(const std::string& label) 103 void SetLabel(const std::string& label)
102 { 104 {
103 m_interface->kodi_gui->control_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str()); 105 m_interface->kodi_gui->control_button->set_label(m_interface->kodiBase, m_controlHandle,
104 } 106 label.c_str());
105 //-------------------------------------------------------------------------- 107 }
108 //--------------------------------------------------------------------------
106 109
107 //========================================================================== 110 //==========================================================================
108 /// 111 ///
109 /// @ingroup cpp_kodi_gui_control_CButton 112 /// @ingroup cpp_kodi_gui_control_CButton
110 /// @brief Get the used text from button 113 /// @brief Get the used text from button
111 /// 114 ///
112 /// @return Text shown 115 /// @return Text shown
113 /// 116 ///
114 std::string GetLabel() const 117 std::string GetLabel() const
118 {
119 std::string label;
120 char* ret =
121 m_interface->kodi_gui->control_button->get_label(m_interface->kodiBase, m_controlHandle);
122 if (ret != nullptr)
115 { 123 {
116 std::string label; 124 if (std::strlen(ret))
117 char* ret = m_interface->kodi_gui->control_button->get_label(m_interface->kodiBase, m_controlHandle); 125 label = ret;
118 if (ret != nullptr) 126 m_interface->free_string(m_interface->kodiBase, ret);
119 {
120 if (std::strlen(ret))
121 label = ret;
122 m_interface->free_string(m_interface->kodiBase, ret);
123 }
124 return label;
125 } 127 }
126 //-------------------------------------------------------------------------- 128 return label;
129 }
130 //--------------------------------------------------------------------------
127 131
128 //========================================================================== 132 //==========================================================================
129 /// 133 ///
130 /// @ingroup cpp_kodi_gui_control_CButton 134 /// @ingroup cpp_kodi_gui_control_CButton
131 /// @brief If two labels are used for button becomes it set with them 135 /// @brief If two labels are used for button becomes it set with them
132 /// 136 ///
133 /// @param[in] label Text for second label 137 /// @param[in] label Text for second label
134 /// 138 ///
135 void SetLabel2(const std::string& label) 139 void SetLabel2(const std::string& label)
136 { 140 {
137 m_interface->kodi_gui->control_button->set_label2(m_interface->kodiBase, m_controlHandle, label.c_str()); 141 m_interface->kodi_gui->control_button->set_label2(m_interface->kodiBase, m_controlHandle,
138 } 142 label.c_str());
139 //-------------------------------------------------------------------------- 143 }
144 //--------------------------------------------------------------------------
140 145
141 //========================================================================== 146 //==========================================================================
142 /// 147 ///
143 /// @ingroup cpp_kodi_gui_control_CButton 148 /// @ingroup cpp_kodi_gui_control_CButton
144 /// @brief Get the second label if present 149 /// @brief Get the second label if present
145 /// 150 ///
146 /// @return Second label 151 /// @return Second label
147 /// 152 ///
148 std::string GetLabel2() const 153 std::string GetLabel2() const
154 {
155 std::string label;
156 char* ret =
157 m_interface->kodi_gui->control_button->get_label2(m_interface->kodiBase, m_controlHandle);
158 if (ret != nullptr)
149 { 159 {
150 std::string label; 160 if (std::strlen(ret))
151 char* ret = m_interface->kodi_gui->control_button->get_label2(m_interface->kodiBase, m_controlHandle); 161 label = ret;
152 if (ret != nullptr) 162 m_interface->free_string(m_interface->kodiBase, ret);
153 {
154 if (std::strlen(ret))
155 label = ret;
156 m_interface->free_string(m_interface->kodiBase, ret);
157 }
158 return label;
159 } 163 }
160 //-------------------------------------------------------------------------- 164 return label;
161 }; 165 }
166 //--------------------------------------------------------------------------
167};
162 168
163} /* namespace controls */ 169} /* namespace controls */
164} /* namespace gui */ 170} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
index 5d30160..99c01de 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
@@ -95,170 +95,180 @@ namespace gui
95namespace controls 95namespace controls
96{ 96{
97 97
98 class CEdit : public CAddonGUIControlBase 98class ATTRIBUTE_HIDDEN CEdit : public CAddonGUIControlBase
99{
100public:
101 //==========================================================================
102 ///
103 /// \ingroup cpp_kodi_gui_controls_CEdit
104 /// @brief Construct a new control
105 ///
106 /// @param[in] window related window control class
107 /// @param[in] controlId Used skin xml control id
108 ///
109 CEdit(CWindow* window, int controlId) : CAddonGUIControlBase(window)
99 { 110 {
100 public: 111 m_controlHandle = m_interface->kodi_gui->window->get_control_edit(
101 //========================================================================== 112 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
102 /// 113 if (!m_controlHandle)
103 /// \ingroup cpp_kodi_gui_controls_CEdit 114 kodi::Log(ADDON_LOG_FATAL,
104 /// @brief Construct a new control 115 "kodi::gui::control::CEdit can't create control class from Kodi !!!");
105 /// 116 }
106 /// @param[in] window related window control class 117 //--------------------------------------------------------------------------
107 /// @param[in] controlId Used skin xml control id
108 ///
109 CEdit(CWindow* window, int controlId)
110 : CAddonGUIControlBase(window)
111 {
112 m_controlHandle = m_interface->kodi_gui->window->get_control_edit(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
113 if (!m_controlHandle)
114 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::control::CEdit can't create control class from Kodi !!!");
115 }
116 //--------------------------------------------------------------------------
117 118
118 //========================================================================== 119 //==========================================================================
119 /// 120 ///
120 /// \ingroup cpp_kodi_gui_controls_CEdit 121 /// \ingroup cpp_kodi_gui_controls_CEdit
121 /// @brief Destructor 122 /// @brief Destructor
122 /// 123 ///
123 ~CEdit() override = default; 124 ~CEdit() override = default;
124 //-------------------------------------------------------------------------- 125 //--------------------------------------------------------------------------
125 126
126 //========================================================================== 127 //==========================================================================
127 /// 128 ///
128 /// \ingroup cpp_kodi_gui_controls_CEdit 129 /// \ingroup cpp_kodi_gui_controls_CEdit
129 /// @brief Set the control on window to visible 130 /// @brief Set the control on window to visible
130 /// 131 ///
131 /// @param[in] visible If true visible, otherwise hidden 132 /// @param[in] visible If true visible, otherwise hidden
132 /// 133 ///
133 void SetVisible(bool visible) 134 void SetVisible(bool visible)
134 { 135 {
135 m_interface->kodi_gui->control_edit->set_visible(m_interface->kodiBase, m_controlHandle, visible); 136 m_interface->kodi_gui->control_edit->set_visible(m_interface->kodiBase, m_controlHandle,
136 } 137 visible);
137 //-------------------------------------------------------------------------- 138 }
139 //--------------------------------------------------------------------------
138 140
139 //========================================================================== 141 //==========================================================================
140 /// 142 ///
141 /// \ingroup cpp_kodi_gui_controls_CEdit 143 /// \ingroup cpp_kodi_gui_controls_CEdit
142 /// @brief Set's the control's enabled/disabled state 144 /// @brief Set's the control's enabled/disabled state
143 /// 145 ///
144 /// @param[in] enabled If true enabled, otherwise disabled 146 /// @param[in] enabled If true enabled, otherwise disabled
145 /// 147 ///
146 void SetEnabled(bool enabled) 148 void SetEnabled(bool enabled)
147 { 149 {
148 m_interface->kodi_gui->control_edit->set_enabled(m_interface->kodiBase, m_controlHandle, enabled); 150 m_interface->kodi_gui->control_edit->set_enabled(m_interface->kodiBase, m_controlHandle,
149 } 151 enabled);
150 //-------------------------------------------------------------------------- 152 }
153 //--------------------------------------------------------------------------
151 154
152 //========================================================================== 155 //==========================================================================
153 /// 156 ///
154 /// \ingroup cpp_kodi_gui_controls_CEdit 157 /// \ingroup cpp_kodi_gui_controls_CEdit
155 /// @brief To set the text string on edit control 158 /// @brief To set the text string on edit control
156 /// 159 ///
157 /// @param[in] label Text to show 160 /// @param[in] label Text to show
158 /// 161 ///
159 void SetLabel(const std::string& label) 162 void SetLabel(const std::string& label)
160 { 163 {
161 m_interface->kodi_gui->control_edit->set_label(m_interface->kodiBase, m_controlHandle, label.c_str()); 164 m_interface->kodi_gui->control_edit->set_label(m_interface->kodiBase, m_controlHandle,
162 } 165 label.c_str());
163 //-------------------------------------------------------------------------- 166 }
167 //--------------------------------------------------------------------------
164 168
165 //========================================================================== 169 //==========================================================================
166 /// 170 ///
167 /// \ingroup cpp_kodi_gui_controls_CEdit 171 /// \ingroup cpp_kodi_gui_controls_CEdit
168 /// @brief Returns the text heading for this edit control. 172 /// @brief Returns the text heading for this edit control.
169 /// 173 ///
170 /// @return Heading text 174 /// @return Heading text
171 /// 175 ///
172 std::string GetLabel() const 176 std::string GetLabel() const
177 {
178 std::string label;
179 char* ret =
180 m_interface->kodi_gui->control_edit->get_label(m_interface->kodiBase, m_controlHandle);
181 if (ret != nullptr)
173 { 182 {
174 std::string label; 183 if (std::strlen(ret))
175 char* ret = m_interface->kodi_gui->control_edit->get_label(m_interface->kodiBase, m_controlHandle); 184 label = ret;
176 if (ret != nullptr) 185 m_interface->free_string(m_interface->kodiBase, ret);
177 {
178 if (std::strlen(ret))
179 label = ret;
180 m_interface->free_string(m_interface->kodiBase, ret);
181 }
182 return label;
183 } 186 }
184 //-------------------------------------------------------------------------- 187 return label;
188 }
189 //--------------------------------------------------------------------------
185 190
186 //========================================================================== 191 //==========================================================================
187 /// 192 ///
188 /// \ingroup cpp_kodi_gui_controls_CEdit 193 /// \ingroup cpp_kodi_gui_controls_CEdit
189 /// @brief Set's text heading for this edit control. 194 /// @brief Set's text heading for this edit control.
190 /// 195 ///
191 /// @param[in] text string or unicode - text string. 196 /// @param[in] text string or unicode - text string.
192 /// 197 ///
193 void SetText(const std::string& text) 198 void SetText(const std::string& text)
194 { 199 {
195 m_interface->kodi_gui->control_edit->set_text(m_interface->kodiBase, m_controlHandle, text.c_str()); 200 m_interface->kodi_gui->control_edit->set_text(m_interface->kodiBase, m_controlHandle,
196 } 201 text.c_str());
197 //-------------------------------------------------------------------------- 202 }
203 //--------------------------------------------------------------------------
198 204
199 //========================================================================== 205 //==========================================================================
200 /// 206 ///
201 /// \ingroup cpp_kodi_gui_controls_CEdit 207 /// \ingroup cpp_kodi_gui_controls_CEdit
202 /// @brief Returns the text value for this edit control. 208 /// @brief Returns the text value for this edit control.
203 /// 209 ///
204 /// @return Text value of control 210 /// @return Text value of control
205 /// 211 ///
206 std::string GetText() const 212 std::string GetText() const
213 {
214 std::string text;
215 char* ret =
216 m_interface->kodi_gui->control_edit->get_text(m_interface->kodiBase, m_controlHandle);
217 if (ret != nullptr)
207 { 218 {
208 std::string text; 219 if (std::strlen(ret))
209 char* ret = m_interface->kodi_gui->control_edit->get_text(m_interface->kodiBase, m_controlHandle); 220 text = ret;
210 if (ret != nullptr) 221 m_interface->free_string(m_interface->kodiBase, ret);
211 {
212 if (std::strlen(ret))
213 text = ret;
214 m_interface->free_string(m_interface->kodiBase, ret);
215 }
216 return text;
217 } 222 }
218 //-------------------------------------------------------------------------- 223 return text;
224 }
225 //--------------------------------------------------------------------------
219 226
220 //========================================================================== 227 //==========================================================================
221 /// 228 ///
222 /// \ingroup cpp_kodi_gui_controls_CEdit 229 /// \ingroup cpp_kodi_gui_controls_CEdit
223 /// @brief Set the cursor position on text. 230 /// @brief Set the cursor position on text.
224 /// 231 ///
225 /// @param[in] iPosition The position to set 232 /// @param[in] iPosition The position to set
226 /// 233 ///
227 void SetCursorPosition(unsigned int iPosition) 234 void SetCursorPosition(unsigned int iPosition)
228 { 235 {
229 m_interface->kodi_gui->control_edit->set_cursor_position(m_interface->kodiBase, m_controlHandle, iPosition); 236 m_interface->kodi_gui->control_edit->set_cursor_position(m_interface->kodiBase, m_controlHandle,
230 } 237 iPosition);
231 //-------------------------------------------------------------------------- 238 }
239 //--------------------------------------------------------------------------
232 240
233 //========================================================================== 241 //==========================================================================
234 /// 242 ///
235 /// \ingroup cpp_kodi_gui_controls_CEdit 243 /// \ingroup cpp_kodi_gui_controls_CEdit
236 /// @brief To get current cursor position on text field 244 /// @brief To get current cursor position on text field
237 /// 245 ///
238 /// @return The current cursor position 246 /// @return The current cursor position
239 /// 247 ///
240 unsigned int GetCursorPosition() 248 unsigned int GetCursorPosition()
241 { 249 {
242 return m_interface->kodi_gui->control_edit->get_cursor_position(m_interface->kodiBase, m_controlHandle); 250 return m_interface->kodi_gui->control_edit->get_cursor_position(m_interface->kodiBase,
243 } 251 m_controlHandle);
244 //-------------------------------------------------------------------------- 252 }
253 //--------------------------------------------------------------------------
245 254
246 //========================================================================== 255 //==========================================================================
247 /// 256 ///
248 /// \ingroup cpp_kodi_gui_controls_CEdit 257 /// \ingroup cpp_kodi_gui_controls_CEdit
249 /// @brief To set field input type which are defined on \ref AddonGUIInputType 258 /// @brief To set field input type which are defined on \ref AddonGUIInputType
250 /// 259 ///
251 /// @param[in] type The \ref AddonGUIInputType "Add-on input type" 260 /// @param[in] type The \ref AddonGUIInputType "Add-on input type"
252 /// to use 261 /// to use
253 /// @param[in] heading The heading text for related keyboard 262 /// @param[in] heading The heading text for related keyboard
254 /// dialog 263 /// dialog
255 /// 264 ///
256 void SetInputType(AddonGUIInputType type, const std::string& heading) 265 void SetInputType(AddonGUIInputType type, const std::string& heading)
257 { 266 {
258 m_interface->kodi_gui->control_edit->set_input_type(m_interface->kodiBase, m_controlHandle, static_cast<int>(type), heading.c_str()); 267 m_interface->kodi_gui->control_edit->set_input_type(m_interface->kodiBase, m_controlHandle,
259 } 268 static_cast<int>(type), heading.c_str());
260 //-------------------------------------------------------------------------- 269 }
261 }; 270 //--------------------------------------------------------------------------
271};
262 272
263} /* namespace controls */ 273} /* namespace controls */
264} /* namespace gui */ 274} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
index aab8929..02c843f 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
@@ -18,130 +18,135 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CFadeLabel Control Fade Label
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CFadeLabel }
26/// **Window control used to show multiple pieces of text in the same position,
27/// by fading from one to the other**
28///
29/// The fade label control is used for displaying multiple pieces of text in
30/// the same space in Kodi. You can choose the font, size, colour, location
31/// and contents of the text to be displayed. The first piece of information
32/// to display fades in over 50 frames, then scrolls off to the left. Once it
33/// is finished scrolling off screen, the second piece of information fades
34/// in and the process repeats. A fade label control is not supported in a
35/// list container.
36///
37/// It has the header \ref FadeLabel.h "#include <kodi/gui/controls/FadeLabel.h>"
38/// be included to enjoy it.
39///
40/// Here you find the needed skin part for a \ref Fade_Label_Control "fade label control"
41///
42/// @note The call of the control is only possible from the corresponding
43/// window as its class and identification number is required.
44///
45class ATTRIBUTE_HIDDEN CFadeLabel : public CAddonGUIControlBase
46{
47public:
48 //==========================================================================
22 /// 49 ///
23 /// \defgroup cpp_kodi_gui_controls_CFadeLabel Control Fade Label 50 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
24 /// \ingroup cpp_kodi_gui 51 /// @brief Construct a new control.
25 /// @brief \cpp_class{ kodi::gui::controls::CFadeLabel }
26 /// **Window control used to show multiple pieces of text in the same position,
27 /// by fading from one to the other**
28 /// 52 ///
29 /// The fade label control is used for displaying multiple pieces of text in 53 /// @param[in] window related window control class
30 /// the same space in Kodi. You can choose the font, size, colour, location 54 /// @param[in] controlId Used skin xml control id
31 /// and contents of the text to be displayed. The first piece of information
32 /// to display fades in over 50 frames, then scrolls off to the left. Once it
33 /// is finished scrolling off screen, the second piece of information fades
34 /// in and the process repeats. A fade label control is not supported in a
35 /// list container.
36 /// 55 ///
37 /// It has the header \ref FadeLabel.h "#include <kodi/gui/controls/FadeLabel.h>" 56 CFadeLabel(CWindow* window, int controlId) : CAddonGUIControlBase(window)
38 /// be included to enjoy it. 57 {
58 m_controlHandle = m_interface->kodi_gui->window->get_control_fade_label(
59 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
60 if (!m_controlHandle)
61 kodi::Log(ADDON_LOG_FATAL,
62 "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!");
63 }
64 //--------------------------------------------------------------------------
65
66 //==========================================================================
39 /// 67 ///
40 /// Here you find the needed skin part for a \ref Fade_Label_Control "fade label control" 68 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
69 /// @brief Destructor.
70 ///
71 ~CFadeLabel() override = default;
72 //--------------------------------------------------------------------------
73
74 //==========================================================================
41 /// 75 ///
42 /// @note The call of the control is only possible from the corresponding 76 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
43 /// window as its class and identification number is required. 77 /// @brief Set the control on window to visible.
44 /// 78 ///
45 class CFadeLabel : public CAddonGUIControlBase 79 /// @param[in] visible If true visible, otherwise hidden
80 ///
81 void SetVisible(bool visible)
46 { 82 {
47 public: 83 m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle,
48 //========================================================================== 84 visible);
49 /// 85 }
50 /// \ingroup cpp_kodi_gui_controls_CFadeLabel 86 //--------------------------------------------------------------------------
51 /// @brief Construct a new control.
52 ///
53 /// @param[in] window related window control class
54 /// @param[in] controlId Used skin xml control id
55 ///
56 CFadeLabel(CWindow* window, int controlId)
57 : CAddonGUIControlBase(window)
58 {
59 m_controlHandle = m_interface->kodi_gui->window->get_control_fade_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
60 if (!m_controlHandle)
61 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!");
62 }
63 //--------------------------------------------------------------------------
64
65 //==========================================================================
66 ///
67 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
68 /// @brief Destructor.
69 ///
70 ~CFadeLabel() override = default;
71 //--------------------------------------------------------------------------
72 87
73 //========================================================================== 88 //==========================================================================
74 /// 89 ///
75 /// \ingroup cpp_kodi_gui_controls_CFadeLabel 90 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
76 /// @brief Set the control on window to visible. 91 /// @brief To add additional text string on fade label.
77 /// 92 ///
78 /// @param[in] visible If true visible, otherwise hidden 93 /// @param[in] label Text to show
79 /// 94 ///
80 void SetVisible(bool visible) 95 void AddLabel(const std::string& label)
81 { 96 {
82 m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle, visible); 97 m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle,
83 } 98 label.c_str());
84 //-------------------------------------------------------------------------- 99 }
85 100 //--------------------------------------------------------------------------
86 //==========================================================================
87 ///
88 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
89 /// @brief To add additional text string on fade label.
90 ///
91 /// @param[in] label Text to show
92 ///
93 void AddLabel(const std::string& label)
94 {
95 m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle, label.c_str());
96 }
97 //--------------------------------------------------------------------------
98 101
99 //========================================================================== 102 //==========================================================================
100 /// 103 ///
101 /// \ingroup cpp_kodi_gui_controls_CFadeLabel 104 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
102 /// @brief Get the used text from button 105 /// @brief Get the used text from button
103 /// 106 ///
104 /// @return Text shown 107 /// @return Text shown
105 /// 108 ///
106 std::string GetLabel() const 109 std::string GetLabel() const
110 {
111 std::string label;
112 char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase,
113 m_controlHandle);
114 if (ret != nullptr)
107 { 115 {
108 std::string label; 116 if (std::strlen(ret))
109 char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase, m_controlHandle); 117 label = ret;
110 if (ret != nullptr) 118 m_interface->free_string(m_interface->kodiBase, ret);
111 {
112 if (std::strlen(ret))
113 label = ret;
114 m_interface->free_string(m_interface->kodiBase, ret);
115 }
116 return label;
117 } 119 }
118 //-------------------------------------------------------------------------- 120 return label;
121 }
122 //--------------------------------------------------------------------------
119 123
120 //========================================================================== 124 //==========================================================================
121 /// 125 ///
122 /// \ingroup cpp_kodi_gui_controls_CFadeLabel 126 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
123 /// @brief To enable or disable scrolling on fade label 127 /// @brief To enable or disable scrolling on fade label
124 /// 128 ///
125 /// @param[in] scroll To enable scrolling set to true, otherwise is 129 /// @param[in] scroll To enable scrolling set to true, otherwise is
126 /// disabled 130 /// disabled
127 /// 131 ///
128 void SetScrolling(bool scroll) 132 void SetScrolling(bool scroll)
129 { 133 {
130 m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle, scroll); 134 m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle,
131 } 135 scroll);
132 //-------------------------------------------------------------------------- 136 }
137 //--------------------------------------------------------------------------
133 138
134 //========================================================================== 139 //==========================================================================
135 /// 140 ///
136 /// \ingroup cpp_kodi_gui_controls_CFadeLabel 141 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
137 /// @brief To reset al inserted labels. 142 /// @brief To reset al inserted labels.
138 /// 143 ///
139 void Reset() 144 void Reset()
140 { 145 {
141 m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle); 146 m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle);
142 } 147 }
143 //-------------------------------------------------------------------------- 148 //--------------------------------------------------------------------------
144 }; 149};
145 150
146} /* namespace controls */ 151} /* namespace controls */
147} /* namespace gui */ 152} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
index a872ab0..b4d092f 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
@@ -18,94 +18,98 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CImage Control Image
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CImage }
26/// **Window control used to show an image.**
27///
28/// The image control is used for displaying images in Kodi. You can choose
29/// the position, size, transparency and contents of the image to be displayed.
30///
31/// It has the header \ref Image.h "#include <kodi/gui/controls/Image.h>"
32/// be included to enjoy it.
33///
34/// Here you find the needed skin part for a \ref Image_Control "image control"
35///
36/// @note The call of the control is only possible from the corresponding
37/// window as its class and identification number is required.
38///
39class ATTRIBUTE_HIDDEN CImage : public CAddonGUIControlBase
40{
41public:
42 //==========================================================================
43 ///
44 /// \ingroup cpp_kodi_gui_controls_CImage
45 /// @brief Construct a new control
22 /// 46 ///
23 /// \defgroup cpp_kodi_gui_controls_CImage Control Image 47 /// @param[in] window related window control class
24 /// \ingroup cpp_kodi_gui 48 /// @param[in] controlId Used skin xml control id
25 /// @brief \cpp_class{ kodi::gui::controls::CImage } 49 ///
26 /// **Window control used to show an image.** 50 CImage(CWindow* window, int controlId) : CAddonGUIControlBase(window)
51 {
52 m_controlHandle = m_interface->kodi_gui->window->get_control_image(
53 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
54 if (!m_controlHandle)
55 kodi::Log(ADDON_LOG_FATAL,
56 "kodi::gui::controls::CImage can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
27 /// 61 ///
28 /// The image control is used for displaying images in Kodi. You can choose 62 /// \ingroup cpp_kodi_gui_controls_CImage
29 /// the position, size, transparency and contents of the image to be displayed. 63 /// @brief Destructor
30 /// 64 ///
31 /// It has the header \ref Image.h "#include <kodi/gui/controls/Image.h>" 65 ~CImage() override = default;
32 /// be included to enjoy it. 66 //--------------------------------------------------------------------------
67
68 //==========================================================================
33 /// 69 ///
34 /// Here you find the needed skin part for a \ref Image_Control "image control" 70 /// \ingroup cpp_kodi_gui_controls_CImage
71 /// @brief Set the control on window to visible
35 /// 72 ///
36 /// @note The call of the control is only possible from the corresponding 73 /// @param[in] visible If true visible, otherwise hidden
37 /// window as its class and identification number is required.
38 /// 74 ///
39 class CImage : public CAddonGUIControlBase 75 void SetVisible(bool visible)
40 { 76 {
41 public: 77 m_interface->kodi_gui->control_image->set_visible(m_interface->kodiBase, m_controlHandle,
42 //========================================================================== 78 visible);
43 /// 79 }
44 /// \ingroup cpp_kodi_gui_controls_CImage 80 //--------------------------------------------------------------------------
45 /// @brief Construct a new control
46 ///
47 /// @param[in] window related window control class
48 /// @param[in] controlId Used skin xml control id
49 ///
50 CImage(CWindow* window, int controlId)
51 : CAddonGUIControlBase(window)
52 {
53 m_controlHandle = m_interface->kodi_gui->window->get_control_image(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
54 if (!m_controlHandle)
55 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CImage can't create control class from Kodi !!!");
56 }
57 //--------------------------------------------------------------------------
58
59 //==========================================================================
60 ///
61 /// \ingroup cpp_kodi_gui_controls_CImage
62 /// @brief Destructor
63 ///
64 ~CImage() override = default;
65 //--------------------------------------------------------------------------
66
67 //==========================================================================
68 ///
69 /// \ingroup cpp_kodi_gui_controls_CImage
70 /// @brief Set the control on window to visible
71 ///
72 /// @param[in] visible If true visible, otherwise hidden
73 ///
74 void SetVisible(bool visible)
75 {
76 m_interface->kodi_gui->control_image->set_visible(m_interface->kodiBase, m_controlHandle, visible);
77 }
78 //--------------------------------------------------------------------------
79 81
80 //========================================================================== 82 //==========================================================================
81 /// 83 ///
82 /// \ingroup cpp_kodi_gui_controls_CImage 84 /// \ingroup cpp_kodi_gui_controls_CImage
83 /// @brief To set the filename used on image control. 85 /// @brief To set the filename used on image control.
84 /// 86 ///
85 /// @param[in] filename Image file to use 87 /// @param[in] filename Image file to use
86 /// @param[in] useCache To define storage of image, default is 88 /// @param[in] useCache To define storage of image, default is
87 /// in cache, if false becomes it loaded 89 /// in cache, if false becomes it loaded
88 /// always on changes again 90 /// always on changes again
89 /// 91 ///
90 void SetFileName(const std::string& filename, bool useCache = true) 92 void SetFileName(const std::string& filename, bool useCache = true)
91 { 93 {
92 m_interface->kodi_gui->control_image->set_filename(m_interface->kodiBase, m_controlHandle, filename.c_str(), useCache); 94 m_interface->kodi_gui->control_image->set_filename(m_interface->kodiBase, m_controlHandle,
93 } 95 filename.c_str(), useCache);
94 //-------------------------------------------------------------------------- 96 }
97 //--------------------------------------------------------------------------
95 98
96 //========================================================================== 99 //==========================================================================
97 /// 100 ///
98 /// \ingroup cpp_kodi_gui_controls_CImage 101 /// \ingroup cpp_kodi_gui_controls_CImage
99 /// @brief To set set the diffuse color on image. 102 /// @brief To set set the diffuse color on image.
100 /// 103 ///
101 /// @param[in] colorDiffuse Color to use for diffuse 104 /// @param[in] colorDiffuse Color to use for diffuse
102 /// 105 ///
103 void SetColorDiffuse(uint32_t colorDiffuse) 106 void SetColorDiffuse(uint32_t colorDiffuse)
104 { 107 {
105 m_interface->kodi_gui->control_image->set_color_diffuse(m_interface->kodiBase, m_controlHandle, colorDiffuse); 108 m_interface->kodi_gui->control_image->set_color_diffuse(m_interface->kodiBase, m_controlHandle,
106 } 109 colorDiffuse);
107 //-------------------------------------------------------------------------- 110 }
108 }; 111 //--------------------------------------------------------------------------
112};
109 113
110} /* namespace controls */ 114} /* namespace controls */
111} /* namespace gui */ 115} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
index eecfd8b..82604bd 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
@@ -18,99 +18,103 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CLabel Control Label
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CLabel }
26/// **Window control used to show some lines of text.**
27///
28/// The label control is used for displaying text in Kodi. You can choose
29/// the font, size, colour, location and contents of the text to be displayed.
30///
31/// It has the header \ref Label.h "#include <kodi/gui/controls/Label.h>"
32/// be included to enjoy it.
33///
34/// Here you find the needed skin part for a \ref Label_Control "label control"
35///
36/// @note The call of the control is only possible from the corresponding
37/// window as its class and identification number is required.
38///
39class ATTRIBUTE_HIDDEN CLabel : public CAddonGUIControlBase
40{
41public:
42 //==========================================================================
43 ///
44 /// \ingroup cpp_kodi_gui_controls_CLabel
45 /// @brief Construct a new control
46 ///
47 /// @param[in] window related window control class
48 /// @param[in] controlId Used skin xml control id
22 /// 49 ///
23 /// \defgroup cpp_kodi_gui_controls_CLabel Control Label 50 CLabel(CWindow* window, int controlId) : CAddonGUIControlBase(window)
24 /// \ingroup cpp_kodi_gui 51 {
25 /// @brief \cpp_class{ kodi::gui::controls::CLabel } 52 m_controlHandle = m_interface->kodi_gui->window->get_control_label(
26 /// **Window control used to show some lines of text.** 53 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
54 if (!m_controlHandle)
55 kodi::Log(ADDON_LOG_FATAL,
56 "kodi::gui::controls::CLabel can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
27 /// 61 ///
28 /// The label control is used for displaying text in Kodi. You can choose 62 /// \ingroup cpp_kodi_gui_controls_CLabel
29 /// the font, size, colour, location and contents of the text to be displayed. 63 /// @brief Destructor
30 /// 64 ///
31 /// It has the header \ref Label.h "#include <kodi/gui/controls/Label.h>" 65 ~CLabel() override = default;
32 /// be included to enjoy it. 66 //--------------------------------------------------------------------------
67
68 //==========================================================================
33 /// 69 ///
34 /// Here you find the needed skin part for a \ref Label_Control "label control" 70 /// \ingroup cpp_kodi_gui_controls_CLabel
71 /// @brief Set the control on window to visible
35 /// 72 ///
36 /// @note The call of the control is only possible from the corresponding 73 /// @param[in] visible If true visible, otherwise hidden
37 /// window as its class and identification number is required.
38 /// 74 ///
39 class CLabel : public CAddonGUIControlBase 75 void SetVisible(bool visible)
40 { 76 {
41 public: 77 m_interface->kodi_gui->control_label->set_visible(m_interface->kodiBase, m_controlHandle,
42 //========================================================================== 78 visible);
43 /// 79 }
44 /// \ingroup cpp_kodi_gui_controls_CLabel 80 //--------------------------------------------------------------------------
45 /// @brief Construct a new control
46 ///
47 /// @param[in] window related window control class
48 /// @param[in] controlId Used skin xml control id
49 ///
50 CLabel(CWindow* window, int controlId)
51 : CAddonGUIControlBase(window)
52 {
53 m_controlHandle = m_interface->kodi_gui->window->get_control_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
54 if (!m_controlHandle)
55 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CLabel can't create control class from Kodi !!!");
56 }
57 //--------------------------------------------------------------------------
58
59 //==========================================================================
60 ///
61 /// \ingroup cpp_kodi_gui_controls_CLabel
62 /// @brief Destructor
63 ///
64 ~CLabel() override = default;
65 //--------------------------------------------------------------------------
66
67 //==========================================================================
68 ///
69 /// \ingroup cpp_kodi_gui_controls_CLabel
70 /// @brief Set the control on window to visible
71 ///
72 /// @param[in] visible If true visible, otherwise hidden
73 ///
74 void SetVisible(bool visible)
75 {
76 m_interface->kodi_gui->control_label->set_visible(m_interface->kodiBase, m_controlHandle, visible);
77 }
78 //--------------------------------------------------------------------------
79 81
80 //========================================================================== 82 //==========================================================================
81 /// 83 ///
82 /// \ingroup cpp_kodi_gui_controls_CLabel 84 /// \ingroup cpp_kodi_gui_controls_CLabel
83 /// @brief To set the text string on label 85 /// @brief To set the text string on label
84 /// 86 ///
85 /// @param[in] text Text to show 87 /// @param[in] text Text to show
86 /// 88 ///
87 void SetLabel(const std::string& text) 89 void SetLabel(const std::string& text)
88 { 90 {
89 m_interface->kodi_gui->control_label->set_label(m_interface->kodiBase, m_controlHandle, text.c_str()); 91 m_interface->kodi_gui->control_label->set_label(m_interface->kodiBase, m_controlHandle,
90 } 92 text.c_str());
91 //-------------------------------------------------------------------------- 93 }
94 //--------------------------------------------------------------------------
92 95
93 //========================================================================== 96 //==========================================================================
94 /// 97 ///
95 /// \ingroup cpp_kodi_gui_controls_CLabel 98 /// \ingroup cpp_kodi_gui_controls_CLabel
96 /// @brief Get the used text from control 99 /// @brief Get the used text from control
97 /// 100 ///
98 /// @return Used text on label control 101 /// @return Used text on label control
99 /// 102 ///
100 std::string GetLabel() const 103 std::string GetLabel() const
104 {
105 std::string label;
106 char* ret =
107 m_interface->kodi_gui->control_label->get_label(m_interface->kodiBase, m_controlHandle);
108 if (ret != nullptr)
101 { 109 {
102 std::string label; 110 if (std::strlen(ret))
103 char* ret = m_interface->kodi_gui->control_label->get_label(m_interface->kodiBase, m_controlHandle); 111 label = ret;
104 if (ret != nullptr) 112 m_interface->free_string(m_interface->kodiBase, ret);
105 {
106 if (std::strlen(ret))
107 label = ret;
108 m_interface->free_string(m_interface->kodiBase, ret);
109 }
110 return label;
111 } 113 }
112 //-------------------------------------------------------------------------- 114 return label;
113 }; 115 }
116 //--------------------------------------------------------------------------
117};
114 118
115} /* namespace controls */ 119} /* namespace controls */
116} /* namespace gui */ 120} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
index 78880c4..8cb582b 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
@@ -18,92 +18,96 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CProgress Control Progress
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CProgress }
26/// **Window control to show the progress of a particular operation**
27///
28/// The progress control is used to show the progress of an item that may take
29/// a long time, or to show how far through a movie you are. You can choose
30/// the position, size, and look of the progress control.
31///
32/// It has the header \ref Progress.h "#include <kodi/gui/controls/Progress.h>"
33/// be included to enjoy it.
34///
35/// Here you find the needed skin part for a \ref Progress_Control "progress control"
36///
37/// @note The call of the control is only possible from the corresponding
38/// window as its class and identification number is required.
39///
40class ATTRIBUTE_HIDDEN CProgress : public CAddonGUIControlBase
41{
42public:
43 //==========================================================================
44 ///
45 /// \ingroup cpp_kodi_gui_controls_CProgress
46 /// @brief Construct a new control
22 /// 47 ///
23 /// \defgroup cpp_kodi_gui_controls_CProgress Control Progress 48 /// @param[in] window related window control class
24 /// \ingroup cpp_kodi_gui 49 /// @param[in] controlId Used skin xml control id
25 /// @brief \cpp_class{ kodi::gui::controls::CProgress } 50 ///
26 /// **Window control to show the progress of a particular operation** 51 CProgress(CWindow* window, int controlId) : CAddonGUIControlBase(window)
52 {
53 m_controlHandle = m_interface->kodi_gui->window->get_control_progress(
54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL,
57 "kodi::gui::controls::CProgress can't create control class from Kodi !!!");
58 }
59 //--------------------------------------------------------------------------
60
61 //==========================================================================
27 /// 62 ///
28 /// The progress control is used to show the progress of an item that may take 63 /// \ingroup cpp_kodi_gui_controls_CProgress
29 /// a long time, or to show how far through a movie you are. You can choose 64 /// @brief Destructor
30 /// the position, size, and look of the progress control.
31 /// 65 ///
32 /// It has the header \ref Progress.h "#include <kodi/gui/controls/Progress.h>" 66 ~CProgress() override = default;
33 /// be included to enjoy it. 67 //--------------------------------------------------------------------------
68
69 //==========================================================================
34 /// 70 ///
35 /// Here you find the needed skin part for a \ref Progress_Control "progress control" 71 /// \ingroup cpp_kodi_gui_controls_CProgress
72 /// @brief Set the control on window to visible
36 /// 73 ///
37 /// @note The call of the control is only possible from the corresponding 74 /// @param[in] visible If true visible, otherwise hidden
38 /// window as its class and identification number is required.
39 /// 75 ///
40 class CProgress : public CAddonGUIControlBase 76 void SetVisible(bool visible)
41 { 77 {
42 public: 78 m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle,
43 //========================================================================== 79 visible);
44 /// 80 }
45 /// \ingroup cpp_kodi_gui_controls_CProgress 81 //--------------------------------------------------------------------------
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
50 ///
51 CProgress(CWindow* window, int controlId)
52 : CAddonGUIControlBase(window)
53 {
54 m_controlHandle = m_interface->kodi_gui->window->get_control_progress(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CProgress can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
61 ///
62 /// \ingroup cpp_kodi_gui_controls_CProgress
63 /// @brief Destructor
64 ///
65 ~CProgress() override = default;
66 //--------------------------------------------------------------------------
67
68 //==========================================================================
69 ///
70 /// \ingroup cpp_kodi_gui_controls_CProgress
71 /// @brief Set the control on window to visible
72 ///
73 /// @param[in] visible If true visible, otherwise hidden
74 ///
75 void SetVisible(bool visible)
76 {
77 m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle, visible);
78 }
79 //--------------------------------------------------------------------------
80 82
81 //========================================================================== 83 //==========================================================================
82 /// 84 ///
83 /// \ingroup cpp_kodi_gui_controls_CProgress 85 /// \ingroup cpp_kodi_gui_controls_CProgress
84 /// @brief To set Percent position of control 86 /// @brief To set Percent position of control
85 /// 87 ///
86 /// @param[in] percent The percent position to use 88 /// @param[in] percent The percent position to use
87 /// 89 ///
88 void SetPercentage(float percent) 90 void SetPercentage(float percent)
89 { 91 {
90 m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle, percent); 92 m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle,
91 } 93 percent);
92 //-------------------------------------------------------------------------- 94 }
95 //--------------------------------------------------------------------------
93 96
94 //========================================================================== 97 //==========================================================================
95 /// 98 ///
96 /// \ingroup cpp_kodi_gui_controls_CProgress 99 /// \ingroup cpp_kodi_gui_controls_CProgress
97 /// @brief Get the active percent position of progress bar 100 /// @brief Get the active percent position of progress bar
98 /// 101 ///
99 /// @return Progress position as percent 102 /// @return Progress position as percent
100 /// 103 ///
101 float GetPercentage() const 104 float GetPercentage() const
102 { 105 {
103 return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase, m_controlHandle); 106 return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase,
104 } 107 m_controlHandle);
105 //-------------------------------------------------------------------------- 108 }
106 }; 109 //--------------------------------------------------------------------------
110};
107 111
108} /* namespace controls */ 112} /* namespace controls */
109} /* namespace gui */ 113} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
index 1721759..305195d 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
@@ -18,142 +18,149 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CRadioButton }
26/// **Window control for a radio button (as used for on/off settings)**
27///
28/// The radio button control is used for creating push button on/off settings
29/// in Kodi. You can choose the position, size, and look of the button. When
30/// the user clicks on the radio button, the state will change, toggling the
31/// extra textures (textureradioon and textureradiooff). Used for settings
32/// controls.
33///
34/// It has the header \ref RadioButton.h "#include <kodi/gui/controls/RadioButton.h>"
35/// be included to enjoy it.
36///
37/// Here you find the needed skin part for a \ref Radio_button_control "radio button control"
38///
39/// @note The call of the control is only possible from the corresponding
40/// window as its class and identification number is required.
41///
42class ATTRIBUTE_HIDDEN CRadioButton : public CAddonGUIControlBase
43{
44public:
45 //==========================================================================
46 ///
47 /// \ingroup cpp_kodi_gui_controls_CRadioButton
48 /// @brief Construct a new control
49 ///
50 /// @param[in] window related window control class
51 /// @param[in] controlId Used skin xml control id
22 /// 52 ///
23 /// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button 53 CRadioButton(CWindow* window, int controlId) : CAddonGUIControlBase(window)
24 /// \ingroup cpp_kodi_gui 54 {
25 /// @brief \cpp_class{ kodi::gui::controls::CRadioButton } 55 m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button(
26 /// **Window control for a radio button (as used for on/off settings)** 56 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
57 if (!m_controlHandle)
58 kodi::Log(ADDON_LOG_FATAL,
59 "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!");
60 }
61 //--------------------------------------------------------------------------
62
63 //==========================================================================
27 /// 64 ///
28 /// The radio button control is used for creating push button on/off settings 65 /// \ingroup cpp_kodi_gui_controls_CRadioButton
29 /// in Kodi. You can choose the position, size, and look of the button. When 66 /// @brief Destructor
30 /// the user clicks on the radio button, the state will change, toggling the
31 /// extra textures (textureradioon and textureradiooff). Used for settings
32 /// controls.
33 /// 67 ///
34 /// It has the header \ref RadioButton.h "#include <kodi/gui/controls/RadioButton.h>" 68 ~CRadioButton() override = default;
35 /// be included to enjoy it. 69 //--------------------------------------------------------------------------
70
71 //==========================================================================
36 /// 72 ///
37 /// Here you find the needed skin part for a \ref Radio_button_control "radio button control" 73 /// \ingroup cpp_kodi_gui_controls_CRadioButton
74 /// @brief Set the control on window to visible
38 /// 75 ///
39 /// @note The call of the control is only possible from the corresponding 76 /// @param[in] visible If true visible, otherwise hidden
40 /// window as its class and identification number is required.
41 /// 77 ///
42 class CRadioButton : public CAddonGUIControlBase 78 void SetVisible(bool visible)
43 { 79 {
44 public: 80 m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle,
45 //========================================================================== 81 visible);
46 /// 82 }
47 /// \ingroup cpp_kodi_gui_controls_CRadioButton 83 //--------------------------------------------------------------------------
48 /// @brief Construct a new control
49 ///
50 /// @param[in] window related window control class
51 /// @param[in] controlId Used skin xml control id
52 ///
53 CRadioButton(CWindow* window, int controlId)
54 : CAddonGUIControlBase(window)
55 {
56 m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
57 if (!m_controlHandle)
58 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!");
59 }
60 //--------------------------------------------------------------------------
61
62 //==========================================================================
63 ///
64 /// \ingroup cpp_kodi_gui_controls_CRadioButton
65 /// @brief Destructor
66 ///
67 ~CRadioButton() override = default;
68 //--------------------------------------------------------------------------
69
70 //==========================================================================
71 ///
72 /// \ingroup cpp_kodi_gui_controls_CRadioButton
73 /// @brief Set the control on window to visible
74 ///
75 /// @param[in] visible If true visible, otherwise hidden
76 ///
77 void SetVisible(bool visible)
78 {
79 m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle, visible);
80 }
81 //--------------------------------------------------------------------------
82 84
83 //========================================================================== 85 //==========================================================================
84 /// 86 ///
85 /// \ingroup cpp_kodi_gui_controls_CRadioButton 87 /// \ingroup cpp_kodi_gui_controls_CRadioButton
86 /// @brief Set's the control's enabled/disabled state 88 /// @brief Set's the control's enabled/disabled state
87 /// 89 ///
88 /// @param[in] enabled If true enabled, otherwise disabled 90 /// @param[in] enabled If true enabled, otherwise disabled
89 /// 91 ///
90 void SetEnabled(bool enabled) 92 void SetEnabled(bool enabled)
91 { 93 {
92 m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled); 94 m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle,
93 } 95 enabled);
94 //-------------------------------------------------------------------------- 96 }
97 //--------------------------------------------------------------------------
95 98
96 //========================================================================== 99 //==========================================================================
97 /// 100 ///
98 /// \ingroup cpp_kodi_gui_controls_CRadioButton 101 /// \ingroup cpp_kodi_gui_controls_CRadioButton
99 /// @brief To set the text string on radio button 102 /// @brief To set the text string on radio button
100 /// 103 ///
101 /// @param[in] label Text to show 104 /// @param[in] label Text to show
102 /// 105 ///
103 void SetLabel(const std::string& label) 106 void SetLabel(const std::string& label)
104 { 107 {
105 m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str()); 108 m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle,
106 } 109 label.c_str());
107 //-------------------------------------------------------------------------- 110 }
111 //--------------------------------------------------------------------------
108 112
109 //========================================================================== 113 //==========================================================================
110 /// 114 ///
111 /// \ingroup cpp_kodi_gui_controls_CRadioButton 115 /// \ingroup cpp_kodi_gui_controls_CRadioButton
112 /// @brief Get the used text from control 116 /// @brief Get the used text from control
113 /// 117 ///
114 /// @return Text shown 118 /// @return Text shown
115 /// 119 ///
116 std::string GetLabel() const 120 std::string GetLabel() const
121 {
122 std::string label;
123 char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase,
124 m_controlHandle);
125 if (ret != nullptr)
117 { 126 {
118 std::string label; 127 if (std::strlen(ret))
119 char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase, m_controlHandle); 128 label = ret;
120 if (ret != nullptr) 129 m_interface->free_string(m_interface->kodiBase, ret);
121 {
122 if (std::strlen(ret))
123 label = ret;
124 m_interface->free_string(m_interface->kodiBase, ret);
125 }
126 return label;
127 } 130 }
128 //-------------------------------------------------------------------------- 131 return label;
132 }
133 //--------------------------------------------------------------------------
129 134
130 //========================================================================== 135 //==========================================================================
131 /// 136 ///
132 /// \ingroup cpp_kodi_gui_controls_CRadioButton 137 /// \ingroup cpp_kodi_gui_controls_CRadioButton
133 /// @brief To set radio button condition to on or off 138 /// @brief To set radio button condition to on or off
134 /// 139 ///
135 /// @param[in] selected true set radio button to selection on, otherwise 140 /// @param[in] selected true set radio button to selection on, otherwise
136 /// off 141 /// off
137 /// 142 ///
138 void SetSelected(bool selected) 143 void SetSelected(bool selected)
139 { 144 {
140 m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase, m_controlHandle, selected); 145 m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase,
141 } 146 m_controlHandle, selected);
142 //-------------------------------------------------------------------------- 147 }
148 //--------------------------------------------------------------------------
143 149
144 //========================================================================== 150 //==========================================================================
145 /// 151 ///
146 /// \ingroup cpp_kodi_gui_controls_CRadioButton 152 /// \ingroup cpp_kodi_gui_controls_CRadioButton
147 /// @brief Get the current selected condition of radio button 153 /// @brief Get the current selected condition of radio button
148 /// 154 ///
149 /// @return Selected condition 155 /// @return Selected condition
150 /// 156 ///
151 bool IsSelected() const 157 bool IsSelected() const
152 { 158 {
153 return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase, m_controlHandle); 159 return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase,
154 } 160 m_controlHandle);
155 //-------------------------------------------------------------------------- 161 }
156 }; 162 //--------------------------------------------------------------------------
163};
157 164
158} /* namespace controls */ 165} /* namespace controls */
159} /* namespace gui */ 166} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
index b3dadcd..7cc9b24 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
@@ -10,6 +10,7 @@
10 10
11#include "../../AddonBase.h" 11#include "../../AddonBase.h"
12#include "../Window.h" 12#include "../Window.h"
13#include "../renderHelper.h"
13 14
14namespace kodi 15namespace kodi
15{ 16{
@@ -18,186 +19,186 @@ namespace gui
18namespace controls 19namespace controls
19{ 20{
20 21
21 //============================================================================ 22//============================================================================
23///
24/// \defgroup cpp_kodi_gui_controls_CRendering Control Rendering
25/// \ingroup cpp_kodi_gui
26/// @brief \cpp_class{ kodi::gui::controls::CRendering }
27/// **Window control for rendering own parts**
28///
29/// This rendering control is used when own parts are needed. You have the
30/// control over them to render direct OpenGL or DirectX content to the
31/// screen set by the size of them.
32///
33/// Alternative can be the virtual functions from t his been ignored if the
34/// callbacks are defined by the \ref CRendering_SetIndependentCallbacks function and
35/// class is used as single and not as a parent class.
36///
37/// It has the header \ref Rendering.h "#include <kodi/gui/controls/Rendering.h>"
38/// be included to enjoy it.
39///
40/// Here you find the needed skin part for a \ref Addon_Rendering_control "rendering control"
41///
42/// @note The call of the control is only possible from the corresponding
43/// window as its class and identification number is required.
44///
45
46//============================================================================
47///
48/// \defgroup cpp_kodi_gui_controls_CRendering_Defs Definitions, structures and enumerators
49/// \ingroup cpp_kodi_gui_controls_CRendering
50/// @brief **Library definition values**
51///
52
53class ATTRIBUTE_HIDDEN CRendering : public CAddonGUIControlBase
54{
55public:
56 //==========================================================================
57 ///
58 /// \ingroup cpp_kodi_gui_controls_CRendering
59 /// @brief Construct a new control
60 ///
61 /// @param[in] window related window control class
62 /// @param[in] controlId Used skin xml control id
63 ///
64 CRendering(CWindow* window, int controlId) : CAddonGUIControlBase(window)
65 {
66 m_controlHandle = m_interface->kodi_gui->window->get_control_render_addon(
67 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
68 if (m_controlHandle)
69 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase,
70 m_controlHandle, this, OnCreateCB,
71 OnRenderCB, OnStopCB, OnDirtyCB);
72 else
73 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::%s can't create control class from Kodi !!!",
74 __FUNCTION__);
75 }
76 //--------------------------------------------------------------------------
77
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CRendering
81 /// @brief Destructor
82 ///
83 ~CRendering() override
84 {
85 m_interface->kodi_gui->control_rendering->destroy(m_interface->kodiBase, m_controlHandle);
86 }
87 //--------------------------------------------------------------------------
88
89 //==========================================================================
22 /// 90 ///
23 /// \defgroup cpp_kodi_gui_controls_CRendering Control Rendering 91 /// \ingroup cpp_kodi_gui_controls_CRendering
24 /// \ingroup cpp_kodi_gui 92 /// @brief To create rendering control on Add-on
25 /// @brief \cpp_class{ kodi::gui::controls::CRendering }
26 /// **Window control for rendering own parts**
27 /// 93 ///
28 /// This rendering control is used when own parts are needed. You have the 94 /// Function creates the needed rendering control for Kodi which becomes
29 /// control over them to render direct OpenGL or DirectX content to the 95 /// handled and processed from Add-on
30 /// screen set by the size of them.
31 /// 96 ///
32 /// Alternative can be the virtual functions from t his been ignored if the 97 /// @note This is callback function from Kodi to Add-on and not to use
33 /// callbacks are defined by the \ref CRendering_SetIndependentCallbacks function and 98 /// for calls from add-on to this function.
34 /// class is used as single and not as a parent class.
35 /// 99 ///
36 /// It has the header \ref Rendering.h "#include <kodi/gui/controls/Rendering.h>" 100 /// @param[in] x Horizontal position
37 /// be included to enjoy it. 101 /// @param[in] y Vertical position
102 /// @param[in] w Width of control
103 /// @param[in] h Height of control
104 /// @param[in] device The device to use. For OpenGL is empty
105 /// on Direct X is the needed device send.
106 /// @return Add-on needs to return true if successed,
107 /// otherwise false.
38 /// 108 ///
39 /// Here you find the needed skin part for a \ref Addon_Rendering_control "rendering control" 109 virtual bool Create(int x, int y, int w, int h, void* device) { return false; }
110 //--------------------------------------------------------------------------
111
112 //==========================================================================
113 ///
114 /// \ingroup cpp_kodi_gui_controls_CRendering
115 /// @brief Render process call from Kodi
40 /// 116 ///
41 /// @note The call of the control is only possible from the corresponding 117 /// @note This is callback function from Kodi to Add-on and not to use
42 /// window as its class and identification number is required. 118 /// for calls from add-on to this function.
43 /// 119 ///
120 virtual void Render() {}
121 //--------------------------------------------------------------------------
44 122
45 //============================================================================ 123 //==========================================================================
46 /// 124 ///
47 /// \defgroup cpp_kodi_gui_controls_CRendering_Defs Definitions, structures and enumerators
48 /// \ingroup cpp_kodi_gui_controls_CRendering 125 /// \ingroup cpp_kodi_gui_controls_CRendering
49 /// @brief **Library definition values** 126 /// @brief Call from Kodi to stop rendering process
50 /// 127 ///
128 /// @note This is callback function from Kodi to Add-on and not to use
129 /// for calls from add-on to this function.
130 ///
131 virtual void Stop() {}
132 //--------------------------------------------------------------------------
51 133
52 class CRendering : public CAddonGUIControlBase 134 //==========================================================================
135 ///
136 /// \ingroup cpp_kodi_gui_controls_CRendering
137 /// @brief Call from Kodi where add-on becomes asked about dirty rendering
138 /// region.
139 ///
140 /// @note This is callback function from Kodi to Add-on and not to use
141 /// for calls from add-on to this function.
142 ///
143 virtual bool Dirty() { return false; }
144 //--------------------------------------------------------------------------
145
146 //==========================================================================
147 ///
148 /// \ingroup cpp_kodi_gui_controls_CRendering
149 /// \anchor CRendering_SetIndependentCallbacks
150 /// @brief If the class is used independent (with "new CRendering")
151 /// and not as parent (with "cCLASS_own : CRendering") from own must
152 /// be the callback from Kodi to add-on overdriven with own functions!
153 ///
154 void SetIndependentCallbacks(
155 GUIHANDLE cbhdl,
156 bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void* device),
157 void (*CBRender)(GUIHANDLE cbhdl),
158 void (*CBStop)(GUIHANDLE cbhdl),
159 bool (*CBDirty)(GUIHANDLE cbhdl))
53 { 160 {
54 public: 161 if (!cbhdl || !CBCreate || !CBRender || !CBStop || !CBDirty)
55 //==========================================================================
56 ///
57 /// \ingroup cpp_kodi_gui_controls_CRendering
58 /// @brief Construct a new control
59 ///
60 /// @param[in] window related window control class
61 /// @param[in] controlId Used skin xml control id
62 ///
63 CRendering(CWindow* window, int controlId)
64 : CAddonGUIControlBase(window)
65 {
66 m_controlHandle = m_interface->kodi_gui->window->get_control_render_addon(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
67 if (m_controlHandle)
68 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, m_controlHandle, this,
69 OnCreateCB, OnRenderCB, OnStopCB, OnDirtyCB);
70 else
71 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::%s can't create control class from Kodi !!!", __FUNCTION__);
72 }
73 //--------------------------------------------------------------------------
74
75 //==========================================================================
76 ///
77 /// \ingroup cpp_kodi_gui_controls_CRendering
78 /// @brief Destructor
79 ///
80 ~CRendering() override
81 {
82 m_interface->kodi_gui->control_rendering->destroy(m_interface->kodiBase, m_controlHandle);
83 }
84 //--------------------------------------------------------------------------
85
86 //==========================================================================
87 ///
88 /// \ingroup cpp_kodi_gui_controls_CRendering
89 /// @brief To create rendering control on Add-on
90 ///
91 /// Function creates the needed rendering control for Kodi which becomes
92 /// handled and processed from Add-on
93 ///
94 /// @note This is callback function from Kodi to Add-on and not to use
95 /// for calls from add-on to this function.
96 ///
97 /// @param[in] x Horizontal position
98 /// @param[in] y Vertical position
99 /// @param[in] w Width of control
100 /// @param[in] h Height of control
101 /// @param[in] device The device to use. For OpenGL is empty
102 /// on Direct X is the needed device send.
103 /// @return Add-on needs to return true if successed,
104 /// otherwise false.
105 ///
106 virtual bool Create(int x, int y, int w, int h, void* device) { return false; }
107 //--------------------------------------------------------------------------
108
109 //==========================================================================
110 ///
111 /// \ingroup cpp_kodi_gui_controls_CRendering
112 /// @brief Render process call from Kodi
113 ///
114 /// @note This is callback function from Kodi to Add-on and not to use
115 /// for calls from add-on to this function.
116 ///
117 virtual void Render() { }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CRendering
123 /// @brief Call from Kodi to stop rendering process
124 ///
125 /// @note This is callback function from Kodi to Add-on and not to use
126 /// for calls from add-on to this function.
127 ///
128 virtual void Stop() { }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CRendering
134 /// @brief Call from Kodi where add-on becomes asked about dirty rendering
135 /// region.
136 ///
137 /// @note This is callback function from Kodi to Add-on and not to use
138 /// for calls from add-on to this function.
139 ///
140 virtual bool Dirty() { return false; }
141 //--------------------------------------------------------------------------
142
143 //==========================================================================
144 ///
145 /// \ingroup cpp_kodi_gui_controls_CRendering
146 /// \anchor CRendering_SetIndependentCallbacks
147 /// @brief If the class is used independent (with "new CRendering")
148 /// and not as parent (with "cCLASS_own : CRendering") from own must
149 /// be the callback from Kodi to add-on overdriven with own functions!
150 ///
151 void SetIndependentCallbacks(
152 GUIHANDLE cbhdl,
153 bool (*CBCreate)(GUIHANDLE cbhdl,
154 int x,
155 int y,
156 int w,
157 int h,
158 void* device),
159 void (*CBRender)(GUIHANDLE cbhdl),
160 void (*CBStop) (GUIHANDLE cbhdl),
161 bool (*CBDirty) (GUIHANDLE cbhdl))
162 {
163 if (!cbhdl ||
164 !CBCreate || !CBRender || !CBStop || !CBDirty)
165 {
166 kodi::Log(ADDON_LOG_ERROR, "kodi::gui::controls::%s called with nullptr !!!", __FUNCTION__);
167 return;
168 }
169
170 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, m_controlHandle, cbhdl,
171 CBCreate, CBRender, CBStop, CBDirty);
172 }
173 //--------------------------------------------------------------------------
174
175 private:
176 /*
177 * Defined callback functions from Kodi to add-on, for use in parent / child system
178 * (is private)!
179 */
180 static bool OnCreateCB(void* cbhdl, int x, int y, int w, int h, void* device)
181 { 162 {
182 return static_cast<CRendering*>(cbhdl)->Create(x, y, w, h, device); 163 kodi::Log(ADDON_LOG_ERROR, "kodi::gui::controls::%s called with nullptr !!!", __FUNCTION__);
164 return;
183 } 165 }
184 166
185 static void OnRenderCB(void* cbhdl) 167 m_interface->kodi_gui->control_rendering->set_callbacks(
186 { 168 m_interface->kodiBase, m_controlHandle, cbhdl, CBCreate, CBRender, CBStop, CBDirty);
187 static_cast<CRendering*>(cbhdl)->Render(); 169 }
188 } 170 //--------------------------------------------------------------------------
171
172private:
173 /*
174 * Defined callback functions from Kodi to add-on, for use in parent / child system
175 * (is private)!
176 */
177 static bool OnCreateCB(void* cbhdl, int x, int y, int w, int h, void* device)
178 {
179 static_cast<CRendering*>(cbhdl)->m_renderHelper = kodi::gui::GetRenderHelper();
180 return static_cast<CRendering*>(cbhdl)->Create(x, y, w, h, device);
181 }
189 182
190 static void OnStopCB(void* cbhdl) 183 static void OnRenderCB(void* cbhdl)
191 { 184 {
192 static_cast<CRendering*>(cbhdl)->Stop(); 185 if (!static_cast<CRendering*>(cbhdl)->m_renderHelper)
193 } 186 return;
187 static_cast<CRendering*>(cbhdl)->m_renderHelper->Begin();
188 static_cast<CRendering*>(cbhdl)->Render();
189 static_cast<CRendering*>(cbhdl)->m_renderHelper->End();
190 }
191
192 static void OnStopCB(void* cbhdl)
193 {
194 static_cast<CRendering*>(cbhdl)->Stop();
195 static_cast<CRendering*>(cbhdl)->m_renderHelper = nullptr;
196 }
194 197
195 static bool OnDirtyCB(void* cbhdl) 198 static bool OnDirtyCB(void* cbhdl) { return static_cast<CRendering*>(cbhdl)->Dirty(); }
196 {
197 return static_cast<CRendering*>(cbhdl)->Dirty();
198 }
199 199
200 }; 200 std::shared_ptr<kodi::gui::IRenderHelper> m_renderHelper;
201};
201 202
202} /* namespace controls */ 203} /* namespace controls */
203} /* namespace gui */ 204} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
index 4f97ba5..76a02aa 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
@@ -18,294 +18,308 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CSettingsSlider Control Settings Slider
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CSettingsSlider }
26/// **Window control for moveable slider with text name**
27///
28/// The settings slider control is used in the settings screens for when an
29/// option is best specified on a sliding scale. You can choose the position,
30/// size, and look of the slider control. It is basically a cross between the
31/// button control and a slider control. It has a label and focus and non
32/// focus textures, as well as a slider control on the right.
33///
34/// It has the header \ref SettingsSlider.h "#include <kodi/gui/controls/SettingsSlider.h>"
35/// be included to enjoy it.
36///
37/// Here you find the needed skin part for a \ref Settings_Slider_Control "settings slider control"
38///
39/// @note The call of the control is only possible from the corresponding
40/// window as its class and identification number is required.
41///
42class ATTRIBUTE_HIDDEN CSettingsSlider : public CAddonGUIControlBase
43{
44public:
45 //==========================================================================
22 /// 46 ///
23 /// \defgroup cpp_kodi_gui_controls_CSettingsSlider Control Settings Slider 47 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
24 /// \ingroup cpp_kodi_gui 48 /// @brief Construct a new control
25 /// @brief \cpp_class{ kodi::gui::controls::CSettingsSlider }
26 /// **Window control for moveable slider with text name**
27 /// 49 ///
28 /// The settings slider control is used in the settings screens for when an 50 /// @param[in] window related window control class
29 /// option is best specified on a sliding scale. You can choose the position, 51 /// @param[in] controlId Used skin xml control id
30 /// size, and look of the slider control. It is basically a cross between the
31 /// button control and a slider control. It has a label and focus and non
32 /// focus textures, as well as a slider control on the right.
33 /// 52 ///
34 /// It has the header \ref SettingsSlider.h "#include <kodi/gui/controls/SettingsSlider.h>" 53 CSettingsSlider(CWindow* window, int controlId) : CAddonGUIControlBase(window)
35 /// be included to enjoy it. 54 {
55 m_controlHandle = m_interface->kodi_gui->window->get_control_settings_slider(
56 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
57 if (!m_controlHandle)
58 kodi::Log(ADDON_LOG_FATAL,
59 "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!");
60 }
61 //--------------------------------------------------------------------------
62
63 //==========================================================================
36 /// 64 ///
37 /// Here you find the needed skin part for a \ref Settings_Slider_Control "settings slider control" 65 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
66 /// @brief Destructor
67 ///
68 ~CSettingsSlider() override = default;
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
38 /// 72 ///
39 /// @note The call of the control is only possible from the corresponding 73 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
40 /// window as its class and identification number is required. 74 /// @brief Set the control on window to visible
41 /// 75 ///
42 class CSettingsSlider : public CAddonGUIControlBase 76 /// @param[in] visible If true visible, otherwise hidden
77 ///
78 void SetVisible(bool visible)
43 { 79 {
44 public: 80 m_interface->kodi_gui->control_settings_slider->set_visible(m_interface->kodiBase,
45 //========================================================================== 81 m_controlHandle, visible);
46 /// 82 }
47 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 83 //--------------------------------------------------------------------------
48 /// @brief Construct a new control
49 ///
50 /// @param[in] window related window control class
51 /// @param[in] controlId Used skin xml control id
52 ///
53 CSettingsSlider(CWindow* window, int controlId)
54 : CAddonGUIControlBase(window)
55 {
56 m_controlHandle = m_interface->kodi_gui->window->get_control_settings_slider(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
57 if (!m_controlHandle)
58 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!");
59 }
60 //--------------------------------------------------------------------------
61
62 //==========================================================================
63 ///
64 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
65 /// @brief Destructor
66 ///
67 ~CSettingsSlider() override = default;
68 //--------------------------------------------------------------------------
69 84
70 //========================================================================== 85 //==========================================================================
71 /// 86 ///
72 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 87 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
73 /// @brief Set the control on window to visible 88 /// @brief Set's the control's enabled/disabled state
74 /// 89 ///
75 /// @param[in] visible If true visible, otherwise hidden 90 /// @param[in] enabled If true enabled, otherwise disabled
76 /// 91 ///
77 void SetVisible(bool visible) 92 void SetEnabled(bool enabled)
78 { 93 {
79 m_interface->kodi_gui->control_settings_slider->set_visible(m_interface->kodiBase, m_controlHandle, visible); 94 m_interface->kodi_gui->control_settings_slider->set_enabled(m_interface->kodiBase,
80 } 95 m_controlHandle, enabled);
81 //-------------------------------------------------------------------------- 96 }
82 97 //--------------------------------------------------------------------------
83 //==========================================================================
84 ///
85 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
86 /// @brief Set's the control's enabled/disabled state
87 ///
88 /// @param[in] enabled If true enabled, otherwise disabled
89 ///
90 void SetEnabled(bool enabled)
91 {
92 m_interface->kodi_gui->control_settings_slider->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
93 }
94 //--------------------------------------------------------------------------
95 98
96 //========================================================================== 99 //==========================================================================
97 /// 100 ///
98 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 101 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
99 /// @brief To set the text string on settings slider 102 /// @brief To set the text string on settings slider
100 /// 103 ///
101 /// @param[in] text Text to show 104 /// @param[in] text Text to show
102 /// 105 ///
103 void SetText(const std::string& text) 106 void SetText(const std::string& text)
104 { 107 {
105 m_interface->kodi_gui->control_settings_slider->set_text(m_interface->kodiBase, m_controlHandle, text.c_str()); 108 m_interface->kodi_gui->control_settings_slider->set_text(m_interface->kodiBase, m_controlHandle,
106 } 109 text.c_str());
107 //-------------------------------------------------------------------------- 110 }
111 //--------------------------------------------------------------------------
108 112
109 //========================================================================== 113 //==========================================================================
110 /// 114 ///
111 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 115 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
112 /// @brief To reset slider on defaults 116 /// @brief To reset slider on defaults
113 /// 117 ///
114 void Reset() 118 void Reset()
115 { 119 {
116 m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle); 120 m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle);
117 } 121 }
118 //-------------------------------------------------------------------------- 122 //--------------------------------------------------------------------------
119 123
120 //========================================================================== 124 //==========================================================================
121 /// 125 ///
122 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 126 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
123 /// @brief To set the the range as integer of slider, e.g. -10 is the slider 127 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
124 /// start and e.g. +10 is the from here defined position where it reach the 128 /// start and e.g. +10 is the from here defined position where it reach the
125 /// end. 129 /// end.
126 /// 130 ///
127 /// Ad default is the range from 0 to 100. 131 /// Ad default is the range from 0 to 100.
128 /// 132 ///
129 /// The integer interval is as default 1 and can be changed with 133 /// The integer interval is as default 1 and can be changed with
130 /// @ref SetIntInterval. 134 /// @ref SetIntInterval.
131 /// 135 ///
132 /// @param[in] start Integer start value 136 /// @param[in] start Integer start value
133 /// @param[in] end Integer end value 137 /// @param[in] end Integer end value
134 /// 138 ///
135 /// @note Percent, floating point or integer are alone possible. Combining 139 /// @note Percent, floating point or integer are alone possible. Combining
136 /// these different values can be not together and can, therefore, only 140 /// these different values can be not together and can, therefore, only
137 /// one each can be used. 141 /// one each can be used.
138 /// 142 ///
139 void SetIntRange(int start, int end) 143 void SetIntRange(int start, int end)
140 { 144 {
141 m_interface->kodi_gui->control_settings_slider->set_int_range(m_interface->kodiBase, m_controlHandle, start, end); 145 m_interface->kodi_gui->control_settings_slider->set_int_range(m_interface->kodiBase,
142 } 146 m_controlHandle, start, end);
143 //-------------------------------------------------------------------------- 147 }
148 //--------------------------------------------------------------------------
144 149
145 //========================================================================== 150 //==========================================================================
146 /// 151 ///
147 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 152 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
148 /// @brief Set the slider position with the given integer value. The Range 153 /// @brief Set the slider position with the given integer value. The Range
149 /// must be defined with a call from \ref SetIntRange before. 154 /// must be defined with a call from \ref SetIntRange before.
150 /// 155 ///
151 /// @param[in] value Position in range to set with integer 156 /// @param[in] value Position in range to set with integer
152 /// 157 ///
153 /// @note Percent, floating point or integer are alone possible. Combining 158 /// @note Percent, floating point or integer are alone possible. Combining
154 /// these different values ​​can be not together and can, therefore, only 159 /// these different values ​​can be not together and can, therefore, only
155 /// one each can be used. 160 /// one each can be used.
156 /// 161 ///
157 void SetIntValue(int value) 162 void SetIntValue(int value)
158 { 163 {
159 m_interface->kodi_gui->control_settings_slider->set_int_value(m_interface->kodiBase, m_controlHandle, value); 164 m_interface->kodi_gui->control_settings_slider->set_int_value(m_interface->kodiBase,
160 } 165 m_controlHandle, value);
161 //-------------------------------------------------------------------------- 166 }
167 //--------------------------------------------------------------------------
162 168
163 //========================================================================== 169 //==========================================================================
164 /// 170 ///
165 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 171 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
166 /// @brief To get the current position as integer value. 172 /// @brief To get the current position as integer value.
167 /// 173 ///
168 /// @return The position as integer 174 /// @return The position as integer
169 /// 175 ///
170 /// @note Percent, floating point or integer are alone possible. Combining 176 /// @note Percent, floating point or integer are alone possible. Combining
171 /// these different values ​​can be not together and can, therefore, only 177 /// these different values ​​can be not together and can, therefore, only
172 /// one each can be used. 178 /// one each can be used.
173 /// 179 ///
174 int GetIntValue() const 180 int GetIntValue() const
175 { 181 {
176 return m_interface->kodi_gui->control_settings_slider->get_int_value(m_interface->kodiBase, m_controlHandle); 182 return m_interface->kodi_gui->control_settings_slider->get_int_value(m_interface->kodiBase,
177 } 183 m_controlHandle);
178 //-------------------------------------------------------------------------- 184 }
185 //--------------------------------------------------------------------------
179 186
180 //========================================================================== 187 //==========================================================================
181 /// 188 ///
182 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 189 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
183 /// @brief To set the interval steps of slider, as default is it 1. If it 190 /// @brief To set the interval steps of slider, as default is it 1. If it
184 /// becomes changed with this function will a step of the user with the 191 /// becomes changed with this function will a step of the user with the
185 /// value fixed here be executed. 192 /// value fixed here be executed.
186 /// 193 ///
187 /// @param[in] interval Intervall step to set. 194 /// @param[in] interval Intervall step to set.
188 /// 195 ///
189 /// @note Percent, floating point or integer are alone possible. Combining 196 /// @note Percent, floating point or integer are alone possible. Combining
190 /// these different values ​​can be not together and can, therefore, only 197 /// these different values ​​can be not together and can, therefore, only
191 /// one each can be used. 198 /// one each can be used.
192 /// 199 ///
193 void SetIntInterval(int interval) 200 void SetIntInterval(int interval)
194 { 201 {
195 m_interface->kodi_gui->control_settings_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, interval); 202 m_interface->kodi_gui->control_settings_slider->set_int_interval(m_interface->kodiBase,
196 } 203 m_controlHandle, interval);
197 //-------------------------------------------------------------------------- 204 }
205 //--------------------------------------------------------------------------
198 206
199 //========================================================================== 207 //==========================================================================
200 /// 208 ///
201 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 209 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
202 /// @brief Sets the percent of the slider. 210 /// @brief Sets the percent of the slider.
203 /// 211 ///
204 /// @param[in] percent float - Percent value of slide 212 /// @param[in] percent float - Percent value of slide
205 /// 213 ///
206 /// @note Percent, floating point or integer are alone possible. Combining 214 /// @note Percent, floating point or integer are alone possible. Combining
207 /// these different values ​​can be not together and can, therefore, only 215 /// these different values ​​can be not together and can, therefore, only
208 /// one each can be used. 216 /// one each can be used.
209 /// 217 ///
210 void SetPercentage(float percent) 218 void SetPercentage(float percent)
211 { 219 {
212 m_interface->kodi_gui->control_settings_slider->set_percentage(m_interface->kodiBase, m_controlHandle, percent); 220 m_interface->kodi_gui->control_settings_slider->set_percentage(m_interface->kodiBase,
213 } 221 m_controlHandle, percent);
214 //-------------------------------------------------------------------------- 222 }
223 //--------------------------------------------------------------------------
215 224
216 //========================================================================== 225 //==========================================================================
217 /// 226 ///
218 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 227 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
219 /// @brief Returns a float of the percent of the slider. 228 /// @brief Returns a float of the percent of the slider.
220 /// 229 ///
221 /// @return float - Percent of slider 230 /// @return float - Percent of slider
222 /// 231 ///
223 /// @note Percent, floating point or integer are alone possible. Combining 232 /// @note Percent, floating point or integer are alone possible. Combining
224 /// these different values ​​can be not together and can, therefore, only 233 /// these different values ​​can be not together and can, therefore, only
225 /// one each can be used. 234 /// one each can be used.
226 /// 235 ///
227 float GetPercentage() const 236 float GetPercentage() const
228 { 237 {
229 return m_interface->kodi_gui->control_settings_slider->get_percentage(m_interface->kodiBase, m_controlHandle); 238 return m_interface->kodi_gui->control_settings_slider->get_percentage(m_interface->kodiBase,
230 } 239 m_controlHandle);
231 //-------------------------------------------------------------------------- 240 }
241 //--------------------------------------------------------------------------
232 242
233 //========================================================================== 243 //==========================================================================
234 /// 244 ///
235 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 245 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
236 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider 246 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
237 /// start and e.g. +25.0 is the from here defined position where it reach 247 /// start and e.g. +25.0 is the from here defined position where it reach
238 /// the end. 248 /// the end.
239 /// 249 ///
240 /// As default is the range 0.0 to 1.0. 250 /// As default is the range 0.0 to 1.0.
241 /// 251 ///
242 /// The float interval is as default 0.1 and can be changed with 252 /// The float interval is as default 0.1 and can be changed with
243 /// @ref SetFloatInterval. 253 /// @ref SetFloatInterval.
244 /// 254 ///
245 /// @param[in] start Integer start value 255 /// @param[in] start Integer start value
246 /// @param[in] end Integer end value 256 /// @param[in] end Integer end value
247 /// 257 ///
248 /// @note Percent, floating point or integer are alone possible. Combining 258 /// @note Percent, floating point or integer are alone possible. Combining
249 /// these different values ​​ can be not together and can, therefore, only 259 /// these different values ​​ can be not together and can, therefore, only
250 /// one each can be used. 260 /// one each can be used.
251 /// 261 ///
252 void SetFloatRange(float start, float end) 262 void SetFloatRange(float start, float end)
253 { 263 {
254 m_interface->kodi_gui->control_settings_slider->set_float_range(m_interface->kodiBase, m_controlHandle, start, end); 264 m_interface->kodi_gui->control_settings_slider->set_float_range(m_interface->kodiBase,
255 } 265 m_controlHandle, start, end);
256 //-------------------------------------------------------------------------- 266 }
267 //--------------------------------------------------------------------------
257 268
258 //========================================================================== 269 //==========================================================================
259 /// 270 ///
260 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 271 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
261 /// @brief Set the slider position with the given float value. The Range 272 /// @brief Set the slider position with the given float value. The Range
262 /// can be defined with a call from \ref SetIntRange before, as default it 273 /// can be defined with a call from \ref SetIntRange before, as default it
263 /// is 0.0 to 1.0. 274 /// is 0.0 to 1.0.
264 /// 275 ///
265 /// @param[in] value Position in range to set with float 276 /// @param[in] value Position in range to set with float
266 /// 277 ///
267 /// @note Percent, floating point or integer are alone possible. Combining 278 /// @note Percent, floating point or integer are alone possible. Combining
268 /// these different values ​​can be not together and can, therefore, only 279 /// these different values ​​can be not together and can, therefore, only
269 /// one each can be used. 280 /// one each can be used.
270 /// 281 ///
271 void SetFloatValue(float value) 282 void SetFloatValue(float value)
272 { 283 {
273 m_interface->kodi_gui->control_settings_slider->set_float_value(m_interface->kodiBase, m_controlHandle, value); 284 m_interface->kodi_gui->control_settings_slider->set_float_value(m_interface->kodiBase,
274 } 285 m_controlHandle, value);
275 //-------------------------------------------------------------------------- 286 }
287 //--------------------------------------------------------------------------
276 288
277 //========================================================================== 289 //==========================================================================
278 /// 290 ///
279 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 291 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
280 /// @brief To get the current position as float value. 292 /// @brief To get the current position as float value.
281 /// 293 ///
282 /// @return The position as float 294 /// @return The position as float
283 /// 295 ///
284 float GetFloatValue() const 296 float GetFloatValue() const
285 { 297 {
286 return m_interface->kodi_gui->control_settings_slider->get_float_value(m_interface->kodiBase, m_controlHandle); 298 return m_interface->kodi_gui->control_settings_slider->get_float_value(m_interface->kodiBase,
287 } 299 m_controlHandle);
288 //-------------------------------------------------------------------------- 300 }
301 //--------------------------------------------------------------------------
289 302
290 //========================================================================== 303 //==========================================================================
291 /// 304 ///
292 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider 305 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
293 /// @brief To set the interval steps of slider, as default is it 0.1 If it 306 /// @brief To set the interval steps of slider, as default is it 0.1 If it
294 /// becomes changed with this function will a step of the user with the 307 /// becomes changed with this function will a step of the user with the
295 /// value fixed here be executed. 308 /// value fixed here be executed.
296 /// 309 ///
297 /// @param[in] interval Intervall step to set. 310 /// @param[in] interval Intervall step to set.
298 /// 311 ///
299 /// @note Percent, floating point or integer are alone possible. Combining 312 /// @note Percent, floating point or integer are alone possible. Combining
300 /// these different values ​​can be not together and can, therefore, only 313 /// these different values ​​can be not together and can, therefore, only
301 /// one each can be used. 314 /// one each can be used.
302 /// 315 ///
303 void SetFloatInterval(float interval) 316 void SetFloatInterval(float interval)
304 { 317 {
305 m_interface->kodi_gui->control_settings_slider->set_float_interval(m_interface->kodiBase, m_controlHandle, interval); 318 m_interface->kodi_gui->control_settings_slider->set_float_interval(m_interface->kodiBase,
306 } 319 m_controlHandle, interval);
307 //-------------------------------------------------------------------------- 320 }
308 }; 321 //--------------------------------------------------------------------------
322};
309 323
310} /* namespace controls */ 324} /* namespace controls */
311} /* namespace gui */ 325} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
index 6eae70a..715cc7d 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
@@ -18,307 +18,321 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CSlider Control Slider
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CSlider }
26/// **Window control for moveable slider**
27///
28/// The slider control is used for things where a sliding bar best represents
29/// the operation at hand (such as a volume control or seek control). You can
30/// choose the position, size, and look of the slider control.
31///
32/// It has the header \ref Slider.h "#include <kodi/gui/controls/Slider.h>"
33/// be included to enjoy it.
34///
35/// Here you find the needed skin part for a \ref Slider_Control "slider control"
36///
37/// @note The call of the control is only possible from the corresponding
38/// window as its class and identification number is required.
39///
40class ATTRIBUTE_HIDDEN CSlider : public CAddonGUIControlBase
41{
42public:
43 //==========================================================================
22 /// 44 ///
23 /// \defgroup cpp_kodi_gui_controls_CSlider Control Slider 45 /// \ingroup cpp_kodi_gui_controls_CSlider
24 /// \ingroup cpp_kodi_gui 46 /// @brief Construct a new control
25 /// @brief \cpp_class{ kodi::gui::controls::CSlider }
26 /// **Window control for moveable slider**
27 /// 47 ///
28 /// The slider control is used for things where a sliding bar best represents 48 /// @param[in] window related window control class
29 /// the operation at hand (such as a volume control or seek control). You can 49 /// @param[in] controlId Used skin xml control id
30 /// choose the position, size, and look of the slider control.
31 /// 50 ///
32 /// It has the header \ref Slider.h "#include <kodi/gui/controls/Slider.h>" 51 CSlider(CWindow* window, int controlId) : CAddonGUIControlBase(window)
33 /// be included to enjoy it. 52 {
53 m_controlHandle = m_interface->kodi_gui->window->get_control_slider(
54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL,
57 "kodi::gui::controls::CSlider can't create control class from Kodi !!!");
58 }
59 //--------------------------------------------------------------------------
60
61 //==========================================================================
34 /// 62 ///
35 /// Here you find the needed skin part for a \ref Slider_Control "slider control" 63 /// \ingroup cpp_kodi_gui_controls_CSlider
64 /// @brief Destructor
36 /// 65 ///
37 /// @note The call of the control is only possible from the corresponding 66 ~CSlider() override = default;
38 /// window as its class and identification number is required. 67 //--------------------------------------------------------------------------
68
69 //==========================================================================
39 /// 70 ///
40 class CSlider : public CAddonGUIControlBase 71 /// \ingroup cpp_kodi_gui_controls_CSlider
72 /// @brief Set the control on window to visible
73 ///
74 /// @param[in] visible If true visible, otherwise hidden
75 ///
76 void SetVisible(bool visible)
41 { 77 {
42 public: 78 m_interface->kodi_gui->control_slider->set_visible(m_interface->kodiBase, m_controlHandle,
43 //========================================================================== 79 visible);
44 /// 80 }
45 /// \ingroup cpp_kodi_gui_controls_CSlider 81 //--------------------------------------------------------------------------
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
50 ///
51 CSlider(CWindow* window, int controlId)
52 : CAddonGUIControlBase(window)
53 {
54 m_controlHandle = m_interface->kodi_gui->window->get_control_slider(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSlider can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
61 ///
62 /// \ingroup cpp_kodi_gui_controls_CSlider
63 /// @brief Destructor
64 ///
65 ~CSlider() override = default;
66 //--------------------------------------------------------------------------
67
68 //==========================================================================
69 ///
70 /// \ingroup cpp_kodi_gui_controls_CSlider
71 /// @brief Set the control on window to visible
72 ///
73 /// @param[in] visible If true visible, otherwise hidden
74 ///
75 void SetVisible(bool visible)
76 {
77 m_interface->kodi_gui->control_slider->set_visible(m_interface->kodiBase, m_controlHandle, visible);
78 }
79 //--------------------------------------------------------------------------
80 82
81 //========================================================================== 83 //==========================================================================
82 /// 84 ///
83 /// \ingroup cpp_kodi_gui_controls_CSlider 85 /// \ingroup cpp_kodi_gui_controls_CSlider
84 /// @brief Set's the control's enabled/disabled state 86 /// @brief Set's the control's enabled/disabled state
85 /// 87 ///
86 /// @param[in] enabled If true enabled, otherwise disabled 88 /// @param[in] enabled If true enabled, otherwise disabled
87 /// 89 ///
88 void SetEnabled(bool enabled) 90 void SetEnabled(bool enabled)
89 { 91 {
90 m_interface->kodi_gui->control_slider->set_enabled(m_interface->kodiBase, m_controlHandle, enabled); 92 m_interface->kodi_gui->control_slider->set_enabled(m_interface->kodiBase, m_controlHandle,
91 } 93 enabled);
92 //-------------------------------------------------------------------------- 94 }
95 //--------------------------------------------------------------------------
93 96
94 //========================================================================== 97 //==========================================================================
95 /// 98 ///
96 /// \ingroup cpp_kodi_gui_controls_CSlider 99 /// \ingroup cpp_kodi_gui_controls_CSlider
97 /// @brief To reset slider on defaults 100 /// @brief To reset slider on defaults
98 /// 101 ///
99 void Reset() 102 void Reset()
100 { 103 {
101 m_interface->kodi_gui->control_slider->reset(m_interface->kodiBase, m_controlHandle); 104 m_interface->kodi_gui->control_slider->reset(m_interface->kodiBase, m_controlHandle);
102 } 105 }
103 //-------------------------------------------------------------------------- 106 //--------------------------------------------------------------------------
104 107
105 //========================================================================== 108 //==========================================================================
106 /// 109 ///
107 /// \ingroup cpp_kodi_gui_controls_CSlider 110 /// \ingroup cpp_kodi_gui_controls_CSlider
108 /// @brief With GetDescription becomes a string value of position returned. 111 /// @brief With GetDescription becomes a string value of position returned.
109 /// 112 ///
110 /// @return Text string about current slider position 113 /// @return Text string about current slider position
111 /// 114 ///
112 /// The following are the text definition returned from this: 115 /// The following are the text definition returned from this:
113 /// | Value | Without range selection | With range selection | 116 /// | Value | Without range selection | With range selection |
114 /// |:---------:|:------------------------|:-------------------------------| 117 /// |:---------:|:------------------------|:-------------------------------|
115 /// | float | <c>%2.2f</c> | <c>[%2.2f, %2.2f]</c> | 118 /// | float | <c>%2.2f</c> | <c>[%2.2f, %2.2f]</c> |
116 /// | integer | <c>%i</c> | <c>[%i, %i]</c> | 119 /// | integer | <c>%i</c> | <c>[%i, %i]</c> |
117 /// | percent | <c>%i%%</c> | <c>[%i%%, %i%%]</c> | 120 /// | percent | <c>%i%%</c> | <c>[%i%%, %i%%]</c> |
118 /// 121 ///
119 std::string GetDescription() const 122 std::string GetDescription() const
123 {
124 std::string text;
125 char* ret = m_interface->kodi_gui->control_slider->get_description(m_interface->kodiBase,
126 m_controlHandle);
127 if (ret != nullptr)
120 { 128 {
121 std::string text; 129 if (std::strlen(ret))
122 char* ret = m_interface->kodi_gui->control_slider->get_description(m_interface->kodiBase, m_controlHandle); 130 text = ret;
123 if (ret != nullptr) 131 m_interface->free_string(m_interface->kodiBase, ret);
124 {
125 if (std::strlen(ret))
126 text = ret;
127 m_interface->free_string(m_interface->kodiBase, ret);
128 }
129 return text;
130 } 132 }
131 //-------------------------------------------------------------------------- 133 return text;
134 }
135 //--------------------------------------------------------------------------
132 136
133 //========================================================================== 137 //==========================================================================
134 /// 138 ///
135 /// \ingroup cpp_kodi_gui_controls_CSlider 139 /// \ingroup cpp_kodi_gui_controls_CSlider
136 /// @brief To set the the range as integer of slider, e.g. -10 is the slider 140 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
137 /// start and e.g. +10 is the from here defined position where it reach the 141 /// start and e.g. +10 is the from here defined position where it reach the
138 /// end. 142 /// end.
139 /// 143 ///
140 /// Ad default is the range from 0 to 100. 144 /// Ad default is the range from 0 to 100.
141 /// 145 ///
142 /// The integer interval is as default 1 and can be changed with 146 /// The integer interval is as default 1 and can be changed with
143 /// @ref SetIntInterval. 147 /// @ref SetIntInterval.
144 /// 148 ///
145 /// @param[in] start Integer start value 149 /// @param[in] start Integer start value
146 /// @param[in] end Integer end value 150 /// @param[in] end Integer end value
147 /// 151 ///
148 /// @note Percent, floating point or integer are alone possible. Combining 152 /// @note Percent, floating point or integer are alone possible. Combining
149 /// these different values can be not together and can, therefore, only one 153 /// these different values can be not together and can, therefore, only one
150 /// each can be used. 154 /// each can be used.
151 /// 155 ///
152 void SetIntRange(int start, int end) 156 void SetIntRange(int start, int end)
153 { 157 {
154 m_interface->kodi_gui->control_slider->set_int_range(m_interface->kodiBase, m_controlHandle, start, end); 158 m_interface->kodi_gui->control_slider->set_int_range(m_interface->kodiBase, m_controlHandle,
155 } 159 start, end);
156 //-------------------------------------------------------------------------- 160 }
161 //--------------------------------------------------------------------------
157 162
158 //========================================================================== 163 //==========================================================================
159 /// 164 ///
160 /// \ingroup CSlider 165 /// \ingroup CSlider
161 /// @brief Set the slider position with the given integer value. The Range 166 /// @brief Set the slider position with the given integer value. The Range
162 /// must be defined with a call from \ref SetIntRange before. 167 /// must be defined with a call from \ref SetIntRange before.
163 /// 168 ///
164 /// @param[in] value Position in range to set with integer 169 /// @param[in] value Position in range to set with integer
165 /// 170 ///
166 /// @note Percent, floating point or integer are alone possible. Combining 171 /// @note Percent, floating point or integer are alone possible. Combining
167 /// these different values can be not together and can, therefore, only one 172 /// these different values can be not together and can, therefore, only one
168 /// each can be used. 173 /// each can be used.
169 /// 174 ///
170 void SetIntValue(int value) 175 void SetIntValue(int value)
171 { 176 {
172 m_interface->kodi_gui->control_slider->set_int_value(m_interface->kodiBase, m_controlHandle, value); 177 m_interface->kodi_gui->control_slider->set_int_value(m_interface->kodiBase, m_controlHandle,
173 } 178 value);
174 //-------------------------------------------------------------------------- 179 }
180 //--------------------------------------------------------------------------
175 181
176 //========================================================================== 182 //==========================================================================
177 /// 183 ///
178 /// \ingroup cpp_kodi_gui_controls_CSlider 184 /// \ingroup cpp_kodi_gui_controls_CSlider
179 /// @brief To get the current position as integer value. 185 /// @brief To get the current position as integer value.
180 /// 186 ///
181 /// @return The position as integer 187 /// @return The position as integer
182 /// 188 ///
183 /// @note Percent, floating point or integer are alone possible. Combining 189 /// @note Percent, floating point or integer are alone possible. Combining
184 /// these different values can be not together and can, therefore, only 190 /// these different values can be not together and can, therefore, only
185 /// one each can be used. 191 /// one each can be used.
186 /// 192 ///
187 int GetIntValue() const 193 int GetIntValue() const
188 { 194 {
189 return m_interface->kodi_gui->control_slider->get_int_value(m_interface->kodiBase, m_controlHandle); 195 return m_interface->kodi_gui->control_slider->get_int_value(m_interface->kodiBase,
190 } 196 m_controlHandle);
191 //-------------------------------------------------------------------------- 197 }
198 //--------------------------------------------------------------------------
192 199
193 //========================================================================== 200 //==========================================================================
194 /// 201 ///
195 /// \ingroup cpp_kodi_gui_controls_CSlider 202 /// \ingroup cpp_kodi_gui_controls_CSlider
196 /// @brief To set the interval steps of slider, as default is it 1. If it 203 /// @brief To set the interval steps of slider, as default is it 1. If it
197 /// becomes changed with this function will a step of the user with the 204 /// becomes changed with this function will a step of the user with the
198 /// value fixed here be executed. 205 /// value fixed here be executed.
199 /// 206 ///
200 /// @param[in] interval Intervall step to set. 207 /// @param[in] interval Intervall step to set.
201 /// 208 ///
202 /// @note Percent, floating point or integer are alone possible. Combining 209 /// @note Percent, floating point or integer are alone possible. Combining
203 /// these different values can be not together and can, therefore, only one 210 /// these different values can be not together and can, therefore, only one
204 /// each can be used. 211 /// each can be used.
205 /// 212 ///
206 void SetIntInterval(int interval) 213 void SetIntInterval(int interval)
207 { 214 {
208 m_interface->kodi_gui->control_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, interval); 215 m_interface->kodi_gui->control_slider->set_int_interval(m_interface->kodiBase, m_controlHandle,
209 } 216 interval);
210 //-------------------------------------------------------------------------- 217 }
218 //--------------------------------------------------------------------------
211 219
212 //========================================================================== 220 //==========================================================================
213 /// 221 ///
214 /// \ingroup cpp_kodi_gui_controls_CSlider 222 /// \ingroup cpp_kodi_gui_controls_CSlider
215 /// @brief Sets the percent of the slider. 223 /// @brief Sets the percent of the slider.
216 /// 224 ///
217 /// @param[in] percent float - Percent value of slide 225 /// @param[in] percent float - Percent value of slide
218 /// 226 ///
219 /// @note Percent, floating point or integer are alone possible. Combining 227 /// @note Percent, floating point or integer are alone possible. Combining
220 /// these different values can be not together and can, therefore, only one 228 /// these different values can be not together and can, therefore, only one
221 /// each can be used. 229 /// each can be used.
222 /// 230 ///
223 void SetPercentage(float percent) 231 void SetPercentage(float percent)
224 { 232 {
225 m_interface->kodi_gui->control_slider->set_percentage(m_interface->kodiBase, m_controlHandle, percent); 233 m_interface->kodi_gui->control_slider->set_percentage(m_interface->kodiBase, m_controlHandle,
226 } 234 percent);
227 //-------------------------------------------------------------------------- 235 }
236 //--------------------------------------------------------------------------
228 237
229 //========================================================================== 238 //==========================================================================
230 /// 239 ///
231 /// \ingroup cpp_kodi_gui_controls_CSlider 240 /// \ingroup cpp_kodi_gui_controls_CSlider
232 /// @brief Returns a float of the percent of the slider. 241 /// @brief Returns a float of the percent of the slider.
233 /// 242 ///
234 /// @return float - Percent of slider 243 /// @return float - Percent of slider
235 /// 244 ///
236 /// @note Percent, floating point or integer are alone possible. Combining 245 /// @note Percent, floating point or integer are alone possible. Combining
237 /// these different values can be not together and can, therefore, only one 246 /// these different values can be not together and can, therefore, only one
238 /// each can be used. 247 /// each can be used.
239 /// 248 ///
240 float GetPercentage() const 249 float GetPercentage() const
241 { 250 {
242 return m_interface->kodi_gui->control_slider->get_percentage(m_interface->kodiBase, m_controlHandle); 251 return m_interface->kodi_gui->control_slider->get_percentage(m_interface->kodiBase,
243 } 252 m_controlHandle);
244 //-------------------------------------------------------------------------- 253 }
254 //--------------------------------------------------------------------------
245 255
246 //========================================================================== 256 //==========================================================================
247 /// 257 ///
248 /// \ingroup cpp_kodi_gui_controls_CSlider 258 /// \ingroup cpp_kodi_gui_controls_CSlider
249 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider 259 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
250 /// start and e.g. +25.0 is the from here defined position where it reach 260 /// start and e.g. +25.0 is the from here defined position where it reach
251 /// the end. 261 /// the end.
252 /// 262 ///
253 /// As default is the range 0.0 to 1.0. 263 /// As default is the range 0.0 to 1.0.
254 /// 264 ///
255 /// The float interval is as default 0.1 and can be changed with 265 /// The float interval is as default 0.1 and can be changed with
256 /// @ref SetFloatInterval. 266 /// @ref SetFloatInterval.
257 /// 267 ///
258 /// @param[in] start Integer start value 268 /// @param[in] start Integer start value
259 /// @param[in] end Integer end value 269 /// @param[in] end Integer end value
260 /// 270 ///
261 /// @note Percent, floating point or integer are alone possible. Combining 271 /// @note Percent, floating point or integer are alone possible. Combining
262 /// these different values can be not together and can, therefore, only 272 /// these different values can be not together and can, therefore, only
263 /// one each can be used. 273 /// one each can be used.
264 /// 274 ///
265 void SetFloatRange(float start, float end) 275 void SetFloatRange(float start, float end)
266 { 276 {
267 m_interface->kodi_gui->control_slider->set_float_range(m_interface->kodiBase, m_controlHandle, start, end); 277 m_interface->kodi_gui->control_slider->set_float_range(m_interface->kodiBase, m_controlHandle,
268 } 278 start, end);
269 //-------------------------------------------------------------------------- 279 }
280 //--------------------------------------------------------------------------
270 281
271 //========================================================================== 282 //==========================================================================
272 /// 283 ///
273 /// \ingroup cpp_kodi_gui_controls_CSlider 284 /// \ingroup cpp_kodi_gui_controls_CSlider
274 /// @brief Set the slider position with the given float value. The Range 285 /// @brief Set the slider position with the given float value. The Range
275 /// can be defined with a call from \ref SetIntRange before, as default it 286 /// can be defined with a call from \ref SetIntRange before, as default it
276 /// is 0.0 to 1.0. 287 /// is 0.0 to 1.0.
277 /// 288 ///
278 /// @param[in] value Position in range to set with float 289 /// @param[in] value Position in range to set with float
279 /// 290 ///
280 /// @note Percent, floating point or integer are alone possible. Combining 291 /// @note Percent, floating point or integer are alone possible. Combining
281 /// these different values can be not together and can, therefore, only one 292 /// these different values can be not together and can, therefore, only one
282 /// each can be used. 293 /// each can be used.
283 /// 294 ///
284 void SetFloatValue(float value) 295 void SetFloatValue(float value)
285 { 296 {
286 m_interface->kodi_gui->control_slider->set_float_value(m_interface->kodiBase, m_controlHandle, value); 297 m_interface->kodi_gui->control_slider->set_float_value(m_interface->kodiBase, m_controlHandle,
287 } 298 value);
288 //-------------------------------------------------------------------------- 299 }
300 //--------------------------------------------------------------------------
289 301
290 //========================================================================== 302 //==========================================================================
291 /// 303 ///
292 /// \ingroup cpp_kodi_gui_controls_CSlider 304 /// \ingroup cpp_kodi_gui_controls_CSlider
293 /// @brief To get the current position as float value. 305 /// @brief To get the current position as float value.
294 /// 306 ///
295 /// @return The position as float 307 /// @return The position as float
296 /// 308 ///
297 float GetFloatValue() const 309 float GetFloatValue() const
298 { 310 {
299 return m_interface->kodi_gui->control_slider->get_float_value(m_interface->kodiBase, m_controlHandle); 311 return m_interface->kodi_gui->control_slider->get_float_value(m_interface->kodiBase,
300 } 312 m_controlHandle);
301 //-------------------------------------------------------------------------- 313 }
314 //--------------------------------------------------------------------------
302 315
303 //========================================================================== 316 //==========================================================================
304 /// 317 ///
305 /// \ingroup cpp_kodi_gui_controls_CSlider 318 /// \ingroup cpp_kodi_gui_controls_CSlider
306 /// @brief To set the interval steps of slider, as default is it 0.1 If it 319 /// @brief To set the interval steps of slider, as default is it 0.1 If it
307 /// becomes changed with this function will a step of the user with the 320 /// becomes changed with this function will a step of the user with the
308 /// value fixed here be executed. 321 /// value fixed here be executed.
309 /// 322 ///
310 /// @param[in] interval Intervall step to set. 323 /// @param[in] interval Intervall step to set.
311 /// 324 ///
312 /// @note Percent, floating point or integer are alone possible. Combining 325 /// @note Percent, floating point or integer are alone possible. Combining
313 /// these different values can be not together and can, therefore, only 326 /// these different values can be not together and can, therefore, only
314 /// one each can be used. 327 /// one each can be used.
315 /// 328 ///
316 void SetFloatInterval(float interval) 329 void SetFloatInterval(float interval)
317 { 330 {
318 m_interface->kodi_gui->control_slider->set_float_interval(m_interface->kodiBase, m_controlHandle, interval); 331 m_interface->kodi_gui->control_slider->set_float_interval(m_interface->kodiBase,
319 } 332 m_controlHandle, interval);
320 //-------------------------------------------------------------------------- 333 }
321 }; 334 //--------------------------------------------------------------------------
335};
322 336
323} /* namespace controls */ 337} /* namespace controls */
324} /* namespace gui */ 338} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
index f3017b5..db8d491 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
@@ -61,7 +61,7 @@ namespace controls
61 } AddonGUISpinControlType; 61 } AddonGUISpinControlType;
62 //---------------------------------------------------------------------------- 62 //----------------------------------------------------------------------------
63 63
64 class CSpin : public CAddonGUIControlBase 64 class ATTRIBUTE_HIDDEN CSpin : public CAddonGUIControlBase
65 { 65 {
66 public: 66 public:
67 //========================================================================== 67 //==========================================================================
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
index 13ce1da..b4e8ae0 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
@@ -18,147 +18,150 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CTextBox }
26/// **Used to show a multi-page piece of text**
27///
28/// The text box control can be used to display descriptions, help texts or
29/// other larger texts. It corresponds to the representation which is also to
30/// be seen on the CDialogTextViewer.
31///
32/// It has the header \ref TextBox.h "#include <kodi/gui/controls/TextBox.h>"
33/// be included to enjoy it.
34///
35/// Here you find the needed skin part for a \ref Text_Box "textbox control".
36///
37/// @note The call of the control is only possible from the corresponding
38/// window as its class and identification number is required.
39///
40class ATTRIBUTE_HIDDEN CTextBox : public CAddonGUIControlBase
41{
42public:
43 //==========================================================================
44 ///
45 /// \ingroup cpp_kodi_gui_controls_CTextBox
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
22 /// 50 ///
23 /// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box 51 CTextBox(CWindow* window, int controlId) : CAddonGUIControlBase(window)
24 /// \ingroup cpp_kodi_gui 52 {
25 /// @brief \cpp_class{ kodi::gui::controls::CTextBox } 53 m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(
26 /// **Used to show a multi-page piece of text** 54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL,
57 "kodi::gui::controls::CTextBox can't create control class from Kodi !!!");
58 }
59 //--------------------------------------------------------------------------
60
61 //==========================================================================
27 /// 62 ///
28 /// The text box control can be used to display descriptions, help texts or 63 /// \ingroup cpp_kodi_gui_controls_CTextBox
29 /// other larger texts. It corresponds to the representation which is also to 64 /// @brief Destructor
30 /// be seen on the CDialogTextViewer.
31 /// 65 ///
32 /// It has the header \ref TextBox.h "#include <kodi/gui/controls/TextBox.h>" 66 ~CTextBox() override = default;
33 /// be included to enjoy it. 67 //--------------------------------------------------------------------------
68
69 //==========================================================================
34 /// 70 ///
35 /// Here you find the needed skin part for a \ref Text_Box "textbox control". 71 /// \ingroup cpp_kodi_gui_controls_CTextBox
72 /// @brief Set the control on window to visible
36 /// 73 ///
37 /// @note The call of the control is only possible from the corresponding 74 /// @param[in] visible If true visible, otherwise hidden
38 /// window as its class and identification number is required.
39 /// 75 ///
40 class CTextBox : public CAddonGUIControlBase 76 void SetVisible(bool visible)
41 { 77 {
42 public: 78 m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle,
43 //========================================================================== 79 visible);
44 /// 80 }
45 /// \ingroup cpp_kodi_gui_controls_CTextBox 81 //--------------------------------------------------------------------------
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
50 ///
51 CTextBox(CWindow* window, int controlId)
52 : CAddonGUIControlBase(window)
53 {
54 m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CTextBox can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
61 ///
62 /// \ingroup cpp_kodi_gui_controls_CTextBox
63 /// @brief Destructor
64 ///
65 ~CTextBox() override = default;
66 //--------------------------------------------------------------------------
67
68 //==========================================================================
69 ///
70 /// \ingroup cpp_kodi_gui_controls_CTextBox
71 /// @brief Set the control on window to visible
72 ///
73 /// @param[in] visible If true visible, otherwise hidden
74 ///
75 void SetVisible(bool visible)
76 {
77 m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, visible);
78 }
79 //--------------------------------------------------------------------------
80 82
81 //========================================================================== 83 //==========================================================================
82 /// 84 ///
83 /// \ingroup cpp_kodi_gui_controls_CTextBox 85 /// \ingroup cpp_kodi_gui_controls_CTextBox
84 /// @brief To reset box an remove all the text 86 /// @brief To reset box an remove all the text
85 /// 87 ///
86 void Reset() 88 void Reset() { m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle); }
87 { 89 //--------------------------------------------------------------------------
88 m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle);
89 }
90 //--------------------------------------------------------------------------
91 90
92 //========================================================================== 91 //==========================================================================
93 /// 92 ///
94 /// \ingroup cpp_kodi_gui_controls_CTextBox 93 /// \ingroup cpp_kodi_gui_controls_CTextBox
95 /// @brief To set the text on box 94 /// @brief To set the text on box
96 /// 95 ///
97 /// @param[in] text Text to show 96 /// @param[in] text Text to show
98 /// 97 ///
99 void SetText(const std::string& text) 98 void SetText(const std::string& text)
100 { 99 {
101 m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, text.c_str()); 100 m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle,
102 } 101 text.c_str());
103 //-------------------------------------------------------------------------- 102 }
103 //--------------------------------------------------------------------------
104 104
105 //========================================================================== 105 //==========================================================================
106 /// 106 ///
107 /// \ingroup cpp_kodi_gui_controls_CTextBox 107 /// \ingroup cpp_kodi_gui_controls_CTextBox
108 /// @brief Get the used text from control 108 /// @brief Get the used text from control
109 /// 109 ///
110 /// @return Text shown 110 /// @return Text shown
111 /// 111 ///
112 std::string GetText() const 112 std::string GetText() const
113 {
114 std::string text;
115 char* ret =
116 m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle);
117 if (ret != nullptr)
113 { 118 {
114 std::string text; 119 if (std::strlen(ret))
115 char* ret = m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle); 120 text = ret;
116 if (ret != nullptr) 121 m_interface->free_string(m_interface->kodiBase, ret);
117 {
118 if (std::strlen(ret))
119 text = ret;
120 m_interface->free_string(m_interface->kodiBase, ret);
121 }
122 return text;
123 } 122 }
124 //-------------------------------------------------------------------------- 123 return text;
124 }
125 //--------------------------------------------------------------------------
125 126
126 //========================================================================== 127 //==========================================================================
127 /// 128 ///
128 /// \ingroup cpp_kodi_gui_controls_CTextBox 129 /// \ingroup cpp_kodi_gui_controls_CTextBox
129 /// @brief To scroll text on other position 130 /// @brief To scroll text on other position
130 /// 131 ///
131 /// @param[in] position The line position to scroll to 132 /// @param[in] position The line position to scroll to
132 /// 133 ///
133 void Scroll(unsigned int position) 134 void Scroll(unsigned int position)
134 { 135 {
135 m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, position); 136 m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle,
136 } 137 position);
137 //-------------------------------------------------------------------------- 138 }
139 //--------------------------------------------------------------------------
138 140
139 //========================================================================== 141 //==========================================================================
140 /// 142 ///
141 /// \ingroup cpp_kodi_gui_controls_CTextBox 143 /// \ingroup cpp_kodi_gui_controls_CTextBox
142 /// @brief To set automatic scrolling of textbox 144 /// @brief To set automatic scrolling of textbox
143 /// 145 ///
144 /// Specifies the timing and conditions of any autoscrolling this textbox 146 /// Specifies the timing and conditions of any autoscrolling this textbox
145 /// should have. Times are in milliseconds. The content is delayed for the 147 /// should have. Times are in milliseconds. The content is delayed for the
146 /// given delay, then scrolls at a rate of one line per time interval until 148 /// given delay, then scrolls at a rate of one line per time interval until
147 /// the end. If the repeat tag is present, it then delays for the repeat 149 /// the end. If the repeat tag is present, it then delays for the repeat
148 /// time, fades out over 1 second, and repeats. It does not wrap or reset 150 /// time, fades out over 1 second, and repeats. It does not wrap or reset
149 /// to the top at the end of the scroll. 151 /// to the top at the end of the scroll.
150 /// 152 ///
151 /// @param[in] delay Content delay 153 /// @param[in] delay Content delay
152 /// @param[in] time One line per time interval 154 /// @param[in] time One line per time interval
153 /// @param[in] repeat Delays with given time, fades out over 1 155 /// @param[in] repeat Delays with given time, fades out over 1
154 /// second, and repeats 156 /// second, and repeats
155 /// 157 ///
156 void SetAutoScrolling(int delay, int time, int repeat) 158 void SetAutoScrolling(int delay, int time, int repeat)
157 { 159 {
158 m_interface->kodi_gui->control_text_box->set_auto_scrolling(m_interface->kodiBase, m_controlHandle, delay, time, repeat); 160 m_interface->kodi_gui->control_text_box->set_auto_scrolling(
159 } 161 m_interface->kodiBase, m_controlHandle, delay, time, repeat);
160 //-------------------------------------------------------------------------- 162 }
161 }; 163 //--------------------------------------------------------------------------
164};
162 165
163} /* namespace controls */ 166} /* namespace controls */
164} /* namespace gui */ 167} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h
index b8b4cbf..4eb64c7 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h
@@ -200,6 +200,8 @@ typedef struct AddonToKodiFuncTable_kodi_gui_dialogFileBrowser
200 void (*clear_file_list)(void* kodiBase, char*** file_list, unsigned int entries); 200 void (*clear_file_list)(void* kodiBase, char*** file_list, unsigned int entries);
201} AddonToKodiFuncTable_kodi_gui_dialogFileBrowser; 201} AddonToKodiFuncTable_kodi_gui_dialogFileBrowser;
202 202
203// typedef void (*char_callback_t) (CGUIKeyboard *ref, const std::string &typedString);
204
203typedef struct AddonToKodiFuncTable_kodi_gui_dialogKeyboard 205typedef struct AddonToKodiFuncTable_kodi_gui_dialogKeyboard
204{ 206{
205 bool (*show_and_get_input_with_head)(void* kodiBase, const char* text_in, char** text_out, const char* heading, bool allow_empty_result, bool hiddenInput, unsigned int auto_close_ms); 207 bool (*show_and_get_input_with_head)(void* kodiBase, const char* text_in, char** text_out, const char* heading, bool allow_empty_result, bool hiddenInput, unsigned int auto_close_ms);
@@ -276,8 +278,6 @@ typedef struct AddonToKodiFuncTable_kodi_gui_listItem
276 void (*set_label)(void* kodiBase, void* handle, const char* label); 278 void (*set_label)(void* kodiBase, void* handle, const char* label);
277 char* (*get_label2)(void* kodiBase, void* handle); 279 char* (*get_label2)(void* kodiBase, void* handle);
278 void (*set_label2)(void* kodiBase, void* handle, const char* label); 280 void (*set_label2)(void* kodiBase, void* handle, const char* label);
279 char* (*get_icon_image)(void* kodiBase, void* handle);
280 void (*set_icon_image)(void* kodiBase, void* handle, const char* image);
281 char* (*get_art)(void* kodiBase, void* handle, const char* type); 281 char* (*get_art)(void* kodiBase, void* handle, const char* type);
282 void (*set_art)(void* kodiBase, void* handle, const char* type, const char* image); 282 void (*set_art)(void* kodiBase, void* handle, const char* type, const char* image);
283 char* (*get_path)(void* kodiBase, void* handle); 283 char* (*get_path)(void* kodiBase, void* handle);
@@ -302,12 +302,12 @@ typedef struct AddonToKodiFuncTable_kodi_gui_window
302 void* (*create)(void* kodiBase, const char* xml_filename, const char* default_skin, bool as_dialog, bool is_media); 302 void* (*create)(void* kodiBase, const char* xml_filename, const char* default_skin, bool as_dialog, bool is_media);
303 void (*destroy)(void* kodiBase, void* handle); 303 void (*destroy)(void* kodiBase, void* handle);
304 void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle, 304 void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle,
305 bool (*)(void* handle), 305 bool (*CBInit)(void*),
306 bool (*)(void* handle, int), 306 bool (*CBFocus)(void*, int),
307 bool (*)(void* handle, int), 307 bool (*CBClick)(void*, int),
308 bool (*)(void* handle, int), 308 bool (*CBOnAction)(void*, int, uint32_t, wchar_t),
309 void (*)(void* handle, int, gui_context_menu_pair*, unsigned int*), 309 void (*CBGetContextButtons)(void*, int, gui_context_menu_pair*, unsigned int*),
310 bool (*)(void* handle, int, unsigned int)); 310 bool (*CBOnContextButton)(void*, int, unsigned int));
311 bool (*show)(void* kodiBase, void* handle); 311 bool (*show)(void* kodiBase, void* handle);
312 bool (*close)(void* kodiBase, void* handle); 312 bool (*close)(void* kodiBase, void* handle);
313 bool (*do_modal)(void* kodiBase, void* handle); 313 bool (*do_modal)(void* kodiBase, void* handle);
@@ -316,6 +316,8 @@ typedef struct AddonToKodiFuncTable_kodi_gui_window
316 bool (*set_focus_id)(void* kodiBase, void* handle, int control_id); 316 bool (*set_focus_id)(void* kodiBase, void* handle, int control_id);
317 int (*get_focus_id)(void* kodiBase, void* handle); 317 int (*get_focus_id)(void* kodiBase, void* handle);
318 void (*set_control_label)(void* kodiBase, void* handle, int control_id, const char* label); 318 void (*set_control_label)(void* kodiBase, void* handle, int control_id, const char* label);
319 void (*set_control_visible)(void* kodiBase, void* handle, int control_id, bool visible);
320 void (*set_control_selected)(void* kodiBase, void* handle, int control_id, bool selected);
319 321
320 /* Window property functions */ 322 /* Window property functions */
321 void (*set_property)(void* kodiBase, void* handle, const char* key, const char* value); 323 void (*set_property)(void* kodiBase, void* handle, const char* key, const char* value);
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
index 26d6386..d545030 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
@@ -66,16 +66,18 @@ namespace dialogs
66 /// fprintf(stderr, "Selected item is: %i\n", selected); 66 /// fprintf(stderr, "Selected item is: %i\n", selected);
67 /// ~~~~~~~~~~~~~ 67 /// ~~~~~~~~~~~~~
68 /// 68 ///
69 inline int Show(const std::string& heading, const std::vector<std::string>& entries) 69 inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
70 const std::vector<std::string>& entries)
70 { 71 {
71 using namespace ::kodi::addon; 72 using namespace ::kodi::addon;
72 unsigned int size = entries.size(); 73 unsigned int size = static_cast<unsigned int>(entries.size());
73 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**))); 74 const char** cEntries = static_cast<const char**>(malloc(size * sizeof(const char**)));
74 for (unsigned int i = 0; i < size; ++i) 75 for (unsigned int i = 0; i < size; ++i)
75 { 76 {
76 cEntries[i] = entries[i].c_str(); 77 cEntries[i] = entries[i].c_str();
77 } 78 }
78 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); 79 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(
80 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size);
79 free(cEntries); 81 free(cEntries);
80 return ret; 82 return ret;
81 } 83 }
@@ -113,10 +115,11 @@ namespace dialogs
113 /// fprintf(stderr, "Selected item is: %i\n", selected); 115 /// fprintf(stderr, "Selected item is: %i\n", selected);
114 /// ~~~~~~~~~~~~~ 116 /// ~~~~~~~~~~~~~
115 /// 117 ///
116 inline int Show(const std::string& heading, const std::vector<std::pair<std::string, std::string>>& entries) 118 inline int ATTRIBUTE_HIDDEN Show(
119 const std::string& heading, const std::vector<std::pair<std::string, std::string>>& entries)
117 { 120 {
118 using namespace ::kodi::addon; 121 using namespace ::kodi::addon;
119 unsigned int size = entries.size(); 122 unsigned int size = static_cast<unsigned int>(entries.size());
120 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**))); 123 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**)));
121 for (unsigned int i = 0; i < size; ++i) 124 for (unsigned int i = 0; i < size; ++i)
122 { 125 {
@@ -160,10 +163,11 @@ namespace dialogs
160 /// fprintf(stderr, "Selected item is: %i\n", selected); 163 /// fprintf(stderr, "Selected item is: %i\n", selected);
161 /// ~~~~~~~~~~~~~ 164 /// ~~~~~~~~~~~~~
162 /// 165 ///
163 inline int Show(const std::string& heading, const std::vector<std::pair<int, std::string>>& entries) 166 inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
167 const std::vector<std::pair<int, std::string>>& entries)
164 { 168 {
165 using namespace ::kodi::addon; 169 using namespace ::kodi::addon;
166 unsigned int size = entries.size(); 170 unsigned int size = static_cast<unsigned int>(entries.size());
167 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**))); 171 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**)));
168 for (unsigned int i = 0; i < size; ++i) 172 for (unsigned int i = 0; i < size; ++i)
169 { 173 {
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
index 417d5db..5a49b70 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
@@ -18,218 +18,232 @@ namespace gui
18namespace dialogs 18namespace dialogs
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22 /// 22///
23 /// \defgroup cpp_kodi_gui_dialogs_CExtendedProgress Dialog Extended Progress 23/// \defgroup cpp_kodi_gui_dialogs_CExtendedProgress Dialog Extended Progress
24 /// \ingroup cpp_kodi_gui 24/// \ingroup cpp_kodi_gui
25 /// @brief \cpp_class{ kodi::gui::dialogs::ExtendedProgress } 25/// @brief \cpp_class{ kodi::gui::dialogs::ExtendedProgress }
26 /// **Progress dialog shown for background work** 26/// **Progress dialog shown for background work**
27///
28/// The with \ref ExtendedProgress.h "#include <kodi/gui/dialogs/ExtendedProgress.h>"
29/// given class are basically used to create Kodi's extended progress.
30///
31///
32/// --------------------------------------------------------------------------
33///
34/// **Example:**
35/// ~~~~~~~~~~~~~{.cpp}
36/// #include <kodi/gui/dialogs/ExtendedProgress.h>
37///
38/// kodi::gui::dialogs::CExtendedProgress *ext_progress = new kodi::gui::dialogs::CExtendedProgress("Test Extended progress");
39/// ext_progress->SetText("Test progress");
40/// for (unsigned int i = 0; i < 50; i += 10)
41/// {
42/// ext_progress->SetProgress(i, 100);
43/// sleep(1);
44/// }
45///
46/// ext_progress->SetTitle("Test Extended progress - Second round");
47/// ext_progress->SetText("Test progress - Step 2");
48///
49/// for (unsigned int i = 50; i < 100; i += 10)
50/// {
51/// ext_progress->SetProgress(i, 100);
52/// sleep(1);
53/// }
54/// delete ext_progress;
55/// ~~~~~~~~~~~~~
56///
57class ATTRIBUTE_HIDDEN CExtendedProgress
58{
59public:
60 //==========================================================================
27 /// 61 ///
28 /// The with \ref ExtendedProgress.h "#include <kodi/gui/dialogs/ExtendedProgress.h>" 62 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
29 /// given class are basically used to create Kodi's extended progress. 63 /// Construct a new dialog
30 /// 64 ///
65 /// @param[in] title Title string
31 /// 66 ///
32 /// -------------------------------------------------------------------------- 67 explicit CExtendedProgress(const std::string& title = "")
68 {
69 using namespace ::kodi::addon;
70 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog(
71 CAddonBase::m_interface->toKodi->kodiBase, title.c_str());
72 if (!m_DialogHandle)
73 kodi::Log(ADDON_LOG_FATAL,
74 "kodi::gui::CDialogExtendedProgress can't create window class from Kodi !!!");
75 }
76 //--------------------------------------------------------------------------
77
78 //==========================================================================
33 /// 79 ///
34 /// **Example:** 80 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
35 /// ~~~~~~~~~~~~~{.cpp} 81 /// Destructor
36 /// #include <kodi/gui/dialogs/ExtendedProgress.h>
37 /// 82 ///
38 /// kodi::gui::dialogs::CExtendedProgress *ext_progress = new kodi::gui::dialogs::CExtendedProgress("Test Extended progress"); 83 ~CExtendedProgress()
39 /// ext_progress->SetText("Test progress"); 84 {
40 /// for (unsigned int i = 0; i < 50; i += 10) 85 using namespace ::kodi::addon;
41 /// { 86 if (m_DialogHandle)
42 /// ext_progress->SetProgress(i, 100); 87 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->delete_dialog(
43 /// sleep(1); 88 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
44 /// } 89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
45 /// 93 ///
46 /// ext_progress->SetTitle("Test Extended progress - Second round"); 94 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
47 /// ext_progress->SetText("Test progress - Step 2"); 95 /// @brief Get the used title
48 /// 96 ///
49 /// for (unsigned int i = 50; i < 100; i += 10) 97 /// @return Title string
50 /// {
51 /// ext_progress->SetProgress(i, 100);
52 /// sleep(1);
53 /// }
54 /// delete ext_progress;
55 /// ~~~~~~~~~~~~~
56 /// 98 ///
57 class CExtendedProgress 99 std::string Title() const
58 { 100 {
59 public: 101 using namespace ::kodi::addon;
60 //========================================================================== 102 std::string text;
61 /// 103 char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_title(
62 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress 104 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
63 /// Construct a new dialog 105 if (strMsg != nullptr)
64 ///
65 /// @param[in] title Title string
66 ///
67 explicit CExtendedProgress(const std::string& title = "")
68 {
69 using namespace ::kodi::addon;
70 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog(CAddonBase::m_interface->toKodi->kodiBase, title.c_str());
71 if (!m_DialogHandle)
72 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CDialogExtendedProgress can't create window class from Kodi !!!");
73 }
74 //--------------------------------------------------------------------------
75
76 //==========================================================================
77 ///
78 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
79 /// Destructor
80 ///
81 ~CExtendedProgress()
82 {
83 using namespace ::kodi::addon;
84 if (m_DialogHandle)
85 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->delete_dialog(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
86 }
87 //--------------------------------------------------------------------------
88
89 //==========================================================================
90 ///
91 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
92 /// @brief Get the used title
93 ///
94 /// @return Title string
95 ///
96 std::string Title() const
97 {
98 using namespace ::kodi::addon;
99 std::string text;
100 char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_title(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
101 if (strMsg != nullptr)
102 {
103 if (std::strlen(strMsg))
104 text = strMsg;
105 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, strMsg);
106 }
107 return text;
108 }
109 //--------------------------------------------------------------------------
110
111 //==========================================================================
112 ///
113 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
114 /// @brief To set the title of dialog
115 ///
116 /// @param[in] title Title string
117 ///
118 void SetTitle(const std::string& title)
119 {
120 using namespace ::kodi::addon;
121 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_title(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, title.c_str());
122 }
123 //--------------------------------------------------------------------------
124
125 //==========================================================================
126 ///
127 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
128 /// @brief Get the used text information string
129 ///
130 /// @return Text string
131 ///
132 std::string Text() const
133 {
134 using namespace ::kodi::addon;
135 std::string text;
136 char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_text(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
137 if (strMsg != nullptr)
138 {
139 if (std::strlen(strMsg))
140 text = strMsg;
141 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, strMsg);
142 }
143 return text;
144 }
145 //--------------------------------------------------------------------------
146
147 //==========================================================================
148 ///
149 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
150 /// @brief To set the used text information string
151 ///
152 /// @param[in] text information text to set
153 ///
154 void SetText(const std::string& text)
155 {
156 using namespace ::kodi::addon;
157 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_text(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, text.c_str());
158 }
159 //--------------------------------------------------------------------------
160
161 //==========================================================================
162 ///
163 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
164 /// @brief To ask dialog is finished
165 ///
166 /// @return True if on end
167 ///
168 bool IsFinished() const
169 {
170 using namespace ::kodi::addon;
171 return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->is_finished(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
172 }
173 //--------------------------------------------------------------------------
174
175 //==========================================================================
176 ///
177 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
178 /// @brief Mark progress finished
179 ///
180 void MarkFinished()
181 {
182 using namespace ::kodi::addon;
183 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->mark_finished(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
184 }
185 //--------------------------------------------------------------------------
186
187 //==========================================================================
188 ///
189 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
190 /// @brief Get the current progress position as percent
191 ///
192 /// @return Position
193 ///
194 float Percentage() const
195 {
196 using namespace ::kodi::addon;
197 return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_percentage(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
198 }
199 //--------------------------------------------------------------------------
200
201 //==========================================================================
202 ///
203 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
204 /// @brief To set the current progress position as percent
205 ///
206 /// @param[in] percentage Position to use from 0.0 to 100.0
207 ///
208 void SetPercentage(float percentage)
209 { 106 {
210 using namespace ::kodi::addon; 107 if (std::strlen(strMsg))
211 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_percentage(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage); 108 text = strMsg;
109 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
110 strMsg);
212 } 111 }
213 //-------------------------------------------------------------------------- 112 return text;
214 113 }
215 //========================================================================== 114 //--------------------------------------------------------------------------
216 /// 115
217 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress 116 //==========================================================================
218 /// @brief To set progress position with predefined places 117 ///
219 /// 118 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
220 /// @param[in] currentItem Place position to use 119 /// @brief To set the title of dialog
221 /// @param[in] itemCount Amount of used places 120 ///
222 /// 121 /// @param[in] title Title string
223 void SetProgress(int currentItem, int itemCount) 122 ///
123 void SetTitle(const std::string& title)
124 {
125 using namespace ::kodi::addon;
126 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_title(
127 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, title.c_str());
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
134 /// @brief Get the used text information string
135 ///
136 /// @return Text string
137 ///
138 std::string Text() const
139 {
140 using namespace ::kodi::addon;
141 std::string text;
142 char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_text(
143 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
144 if (strMsg != nullptr)
224 { 145 {
225 using namespace ::kodi::addon; 146 if (std::strlen(strMsg))
226 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_progress(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, currentItem, itemCount); 147 text = strMsg;
148 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
149 strMsg);
227 } 150 }
228 //-------------------------------------------------------------------------- 151 return text;
152 }
153 //--------------------------------------------------------------------------
154
155 //==========================================================================
156 ///
157 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
158 /// @brief To set the used text information string
159 ///
160 /// @param[in] text information text to set
161 ///
162 void SetText(const std::string& text)
163 {
164 using namespace ::kodi::addon;
165 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_text(
166 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, text.c_str());
167 }
168 //--------------------------------------------------------------------------
169
170 //==========================================================================
171 ///
172 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
173 /// @brief To ask dialog is finished
174 ///
175 /// @return True if on end
176 ///
177 bool IsFinished() const
178 {
179 using namespace ::kodi::addon;
180 return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->is_finished(
181 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
182 }
183 //--------------------------------------------------------------------------
184
185 //==========================================================================
186 ///
187 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
188 /// @brief Mark progress finished
189 ///
190 void MarkFinished()
191 {
192 using namespace ::kodi::addon;
193 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->mark_finished(
194 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
195 }
196 //--------------------------------------------------------------------------
197
198 //==========================================================================
199 ///
200 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
201 /// @brief Get the current progress position as percent
202 ///
203 /// @return Position
204 ///
205 float Percentage() const
206 {
207 using namespace ::kodi::addon;
208 return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_percentage(
209 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
210 }
211 //--------------------------------------------------------------------------
229 212
230 private: 213 //==========================================================================
231 void* m_DialogHandle; 214 ///
232 }; 215 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
216 /// @brief To set the current progress position as percent
217 ///
218 /// @param[in] percentage Position to use from 0.0 to 100.0
219 ///
220 void SetPercentage(float percentage)
221 {
222 using namespace ::kodi::addon;
223 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_percentage(
224 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage);
225 }
226 //--------------------------------------------------------------------------
227
228 //==========================================================================
229 ///
230 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
231 /// @brief To set progress position with predefined places
232 ///
233 /// @param[in] currentItem Place position to use
234 /// @param[in] itemCount Amount of used places
235 ///
236 void SetProgress(int currentItem, int itemCount)
237 {
238 using namespace ::kodi::addon;
239 CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_progress(
240 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, currentItem, itemCount);
241 }
242 //--------------------------------------------------------------------------
243
244private:
245 void* m_DialogHandle;
246};
233 247
234} /* namespace dialogs */ 248} /* namespace dialogs */
235} /* namespace gui */ 249} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
index bb1065d..90da063 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
@@ -71,17 +71,22 @@ namespace dialogs
71 /// fprintf(stderr, "Selected directory is : %s and was %s\n", directory.c_str(), ret ? "OK" : "Canceled"); 71 /// fprintf(stderr, "Selected directory is : %s and was %s\n", directory.c_str(), ret ? "OK" : "Canceled");
72 /// ~~~~~~~~~~~~~ 72 /// ~~~~~~~~~~~~~
73 /// 73 ///
74 inline bool ShowAndGetDirectory(const std::string& shares, const std::string& heading, std::string& path, bool writeOnly = false) 74 inline bool ATTRIBUTE_HIDDEN ShowAndGetDirectory(const std::string& shares,
75 const std::string& heading,
76 std::string& path,
77 bool writeOnly = false)
75 { 78 {
76 using namespace ::kodi::addon; 79 using namespace ::kodi::addon;
77 char* retString = nullptr; 80 char* retString = nullptr;
78 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_directory(CAddonBase::m_interface->toKodi->kodiBase, 81 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_directory(
79 shares.c_str(), heading.c_str(), path.c_str(), &retString, writeOnly); 82 CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), heading.c_str(), path.c_str(),
83 &retString, writeOnly);
80 if (retString != nullptr) 84 if (retString != nullptr)
81 { 85 {
82 if (std::strlen(retString)) 86 if (std::strlen(retString))
83 path = retString; 87 path = retString;
84 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); 88 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
89 retString);
85 } 90 }
86 return ret; 91 return ret;
87 } 92 }
@@ -104,8 +109,12 @@ namespace dialogs
104 /// handled as directories. 109 /// handled as directories.
105 /// @return False if selection becomes canceled. 110 /// @return False if selection becomes canceled.
106 /// 111 ///
107 inline bool ShowAndGetFile(const std::string& shares, const std::string& mask, const std::string& heading, 112 inline bool ATTRIBUTE_HIDDEN ShowAndGetFile(const std::string& shares,
108 std::string& path, bool useThumbs = false, bool useFileDirectories = false) 113 const std::string& mask,
114 const std::string& heading,
115 std::string& path,
116 bool useThumbs = false,
117 bool useFileDirectories = false)
109 { 118 {
110 using namespace ::kodi::addon; 119 using namespace ::kodi::addon;
111 char* retString = nullptr; 120 char* retString = nullptr;
@@ -141,8 +150,13 @@ namespace dialogs
141 /// @param[in] singleList 150 /// @param[in] singleList
142 /// @return False if selection becomes canceled. 151 /// @return False if selection becomes canceled.
143 /// 152 ///
144 inline bool ShowAndGetFileFromDir(const std::string& directory, const std::string& mask, const std::string& heading, std::string& path, 153 inline bool ATTRIBUTE_HIDDEN ShowAndGetFileFromDir(const std::string& directory,
145 bool useThumbs = false, bool useFileDirectories = false, bool singleList = false) 154 const std::string& mask,
155 const std::string& heading,
156 std::string& path,
157 bool useThumbs = false,
158 bool useFileDirectories = false,
159 bool singleList = false)
146 { 160 {
147 using namespace ::kodi::addon; 161 using namespace ::kodi::addon;
148 char* retString = nullptr; 162 char* retString = nullptr;
@@ -176,8 +190,12 @@ namespace dialogs
176 /// handled as directories. 190 /// handled as directories.
177 /// @return False if selection becomes canceled. 191 /// @return False if selection becomes canceled.
178 /// 192 ///
179 inline bool ShowAndGetFileList(const std::string& shares, const std::string& mask, const std::string& heading, 193 inline bool ATTRIBUTE_HIDDEN ShowAndGetFileList(const std::string& shares,
180 std::vector<std::string>& fileList, bool useThumbs = false, bool useFileDirectories = false) 194 const std::string& mask,
195 const std::string& heading,
196 std::vector<std::string>& fileList,
197 bool useThumbs = false,
198 bool useFileDirectories = false)
181 { 199 {
182 using namespace ::kodi::addon; 200 using namespace ::kodi::addon;
183 char** list = nullptr; 201 char** list = nullptr;
@@ -188,7 +206,7 @@ namespace dialogs
188 if (ret) 206 if (ret)
189 { 207 {
190 for (unsigned int i = 0; i < listSize; ++i) 208 for (unsigned int i = 0; i < listSize; ++i)
191 fileList.push_back(list[i]); 209 fileList.emplace_back(list[i]);
192 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize); 210 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize);
193 } 211 }
194 return ret; 212 return ret;
@@ -208,7 +226,10 @@ namespace dialogs
208 /// @param[in] type 226 /// @param[in] type
209 /// @return False if selection becomes canceled. 227 /// @return False if selection becomes canceled.
210 /// 228 ///
211 inline bool ShowAndGetSource(std::string& path, bool allowNetworkShares, const std::string& additionalShare = "", const std::string& type = "") 229 inline bool ATTRIBUTE_HIDDEN ShowAndGetSource(std::string& path,
230 bool allowNetworkShares,
231 const std::string& additionalShare = "",
232 const std::string& type = "")
212 { 233 {
213 using namespace ::kodi::addon; 234 using namespace ::kodi::addon;
214 char* retString = nullptr; 235 char* retString = nullptr;
@@ -235,7 +256,9 @@ namespace dialogs
235 /// @param[out] path Return value about selected image 256 /// @param[out] path Return value about selected image
236 /// @return False if selection becomes canceled. 257 /// @return False if selection becomes canceled.
237 /// 258 ///
238 inline bool ShowAndGetImage(const std::string& shares, const std::string& heading, std::string& path) 259 inline bool ATTRIBUTE_HIDDEN ShowAndGetImage(const std::string& shares,
260 const std::string& heading,
261 std::string& path)
239 { 262 {
240 using namespace ::kodi::addon; 263 using namespace ::kodi::addon;
241 char* retString = nullptr; 264 char* retString = nullptr;
@@ -262,7 +285,9 @@ namespace dialogs
262 /// @param[out] file_list Return value about selected images 285 /// @param[out] file_list Return value about selected images
263 /// @return False if selection becomes canceled. 286 /// @return False if selection becomes canceled.
264 /// 287 ///
265 inline bool ShowAndGetImageList(const std::string& shares, const std::string& heading, std::vector<std::string>& file_list) 288 inline bool ATTRIBUTE_HIDDEN ShowAndGetImageList(const std::string& shares,
289 const std::string& heading,
290 std::vector<std::string>& file_list)
266 { 291 {
267 using namespace ::kodi::addon; 292 using namespace ::kodi::addon;
268 char** list = nullptr; 293 char** list = nullptr;
@@ -272,7 +297,7 @@ namespace dialogs
272 if (ret) 297 if (ret)
273 { 298 {
274 for (unsigned int i = 0; i < listSize; ++i) 299 for (unsigned int i = 0; i < listSize; ++i)
275 file_list.push_back(list[i]); 300 file_list.emplace_back(list[i]);
276 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize); 301 CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize);
277 } 302 }
278 return ret; 303 return ret;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h
index 76284d8..843bdfa 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h
@@ -76,17 +76,23 @@ namespace dialogs
76 /// text.c_str(), bRet ? "OK" : "Canceled"); 76 /// text.c_str(), bRet ? "OK" : "Canceled");
77 /// ~~~~~~~~~~~~~ 77 /// ~~~~~~~~~~~~~
78 /// 78 ///
79 inline bool ShowAndGetInput(std::string& text, const std::string& heading, bool allowEmptyResult, bool hiddenInput = false, unsigned int autoCloseMs = 0) 79 inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text,
80 const std::string& heading,
81 bool allowEmptyResult,
82 bool hiddenInput = false,
83 unsigned int autoCloseMs = 0)
80 { 84 {
81 using namespace ::kodi::addon; 85 using namespace ::kodi::addon;
82 char* retString = nullptr; 86 char* retString = nullptr;
83 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input_with_head(CAddonBase::m_interface->toKodi->kodiBase, 87 bool ret =
84 text.c_str(), &retString, heading.c_str(), allowEmptyResult, 88 CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input_with_head(
85 hiddenInput, autoCloseMs); 89 CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, heading.c_str(),
90 allowEmptyResult, hiddenInput, autoCloseMs);
86 if (retString != nullptr) 91 if (retString != nullptr)
87 { 92 {
88 text = retString; 93 text = retString;
89 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); 94 CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase,
95 retString);
90 } 96 }
91 return ret; 97 return ret;
92 } 98 }
@@ -108,7 +114,9 @@ namespace dialogs
108 /// false if unsuccessful display, no user 114 /// false if unsuccessful display, no user
109 /// input, or canceled editing. 115 /// input, or canceled editing.
110 /// 116 ///
111 inline bool ShowAndGetInput(std::string& text, bool allowEmptyResult, unsigned int autoCloseMs = 0) 117 inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text,
118 bool allowEmptyResult,
119 unsigned int autoCloseMs = 0)
112 { 120 {
113 using namespace ::kodi::addon; 121 using namespace ::kodi::addon;
114 char* retString = nullptr; 122 char* retString = nullptr;
@@ -140,7 +148,10 @@ namespace dialogs
140 /// false if unsuccessful display, no user 148 /// false if unsuccessful display, no user
141 /// input, or canceled editing. 149 /// input, or canceled editing.
142 /// 150 ///
143 inline bool ShowAndGetNewPassword(std::string& newPassword, const std::string& heading, bool allowEmptyResult, unsigned int autoCloseMs = 0) 151 inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword,
152 const std::string& heading,
153 bool allowEmptyResult,
154 unsigned int autoCloseMs = 0)
144 { 155 {
145 using namespace ::kodi::addon; 156 using namespace ::kodi::addon;
146 char* retString = nullptr; 157 char* retString = nullptr;
@@ -170,7 +181,8 @@ namespace dialogs
170 /// false if unsuccessful display, no user 181 /// false if unsuccessful display, no user
171 /// input, or canceled editing. 182 /// input, or canceled editing.
172 /// 183 ///
173 inline bool ShowAndGetNewPassword(std::string& newPassword, unsigned int autoCloseMs = 0) 184 inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword,
185 unsigned int autoCloseMs = 0)
174 { 186 {
175 using namespace ::kodi::addon; 187 using namespace ::kodi::addon;
176 char* retString = nullptr; 188 char* retString = nullptr;
@@ -251,7 +263,10 @@ namespace dialogs
251 /// } 263 /// }
252 /// ~~~~~~~~~~~~~ 264 /// ~~~~~~~~~~~~~
253 /// 265 ///
254 inline bool ShowAndVerifyNewPassword(std::string& newPassword, const std::string& heading, bool allowEmptyResult, unsigned int autoCloseMs = 0) 266 inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword,
267 const std::string& heading,
268 bool allowEmptyResult,
269 unsigned int autoCloseMs = 0)
255 { 270 {
256 using namespace ::kodi::addon; 271 using namespace ::kodi::addon;
257 char* retString = nullptr; 272 char* retString = nullptr;
@@ -281,7 +296,8 @@ namespace dialogs
281 /// false if unsuccessful display, no user 296 /// false if unsuccessful display, no user
282 /// input, or canceled editing. 297 /// input, or canceled editing.
283 /// 298 ///
284 inline bool ShowAndVerifyNewPassword(std::string& newPassword, unsigned int autoCloseMs = 0) 299 inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword,
300 unsigned int autoCloseMs = 0)
285 { 301 {
286 using namespace ::kodi::addon; 302 using namespace ::kodi::addon;
287 char* retString = nullptr; 303 char* retString = nullptr;
@@ -313,7 +329,10 @@ namespace dialogs
313 /// unsuccessful input. -1 if no user input or 329 /// unsuccessful input. -1 if no user input or
314 /// canceled editing. 330 /// canceled editing.
315 /// 331 ///
316 inline int ShowAndVerifyPassword(std::string& password, const std::string& heading, int retries, unsigned int autoCloseMs = 0) 332 inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(std::string& password,
333 const std::string& heading,
334 int retries,
335 unsigned int autoCloseMs = 0)
317 { 336 {
318 using namespace ::kodi::addon; 337 using namespace ::kodi::addon;
319 char* retString = nullptr; 338 char* retString = nullptr;
@@ -347,7 +366,9 @@ namespace dialogs
347 /// false if unsuccessful display, no user 366 /// false if unsuccessful display, no user
348 /// input, or canceled editing. 367 /// input, or canceled editing.
349 /// 368 ///
350 inline bool ShowAndGetFilter(std::string& text, bool searching, unsigned int autoCloseMs = 0) 369 inline bool ATTRIBUTE_HIDDEN ShowAndGetFilter(std::string& text,
370 bool searching,
371 unsigned int autoCloseMs = 0)
351 { 372 {
352 using namespace ::kodi::addon; 373 using namespace ::kodi::addon;
353 char* retString = nullptr; 374 char* retString = nullptr;
@@ -372,7 +393,8 @@ namespace dialogs
372 /// @return true if successful done, false if 393 /// @return true if successful done, false if
373 /// unsuccessful or keyboard not present. 394 /// unsuccessful or keyboard not present.
374 /// 395 ///
375 inline bool SendTextToActiveKeyboard(const std::string& text, bool closeKeyboard = false) 396 inline bool ATTRIBUTE_HIDDEN SendTextToActiveKeyboard(const std::string& text,
397 bool closeKeyboard = false)
376 { 398 {
377 using namespace ::kodi::addon; 399 using namespace ::kodi::addon;
378 return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->send_text_to_active_keyboard(CAddonBase::m_interface->toKodi->kodiBase, 400 return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->send_text_to_active_keyboard(CAddonBase::m_interface->toKodi->kodiBase,
@@ -387,7 +409,7 @@ namespace dialogs
387 /// 409 ///
388 /// @return true if keyboard present, false if not present 410 /// @return true if keyboard present, false if not present
389 /// 411 ///
390 inline bool IsKeyboardActivated() 412 inline bool ATTRIBUTE_HIDDEN IsKeyboardActivated()
391 { 413 {
392 using namespace ::kodi::addon; 414 using namespace ::kodi::addon;
393 return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->is_keyboard_activated(CAddonBase::m_interface->toKodi->kodiBase); 415 return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->is_keyboard_activated(CAddonBase::m_interface->toKodi->kodiBase);
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h
index 4a8eccb..bff7683 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h
@@ -50,11 +50,13 @@ namespace dialogs
50 /// false if unsuccessful display, no user 50 /// false if unsuccessful display, no user
51 /// input, or canceled editing. 51 /// input, or canceled editing.
52 /// 52 ///
53 inline bool ShowAndVerifyNewPassword(std::string& newPassword) 53 inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword)
54 { 54 {
55 using namespace ::kodi::addon; 55 using namespace ::kodi::addon;
56 char* pw = nullptr; 56 char* pw = nullptr;
57 bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_new_password(CAddonBase::m_interface->toKodi->kodiBase, &pw); 57 bool ret =
58 CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_new_password(
59 CAddonBase::m_interface->toKodi->kodiBase, &pw);
58 if (pw != nullptr) 60 if (pw != nullptr)
59 { 61 {
60 newPassword = pw; 62 newPassword = pw;
@@ -131,7 +133,9 @@ namespace dialogs
131 /// } 133 /// }
132 /// ~~~~~~~~~~~~~ 134 /// ~~~~~~~~~~~~~
133 /// 135 ///
134 inline int ShowAndVerifyPassword(const std::string& password, const std::string& heading, int retries) 136 inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(const std::string& password,
137 const std::string& heading,
138 int retries)
135 { 139 {
136 using namespace ::kodi::addon; 140 using namespace ::kodi::addon;
137 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_password(CAddonBase::m_interface->toKodi->kodiBase, 141 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_password(CAddonBase::m_interface->toKodi->kodiBase,
@@ -152,7 +156,9 @@ namespace dialogs
152 /// input. false if unsuccessful display, no 156 /// input. false if unsuccessful display, no
153 /// user input, or canceled editing. 157 /// user input, or canceled editing.
154 /// 158 ///
155 inline bool ShowAndVerifyInput(std::string& toVerify, const std::string& heading, bool verifyInput) 159 inline bool ATTRIBUTE_HIDDEN ShowAndVerifyInput(std::string& toVerify,
160 const std::string& heading,
161 bool verifyInput)
156 { 162 {
157 using namespace ::kodi::addon; 163 using namespace ::kodi::addon;
158 char* retString = nullptr; 164 char* retString = nullptr;
@@ -199,7 +205,7 @@ namespace dialogs
199 /// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); 205 /// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled");
200 /// ~~~~~~~~~~~~~ 206 /// ~~~~~~~~~~~~~
201 /// 207 ///
202 inline bool ShowAndGetTime(tm& time, const std::string& heading) 208 inline bool ATTRIBUTE_HIDDEN ShowAndGetTime(tm& time, const std::string& heading)
203 { 209 {
204 using namespace ::kodi::addon; 210 using namespace ::kodi::addon;
205 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_time(CAddonBase::m_interface->toKodi->kodiBase, &time, heading.c_str()); 211 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_time(CAddonBase::m_interface->toKodi->kodiBase, &time, heading.c_str());
@@ -238,7 +244,7 @@ namespace dialogs
238 /// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); 244 /// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled");
239 /// ~~~~~~~~~~~~~ 245 /// ~~~~~~~~~~~~~
240 /// 246 ///
241 inline bool ShowAndGetDate(tm& date, const std::string& heading) 247 inline bool ATTRIBUTE_HIDDEN ShowAndGetDate(tm& date, const std::string& heading)
242 { 248 {
243 using namespace ::kodi::addon; 249 using namespace ::kodi::addon;
244 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_date(CAddonBase::m_interface->toKodi->kodiBase, &date, heading.c_str()); 250 return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_date(CAddonBase::m_interface->toKodi->kodiBase, &date, heading.c_str());
@@ -258,7 +264,8 @@ namespace dialogs
258 /// display, no user input, or canceled 264 /// display, no user input, or canceled
259 /// editing. 265 /// editing.
260 /// 266 ///
261 inline bool ShowAndGetIPAddress(std::string& ipAddress, const std::string& heading) 267 inline bool ATTRIBUTE_HIDDEN ShowAndGetIPAddress(std::string& ipAddress,
268 const std::string& heading)
262 { 269 {
263 using namespace ::kodi::addon; 270 using namespace ::kodi::addon;
264 char* retString = nullptr; 271 char* retString = nullptr;
@@ -304,7 +311,9 @@ namespace dialogs
304 /// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled"); 311 /// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled");
305 /// ~~~~~~~~~~~~~ 312 /// ~~~~~~~~~~~~~
306 /// 313 ///
307 inline bool ShowAndGetNumber(std::string& input, const std::string& heading, unsigned int autoCloseTimeoutMs = 0) 314 inline bool ATTRIBUTE_HIDDEN ShowAndGetNumber(std::string& input,
315 const std::string& heading,
316 unsigned int autoCloseTimeoutMs = 0)
308 { 317 {
309 using namespace ::kodi::addon; 318 using namespace ::kodi::addon;
310 char* retString = nullptr; 319 char* retString = nullptr;
@@ -331,7 +340,7 @@ namespace dialogs
331 /// if unsuccessful display, no user input, or 340 /// if unsuccessful display, no user input, or
332 /// canceled editing. 341 /// canceled editing.
333 /// 342 ///
334 inline bool ShowAndGetSeconds(std::string& time, const std::string& heading) 343 inline bool ATTRIBUTE_HIDDEN ShowAndGetSeconds(std::string& time, const std::string& heading)
335 { 344 {
336 using namespace ::kodi::addon; 345 using namespace ::kodi::addon;
337 char* retString = nullptr; 346 char* retString = nullptr;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h
index a47880f..b9a3a0d 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h
@@ -52,11 +52,11 @@ namespace dialogs
52 /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D"); 52 /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D");
53 /// ~~~~~~~~~~~~~ 53 /// ~~~~~~~~~~~~~
54 /// 54 ///
55 inline void ShowAndGetInput(const std::string& heading, const std::string& text) 55 inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, const std::string& text)
56 { 56 {
57 using namespace ::kodi::addon; 57 using namespace ::kodi::addon;
58 CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_single_text(CAddonBase::m_interface->toKodi->kodiBase, 58 CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_single_text(
59 heading.c_str(), text.c_str()); 59 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str());
60 } 60 }
61 //-------------------------------------------------------------------------- 61 //--------------------------------------------------------------------------
62 62
@@ -80,7 +80,10 @@ namespace dialogs
80 /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D"); 80 /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D");
81 /// ~~~~~~~~~~~~~ 81 /// ~~~~~~~~~~~~~
82 /// 82 ///
83 inline void ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2) 83 inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
84 const std::string& line0,
85 const std::string& line1,
86 const std::string& line2)
84 { 87 {
85 using namespace ::kodi::addon; 88 using namespace ::kodi::addon;
86 CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase, 89 CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase,
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h
index bbaa98d..b1f8cc5 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h
@@ -18,223 +18,237 @@ namespace gui
18namespace dialogs 18namespace dialogs
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22 /// 22///
23 /// \defgroup cpp_kodi_gui_dialogs_CProgress Dialog Progress 23/// \defgroup cpp_kodi_gui_dialogs_CProgress Dialog Progress
24 /// \ingroup cpp_kodi_gui 24/// \ingroup cpp_kodi_gui
25 /// @brief \cpp_class{ kodi::gui::dialogs::CProgress } 25/// @brief \cpp_class{ kodi::gui::dialogs::CProgress }
26 /// **Progress dialog shown in center** 26/// **Progress dialog shown in center**
27 /// 27///
28 /// The with \ref DialogProgress.h "#include <kodi/gui/dialogs/Progress.h>" 28/// The with \ref DialogProgress.h "#include <kodi/gui/dialogs/Progress.h>"
29 /// given class are basically used to create Kodi's progress dialog with named 29/// given class are basically used to create Kodi's progress dialog with named
30 /// text fields. 30/// text fields.
31 /// 31///
32 /// **Example:** 32/// **Example:**
33 /// ~~~~~~~~~~~~~{.cpp} 33/// ~~~~~~~~~~~~~{.cpp}
34 /// #include <kodi/gui/dialogs/Progress.h> 34/// #include <kodi/gui/dialogs/Progress.h>
35 /// 35///
36 /// kodi::gui::dialogs::CProgress *progress = new kodi::gui::dialogs::CProgress; 36/// kodi::gui::dialogs::CProgress *progress = new kodi::gui::dialogs::CProgress;
37 /// progress->SetHeading("Test progress"); 37/// progress->SetHeading("Test progress");
38 /// progress->SetLine(1, "line 1"); 38/// progress->SetLine(1, "line 1");
39 /// progress->SetLine(2, "line 2"); 39/// progress->SetLine(2, "line 2");
40 /// progress->SetLine(3, "line 3"); 40/// progress->SetLine(3, "line 3");
41 /// progress->SetCanCancel(true); 41/// progress->SetCanCancel(true);
42 /// progress->ShowProgressBar(true); 42/// progress->ShowProgressBar(true);
43 /// progress->Open(); 43/// progress->Open();
44 /// for (unsigned int i = 0; i < 100; i += 10) 44/// for (unsigned int i = 0; i < 100; i += 10)
45 /// { 45/// {
46 /// progress->SetPercentage(i); 46/// progress->SetPercentage(i);
47 /// sleep(1); 47/// sleep(1);
48 /// } 48/// }
49 /// delete progress; 49/// delete progress;
50 /// ~~~~~~~~~~~~~ 50/// ~~~~~~~~~~~~~
51 /// 51///
52 class CProgress 52class ATTRIBUTE_HIDDEN CProgress
53{
54public:
55 //==========================================================================
56 ///
57 /// \ingroup cpp_kodi_gui_dialogs_CProgress
58 /// @brief Construct a new dialog
59 ///
60 CProgress()
61 {
62 using namespace ::kodi::addon;
63 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog(
64 CAddonBase::m_interface->toKodi->kodiBase);
65 if (!m_DialogHandle)
66 kodi::Log(ADDON_LOG_FATAL,
67 "kodi::gui::dialogs::CProgress can't create window class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_dialogs_CProgress
74 /// @brief Destructor
75 ///
76 ~CProgress()
77 {
78 using namespace ::kodi::addon;
79 if (m_DialogHandle)
80 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->delete_dialog(
81 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
82 }
83 //--------------------------------------------------------------------------
84
85 //==========================================================================
86 ///
87 /// \ingroup cpp_kodi_gui_dialogs_CProgress
88 /// @brief To open the dialog
89 ///
90 void Open()
91 {
92 using namespace ::kodi::addon;
93 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->open(
94 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
95 }
96 //--------------------------------------------------------------------------
97
98 //==========================================================================
99 ///
100 /// \ingroup cpp_kodi_gui_dialogs_CProgress
101 /// @brief Set the heading title of dialog
102 ///
103 /// @param[in] heading Title string to use
104 ///
105 void SetHeading(const std::string& heading)
106 {
107 using namespace ::kodi::addon;
108 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_heading(
109 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, heading.c_str());
110 }
111 //--------------------------------------------------------------------------
112
113 //==========================================================================
114 ///
115 /// \ingroup cpp_kodi_gui_dialogs_CProgress
116 /// @brief To set the line text field on dialog from 0 - 2
117 ///
118 /// @param[in] iLine Line number
119 /// @param[in] line Text string
120 ///
121 void SetLine(unsigned int iLine, const std::string& line)
122 {
123 using namespace ::kodi::addon;
124 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_line(
125 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, iLine, line.c_str());
126 }
127 //--------------------------------------------------------------------------
128
129 //==========================================================================
130 ///
131 /// \ingroup cpp_kodi_gui_dialogs_CProgress
132 /// @brief To enable and show cancel button on dialog
133 ///
134 /// @param[in] canCancel if true becomes it shown
135 ///
136 void SetCanCancel(bool canCancel)
137 {
138 using namespace ::kodi::addon;
139 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_can_cancel(
140 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, canCancel);
141 }
142 //--------------------------------------------------------------------------
143
144 //==========================================================================
145 ///
146 /// \ingroup cpp_kodi_gui_dialogs_CProgress
147 /// @brief To check dialog for clicked cancel button
148 ///
149 /// @return True if canceled
150 ///
151 bool IsCanceled() const
152 {
153 using namespace ::kodi::addon;
154 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->is_canceled(
155 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
156 }
157 //--------------------------------------------------------------------------
158
159 //==========================================================================
160 ///
161 /// \ingroup cpp_kodi_gui_dialogs_CProgress
162 /// @brief Get the current progress position as percent
163 ///
164 /// @param[in] percentage Position to use from 0 to 100
165 ///
166 void SetPercentage(int percentage)
167 {
168 using namespace ::kodi::addon;
169 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_percentage(
170 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage);
171 }
172 //--------------------------------------------------------------------------
173
174 //==========================================================================
175 ///
176 /// \ingroup cpp_kodi_gui_dialogs_CProgress
177 /// @brief To set the current progress position as percent
178 ///
179 /// @return Current Position used from 0 to 100
180 ///
181 int GetPercentage() const
182 {
183 using namespace ::kodi::addon;
184 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->get_percentage(
185 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
186 }
187 //--------------------------------------------------------------------------
188
189 //==========================================================================
190 ///
191 /// \ingroup cpp_kodi_gui_dialogs_CProgress
192 /// @brief To show or hide progress bar dialog
193 ///
194 /// @param[in] onOff If true becomes it shown
195 ///
196 void ShowProgressBar(bool onOff)
197 {
198 using namespace ::kodi::addon;
199 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->show_progress_bar(
200 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, onOff);
201 }
202 //--------------------------------------------------------------------------
203
204 //==========================================================================
205 ///
206 /// \ingroup cpp_kodi_gui_dialogs_CProgress
207 /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used
208 ///
209 /// @param[in] max Biggest usable position to use
210 ///
211 void SetProgressMax(int max)
212 {
213 using namespace ::kodi::addon;
214 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_max(
215 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, max);
216 }
217 //--------------------------------------------------------------------------
218
219 //==========================================================================
220 ///
221 /// \ingroup cpp_kodi_gui_dialogs_CProgress
222 /// @brief To increase progress bar by defined step size until reach of maximum position
223 ///
224 /// @param[in] steps Step size to increase, default is 1
225 ///
226 void SetProgressAdvance(int steps = 1)
227 {
228 using namespace ::kodi::addon;
229 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_advance(
230 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, steps);
231 }
232 //--------------------------------------------------------------------------
233
234 //==========================================================================
235 ///
236 /// \ingroup cpp_kodi_gui_dialogs_CProgress
237 /// @brief To check progress was canceled on work
238 ///
239 /// @return True if aborted
240 ///
241 bool Abort()
53 { 242 {
54 public: 243 using namespace ::kodi::addon;
55 //========================================================================== 244 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->abort(
56 /// 245 CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
57 /// \ingroup cpp_kodi_gui_dialogs_CProgress 246 }
58 /// @brief Construct a new dialog 247 //--------------------------------------------------------------------------
59 /// 248
60 CProgress() 249private:
61 { 250 void* m_DialogHandle;
62 using namespace ::kodi::addon; 251};
63 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog(CAddonBase::m_interface->toKodi->kodiBase);
64 if (!m_DialogHandle)
65 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::dialogs::CProgress can't create window class from Kodi !!!");
66 }
67 //--------------------------------------------------------------------------
68
69 //==========================================================================
70 ///
71 /// \ingroup cpp_kodi_gui_dialogs_CProgress
72 /// @brief Destructor
73 ///
74 ~CProgress()
75 {
76 using namespace ::kodi::addon;
77 if (m_DialogHandle)
78 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->delete_dialog(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
79 }
80 //--------------------------------------------------------------------------
81
82 //==========================================================================
83 ///
84 /// \ingroup cpp_kodi_gui_dialogs_CProgress
85 /// @brief To open the dialog
86 ///
87 void Open()
88 {
89 using namespace ::kodi::addon;
90 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->open(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
91 }
92 //--------------------------------------------------------------------------
93
94 //==========================================================================
95 ///
96 /// \ingroup cpp_kodi_gui_dialogs_CProgress
97 /// @brief Set the heading title of dialog
98 ///
99 /// @param[in] heading Title string to use
100 ///
101 void SetHeading(const std::string& heading)
102 {
103 using namespace ::kodi::addon;
104 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_heading(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, heading.c_str());
105 }
106 //--------------------------------------------------------------------------
107
108 //==========================================================================
109 ///
110 /// \ingroup cpp_kodi_gui_dialogs_CProgress
111 /// @brief To set the line text field on dialog from 0 - 2
112 ///
113 /// @param[in] iLine Line number
114 /// @param[in] line Text string
115 ///
116 void SetLine(unsigned int iLine, const std::string& line)
117 {
118 using namespace ::kodi::addon;
119 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_line(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, iLine, line.c_str());
120 }
121 //--------------------------------------------------------------------------
122
123 //==========================================================================
124 ///
125 /// \ingroup cpp_kodi_gui_dialogs_CProgress
126 /// @brief To enable and show cancel button on dialog
127 ///
128 /// @param[in] canCancel if true becomes it shown
129 ///
130 void SetCanCancel(bool canCancel)
131 {
132 using namespace ::kodi::addon;
133 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_can_cancel(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, canCancel);
134 }
135 //--------------------------------------------------------------------------
136
137 //==========================================================================
138 ///
139 /// \ingroup cpp_kodi_gui_dialogs_CProgress
140 /// @brief To check dialog for clicked cancel button
141 ///
142 /// @return True if canceled
143 ///
144 bool IsCanceled() const
145 {
146 using namespace ::kodi::addon;
147 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->is_canceled(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
148 }
149 //--------------------------------------------------------------------------
150
151 //==========================================================================
152 ///
153 /// \ingroup cpp_kodi_gui_dialogs_CProgress
154 /// @brief Get the current progress position as percent
155 ///
156 /// @param[in] percentage Position to use from 0 to 100
157 ///
158 void SetPercentage(int percentage)
159 {
160 using namespace ::kodi::addon;
161 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_percentage(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage);
162 }
163 //--------------------------------------------------------------------------
164
165 //==========================================================================
166 ///
167 /// \ingroup cpp_kodi_gui_dialogs_CProgress
168 /// @brief To set the current progress position as percent
169 ///
170 /// @return Current Position used from 0 to 100
171 ///
172 int GetPercentage() const
173 {
174 using namespace ::kodi::addon;
175 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->get_percentage(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
176 }
177 //--------------------------------------------------------------------------
178
179 //==========================================================================
180 ///
181 /// \ingroup cpp_kodi_gui_dialogs_CProgress
182 /// @brief To show or hide progress bar dialog
183 ///
184 /// @param[in] onOff If true becomes it shown
185 ///
186 void ShowProgressBar(bool onOff)
187 {
188 using namespace ::kodi::addon;
189 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->show_progress_bar(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, onOff);
190 }
191 //--------------------------------------------------------------------------
192
193 //==========================================================================
194 ///
195 /// \ingroup cpp_kodi_gui_dialogs_CProgress
196 /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used
197 ///
198 /// @param[in] max Biggest usable position to use
199 ///
200 void SetProgressMax(int max)
201 {
202 using namespace ::kodi::addon;
203 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_max(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, max);
204 }
205 //--------------------------------------------------------------------------
206
207 //==========================================================================
208 ///
209 /// \ingroup cpp_kodi_gui_dialogs_CProgress
210 /// @brief To increase progress bar by defined step size until reach of maximum position
211 ///
212 /// @param[in] steps Step size to increase, default is 1
213 ///
214 void SetProgressAdvance(int steps=1)
215 {
216 using namespace ::kodi::addon;
217 CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_advance(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, steps);
218 }
219 //--------------------------------------------------------------------------
220
221 //==========================================================================
222 ///
223 /// \ingroup cpp_kodi_gui_dialogs_CProgress
224 /// @brief To check progress was canceled on work
225 ///
226 /// @return True if aborted
227 ///
228 bool Abort()
229 {
230 using namespace ::kodi::addon;
231 return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->abort(CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle);
232 }
233 //--------------------------------------------------------------------------
234
235 private:
236 void* m_DialogHandle;
237 };
238 252
239} /* namespace dialogs */ 253} /* namespace dialogs */
240} /* namespace gui */ 254} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h
index ba0db1d..39a98fe 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h
@@ -104,16 +104,21 @@ namespace dialogs
104 /// fprintf(stderr, "Selected item is: %i\n", selected); 104 /// fprintf(stderr, "Selected item is: %i\n", selected);
105 /// ~~~~~~~~~~~~~ 105 /// ~~~~~~~~~~~~~
106 /// 106 ///
107 inline int Show(const std::string& heading, const std::vector<std::string>& entries, int selected = -1, unsigned int autoclose = 0) 107 inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
108 const std::vector<std::string>& entries,
109 int selected = -1,
110 unsigned int autoclose = 0)
108 { 111 {
109 using namespace ::kodi::addon; 112 using namespace ::kodi::addon;
110 unsigned int size = entries.size(); 113 unsigned int size = static_cast<unsigned int>(entries.size());
111 const char** cEntries = (const char**)malloc(size*sizeof(const char**)); 114 const char** cEntries = (const char**)malloc(size * sizeof(const char**));
112 for (unsigned int i = 0; i < size; ++i) 115 for (unsigned int i = 0; i < size; ++i)
113 { 116 {
114 cEntries[i] = entries[i].c_str(); 117 cEntries[i] = entries[i].c_str();
115 } 118 }
116 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size, selected, autoclose); 119 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open(
120 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size, selected,
121 autoclose);
117 free(cEntries); 122 free(cEntries);
118 return ret; 123 return ret;
119 } 124 }
@@ -159,10 +164,13 @@ namespace dialogs
159 /// fprintf(stderr, "Selected item is: %i\n", selected); 164 /// fprintf(stderr, "Selected item is: %i\n", selected);
160 /// ~~~~~~~~~~~~~ 165 /// ~~~~~~~~~~~~~
161 /// 166 ///
162 inline int Show(const std::string& heading, std::vector<SSelectionEntry>& entries, int selected = -1, unsigned int autoclose = 0) 167 inline int ATTRIBUTE_HIDDEN Show(const std::string& heading,
168 std::vector<SSelectionEntry>& entries,
169 int selected = -1,
170 unsigned int autoclose = 0)
163 { 171 {
164 using namespace ::kodi::addon; 172 using namespace ::kodi::addon;
165 unsigned int size = entries.size(); 173 unsigned int size = static_cast<unsigned int>(entries.size());
166 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char*))); 174 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char*)));
167 for (unsigned int i = 0; i < size; ++i) 175 for (unsigned int i = 0; i < size; ++i)
168 { 176 {
@@ -224,10 +232,12 @@ namespace dialogs
224 /// } 232 /// }
225 /// ~~~~~~~~~~~~~ 233 /// ~~~~~~~~~~~~~
226 /// 234 ///
227 inline bool ShowMultiSelect(const std::string& heading, std::vector<SSelectionEntry>& entries, int autoclose = 0) 235 inline bool ATTRIBUTE_HIDDEN ShowMultiSelect(const std::string& heading,
236 std::vector<SSelectionEntry>& entries,
237 int autoclose = 0)
228 { 238 {
229 using namespace ::kodi::addon; 239 using namespace ::kodi::addon;
230 unsigned int size = entries.size(); 240 unsigned int size = static_cast<unsigned int>(entries.size());
231 const char** cEntryIDs = static_cast<const char**>(malloc(size*sizeof(const char*))); 241 const char** cEntryIDs = static_cast<const char**>(malloc(size*sizeof(const char*)));
232 const char** cEntryNames = static_cast<const char**>(malloc(size*sizeof(const char*))); 242 const char** cEntryNames = static_cast<const char**>(malloc(size*sizeof(const char*)));
233 bool* cEntriesSelected = static_cast<bool*>(malloc(size*sizeof(bool))); 243 bool* cEntriesSelected = static_cast<bool*>(malloc(size*sizeof(bool)));
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h
index da38f7c..5c81837 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h
@@ -93,10 +93,11 @@ namespace dialogs
93 /// "interspersed renderings from classical composers.\n"); 93 /// "interspersed renderings from classical composers.\n");
94 /// ~~~~~~~~~~~~~ 94 /// ~~~~~~~~~~~~~
95 /// 95 ///
96 inline void Show(const std::string& heading, const std::string& text) 96 inline void ATTRIBUTE_HIDDEN Show(const std::string& heading, const std::string& text)
97 { 97 {
98 using namespace ::kodi::addon; 98 using namespace ::kodi::addon;
99 CAddonBase::m_interface->toKodi->kodi_gui->dialogTextViewer->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str()); 99 CAddonBase::m_interface->toKodi->kodi_gui->dialogTextViewer->open(
100 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str());
100 } 101 }
101 //-------------------------------------------------------------------------- 102 //--------------------------------------------------------------------------
102 }; 103 };
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h
index c694bf5..67c2fc4 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h
@@ -73,14 +73,16 @@ namespace dialogs
73 /// canceled ? "canceled" : "not canceled"); 73 /// canceled ? "canceled" : "not canceled");
74 /// ~~~~~~~~~~~~~ 74 /// ~~~~~~~~~~~~~
75 /// 75 ///
76 inline bool ShowAndGetInput(const std::string& heading, const std::string& text, 76 inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
77 bool& canceled, const std::string& noLabel = "", 77 const std::string& text,
78 const std::string& yesLabel = "") 78 bool& canceled,
79 const std::string& noLabel = "",
80 const std::string& yesLabel = "")
79 { 81 {
80 using namespace ::kodi::addon; 82 using namespace ::kodi::addon;
81 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_single_text(CAddonBase::m_interface->toKodi->kodiBase, 83 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_single_text(
82 heading.c_str(), text.c_str(), &canceled, 84 CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str(), &canceled,
83 noLabel.c_str(), yesLabel.c_str()); 85 noLabel.c_str(), yesLabel.c_str());
84 } 86 }
85 //-------------------------------------------------------------------------- 87 //--------------------------------------------------------------------------
86 88
@@ -115,9 +117,12 @@ namespace dialogs
115 /// ret ? "yes" : "no"); 117 /// ret ? "yes" : "no");
116 /// ~~~~~~~~~~~~~ 118 /// ~~~~~~~~~~~~~
117 /// 119 ///
118 inline bool ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, 120 inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
119 const std::string& line2, const std::string& noLabel = "", 121 const std::string& line0,
120 const std::string& yesLabel = "") 122 const std::string& line1,
123 const std::string& line2,
124 const std::string& noLabel = "",
125 const std::string& yesLabel = "")
121 { 126 {
122 using namespace ::kodi::addon; 127 using namespace ::kodi::addon;
123 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase, 128 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase,
@@ -161,9 +166,13 @@ namespace dialogs
161 /// canceled ? "canceled" : "not canceled"); 166 /// canceled ? "canceled" : "not canceled");
162 /// ~~~~~~~~~~~~~ 167 /// ~~~~~~~~~~~~~
163 /// 168 ///
164 inline bool ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, 169 inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading,
165 const std::string& line2, bool& canceled, const std::string& noLabel = "", 170 const std::string& line0,
166 const std::string& yesLabel = "") 171 const std::string& line1,
172 const std::string& line2,
173 bool& canceled,
174 const std::string& noLabel = "",
175 const std::string& yesLabel = "")
167 { 176 {
168 using namespace ::kodi::addon; 177 using namespace ::kodi::addon;
169 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_button_text(CAddonBase::m_interface->toKodi->kodiBase, 178 return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_button_text(CAddonBase::m_interface->toKodi->kodiBase,
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt
new file mode 100644
index 0000000..a9ab70c
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/CMakeLists.txt
@@ -0,0 +1,7 @@
1set(HEADERS GL.h
2 GLonDX.h
3 Shader.h)
4
5if(NOT ENABLE_STATIC_LIBS)
6 core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_gl)
7endif()
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h
new file mode 100644
index 0000000..943c7d0
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GL.h
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) 2005-2019 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11//==============================================================================
12///
13/// \defgroup cpp_kodi_gui_gl OpenGL helpers
14/// \ingroup cpp_kodi_gui
15/// \brief Auxiliary functions for Open GL
16///
17/// This group includes help for definitions, functions, and classes for
18/// OpenGL.
19///
20/// To use OpenGL for your system, add the \ref GL.h "#include <kodi/gui/gl/GL.h>".
21///
22///
23///-----------------------------------------------------------------------------
24///
25/// The \ref HAS_GL is declared if Open GL is required and \ref HAS_GLES if Open GL
26/// Embedded Systems (ES) is required, with ES the version is additionally given
27/// in the definition, this can be "2" or "3".
28///
29///
30///-----------------------------------------------------------------------------
31///
32/// Following \ref GL_TYPE_STRING define can be used, for example, to manage
33/// different folders for GL and GLES and make the selection easier.
34/// This are on OpenGL <b>"GL"</b> and on Open GL|ES <b>"GLES"</b>.
35///
36/// **Example:**
37/// ~~~~~~~~~~~~~~~~~{.cpp}
38/// kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/frag.glsl");
39/// ~~~~~~~~~~~~~~~~~
40///
41///
42///----------------------------------------------------------------------------
43///
44/// In addition, \ref BUFFER_OFFSET is declared in it which can be used to give an
45/// offset on the array to GL.
46///
47/// **Example:**
48/// ~~~~~~~~~~~~~~~~~{.cpp}
49/// const struct PackedVertex {
50/// float position[3]; // Position x, y, z
51/// float color[4]; // Color r, g, b, a
52/// } vertices[3] = {
53/// { { -0.5f, -0.5f, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
54/// { { 0.5f, -0.5f, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
55/// { { 0.0f, 0.5f, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } }
56/// };
57///
58/// glVertexAttribPointer(m_aPosition, 3, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, position)));
59/// glEnableVertexAttribArray(m_aPosition);
60///
61/// glVertexAttribPointer(m_aColor, 4, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, color)));
62/// glEnableVertexAttribArray(m_aColor);
63/// ~~~~~~~~~~~~~~~~~
64
65#if HAS_GL
66 #define GL_TYPE_STRING "GL"
67 // always define GL_GLEXT_PROTOTYPES before include gl headers
68 #if !defined(GL_GLEXT_PROTOTYPES)
69 #define GL_GLEXT_PROTOTYPES
70 #endif
71 #if defined(TARGET_LINUX)
72 #include <GL/gl.h>
73 #include <GL/glext.h>
74 #elif defined(TARGET_FREEBSD)
75 #include <GL/gl.h>
76 #elif defined(TARGET_DARWIN)
77 #include <OpenGL/gl3.h>
78 #include <OpenGL/gl3ext.h>
79 #elif defined(WIN32)
80 #error Use of GL under Windows is not possible
81 #endif
82#elif HAS_GLES >= 2
83 #define GL_TYPE_STRING "GLES"
84 #if defined(WIN32)
85 #if defined(HAS_ANGLE)
86 #include <angle_gl.h>
87 #else
88 #error Use of GLES only be available under Windows by the use of angle
89 #endif
90 #elif defined(TARGET_DARWIN)
91 #if HAS_GLES == 3
92 #include <OpenGLES/ES3/gl.h>
93 #include <OpenGLES/ES3/glext.h>
94 #else
95 #include <OpenGLES/ES2/gl.h>
96 #include <OpenGLES/ES2/glext.h>
97 #endif
98 #else
99 #if HAS_GLES == 3
100 #include <GLES3/gl3.h>
101 #include <GLES3/gl3ext.h>
102 #else
103 #include <GLES2/gl2.h>
104 #include <GLES2/gl2ext.h>
105 #endif
106 #endif
107#endif
108
109#ifndef BUFFER_OFFSET
110#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
111#endif
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h
new file mode 100644
index 0000000..7a6a0a1
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/GLonDX.h
@@ -0,0 +1,369 @@
1/*
2 * Copyright (C) 2005-2019 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include <angle_gl.h>
12#include <d3d11.h>
13#include <d3dcompiler.h>
14#include <EGL/egl.h>
15#include <EGL/eglext.h>
16#include <kodi/AddonBase.h>
17#include <kodi/gui/General.h>
18#include <wrl/client.h>
19
20#pragma comment( lib, "d3dcompiler.lib" )
21#ifndef GL_CLIENT_VERSION
22#define GL_CLIENT_VERSION 3
23#endif
24
25namespace kodi
26{
27namespace gui
28{
29namespace gl
30{
31
32class ATTRIBUTE_HIDDEN CGLonDX : public kodi::gui::IRenderHelper
33{
34public:
35 explicit CGLonDX() : m_pContext(reinterpret_cast<ID3D11DeviceContext*>(kodi::gui::GetHWContext())) {}
36 ~CGLonDX() override { destruct(); }
37
38 bool Init() override
39 {
40 EGLint egl_display_attrs[] =
41 {
42 EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
43 EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE,
44 EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE,
45 EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE, EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE,
46 EGL_NONE
47 };
48 EGLint egl_config_attrs[] =
49 {
50 EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8,
51 EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
52 EGL_RENDERABLE_TYPE, GL_CLIENT_VERSION == 3 ? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT,
53 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
54 EGL_NONE
55 };
56 EGLint egl_context_attrs[] =
57 {
58 EGL_CONTEXT_CLIENT_VERSION, GL_CLIENT_VERSION, EGL_NONE
59 };
60
61 m_eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, egl_display_attrs);
62 if (m_eglDisplay == EGL_NO_DISPLAY)
63 {
64 Log(ADDON_LOG_ERROR, "GLonDX: unable to get EGL display (%s)", eglGetErrorString());
65 return false;
66 }
67
68 if (eglInitialize(m_eglDisplay, nullptr, nullptr) != EGL_TRUE)
69 {
70 Log(ADDON_LOG_ERROR, "GLonDX: unable to init EGL display (%s)", eglGetErrorString());
71 return false;
72 }
73
74 EGLint numConfigs = 0;
75 if (eglChooseConfig(m_eglDisplay, egl_config_attrs, &m_eglConfig, 1, &numConfigs) != EGL_TRUE || numConfigs == 0)
76 {
77 Log(ADDON_LOG_ERROR, "GLonDX: unable to get EGL config (%s)", eglGetErrorString());
78 return false;
79 }
80
81 m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, egl_context_attrs);
82 if (m_eglContext == EGL_NO_CONTEXT)
83 {
84 Log(ADDON_LOG_ERROR, "GLonDX: unable to create EGL context (%s)", eglGetErrorString());
85 return false;
86 }
87
88 if (!createD3DResources())
89 return false;
90
91 if (eglMakeCurrent(m_eglDisplay, m_eglBuffer, m_eglBuffer, m_eglContext) != EGL_TRUE)
92 {
93 Log(ADDON_LOG_ERROR, "GLonDX: unable to make current EGL (%s)", eglGetErrorString());
94 return false;
95 }
96 return true;
97 }
98
99 void CheckGL(ID3D11DeviceContext* device)
100 {
101 if (m_pContext != device)
102 {
103 m_pSRView = nullptr;
104 m_pVShader = nullptr;
105 m_pPShader = nullptr;
106 m_pContext = device;
107
108 if (m_eglBuffer != EGL_NO_SURFACE)
109 {
110 eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
111 eglDestroySurface(m_eglDisplay, m_eglBuffer);
112 m_eglBuffer = EGL_NO_SURFACE;
113 }
114
115 // create new resources
116 if (!createD3DResources())
117 return;
118
119 eglMakeCurrent(m_eglDisplay, m_eglBuffer, m_eglBuffer, m_eglContext);
120 }
121 }
122
123 void Begin() override
124 {
125 // confirm on begin D3D context is correct
126 CheckGL(reinterpret_cast<ID3D11DeviceContext*>(kodi::gui::GetHWContext()));
127
128 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
129 glClear(GL_COLOR_BUFFER_BIT);
130 }
131
132 void End() override
133 {
134 glFlush();
135
136 // set our primitive shaders
137 m_pContext->VSSetShader(m_pVShader.Get(), nullptr, 0);
138 m_pContext->PSSetShader(m_pPShader.Get(), nullptr, 0);
139 m_pContext->PSSetShaderResources(0, 1, m_pSRView.GetAddressOf());
140 // draw texture
141 m_pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
142 m_pContext->IASetVertexBuffers(0, 0, nullptr, nullptr, nullptr);
143 m_pContext->IASetInputLayout(nullptr);
144 m_pContext->Draw(4, 0);
145 // unset shaders
146 m_pContext->PSSetShader(nullptr, nullptr, 0);
147 m_pContext->VSSetShader(nullptr, nullptr, 0);
148 // unbind our view
149 ID3D11ShaderResourceView* views[1] = {};
150 m_pContext->PSSetShaderResources(0, 1, views);
151 }
152
153private:
154 enum ShaderType
155 {
156 VERTEX_SHADER,
157 PIXEL_SHADER
158 };
159
160 bool createD3DResources()
161 {
162 HANDLE sharedHandle;
163 Microsoft::WRL::ComPtr<ID3D11Device> pDevice;
164 Microsoft::WRL::ComPtr<ID3D11RenderTargetView> pRTView;
165 Microsoft::WRL::ComPtr<ID3D11Resource> pRTResource;
166 Microsoft::WRL::ComPtr<ID3D11Texture2D> pRTTexture;
167 Microsoft::WRL::ComPtr<ID3D11Texture2D> pOffScreenTexture;
168 Microsoft::WRL::ComPtr<IDXGIResource> dxgiResource;
169
170 m_pContext->GetDevice(&pDevice);
171 m_pContext->OMGetRenderTargets(1, &pRTView, nullptr);
172 if (!pRTView)
173 return false;
174
175 pRTView->GetResource(&pRTResource);
176 if (FAILED(pRTResource.As(&pRTTexture)))
177 return false;
178
179 D3D11_TEXTURE2D_DESC texDesc;
180 pRTTexture->GetDesc(&texDesc);
181 texDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
182 texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
183 texDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
184 if (FAILED(pDevice->CreateTexture2D(&texDesc, nullptr, &pOffScreenTexture)))
185 {
186 Log(ADDON_LOG_ERROR, "GLonDX: unable to create intermediate texture");
187 return false;
188 }
189
190 CD3D11_SHADER_RESOURCE_VIEW_DESC srvDesc(pOffScreenTexture.Get(), D3D11_SRV_DIMENSION_TEXTURE2D);
191 if (FAILED(pDevice->CreateShaderResourceView(pOffScreenTexture.Get(), &srvDesc, &m_pSRView)))
192 {
193 Log(ADDON_LOG_ERROR, "GLonDX: unable to create shader view");
194 return false;
195 }
196
197 if (FAILED(pOffScreenTexture.As(&dxgiResource)) ||
198 FAILED(dxgiResource->GetSharedHandle(&sharedHandle)))
199 {
200 Log(ADDON_LOG_ERROR, "GLonDX: unable get shared handle for texture");
201 return false;
202 }
203
204 // initiate simple shaders
205 if (FAILED(d3dCreateShader(VERTEX_SHADER, vs_out_shader_text, &m_pVShader)))
206 {
207 Log(ADDON_LOG_ERROR, "GLonDX: unable to create vertex shader view");
208 return false;
209 }
210
211 if (FAILED(d3dCreateShader(PIXEL_SHADER, ps_out_shader_text, &m_pPShader)))
212 {
213 Log(ADDON_LOG_ERROR, "GLonDX: unable to create pixel shader view");
214 return false;
215 }
216
217 // create EGL buffer from D3D shared texture
218 EGLint egl_buffer_attrs[] =
219 {
220 EGL_WIDTH, static_cast<EGLint>(texDesc.Width),
221 EGL_HEIGHT, static_cast<EGLint>(texDesc.Height),
222 EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
223 EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
224 EGL_NONE
225 };
226
227 m_eglBuffer = eglCreatePbufferFromClientBuffer(m_eglDisplay,
228 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
229 sharedHandle, m_eglConfig, egl_buffer_attrs);
230
231 if (m_eglBuffer == EGL_NO_SURFACE)
232 {
233 Log(ADDON_LOG_ERROR, "GLonDX: unable to create EGL buffer (%s)", eglGetErrorString());
234 return false;
235 }
236 return true;
237 }
238
239 HRESULT d3dCreateShader(ShaderType shaderType, const std::string& source, IUnknown** ppShader) const
240 {
241 Microsoft::WRL::ComPtr<ID3DBlob> pBlob;
242 Microsoft::WRL::ComPtr<ID3DBlob> pErrors;
243
244 auto hr = D3DCompile(source.c_str(), source.length(), nullptr, nullptr, nullptr, "main",
245 shaderType == PIXEL_SHADER ? "ps_4_0" : "vs_4_0", 0, 0, &pBlob, &pErrors);
246
247 if (SUCCEEDED(hr))
248 {
249 Microsoft::WRL::ComPtr<ID3D11Device> pDevice;
250 m_pContext->GetDevice(&pDevice);
251
252 if (shaderType == PIXEL_SHADER)
253 {
254 hr = pDevice->CreatePixelShader(pBlob->GetBufferPointer(), pBlob->GetBufferSize(), nullptr,
255 reinterpret_cast<ID3D11PixelShader**>(ppShader));
256 }
257 else
258 {
259 hr = pDevice->CreateVertexShader(pBlob->GetBufferPointer(), pBlob->GetBufferSize(), nullptr,
260 reinterpret_cast<ID3D11VertexShader**>(ppShader));
261 }
262
263 if (FAILED(hr))
264 {
265 Log(ADDON_LOG_ERROR, "GLonDX: unable to create %s shader",
266 shaderType == PIXEL_SHADER ? "pixel" : "vertex");
267 }
268 }
269 else
270 {
271 Log(ADDON_LOG_ERROR, "GLonDX: unable to compile shader (%s)", pErrors->GetBufferPointer());
272 }
273 return hr;
274 }
275
276 static const char* eglGetErrorString()
277 {
278#define CASE_STR( value ) case value: return #value
279 switch (eglGetError())
280 {
281 CASE_STR(EGL_SUCCESS);
282 CASE_STR(EGL_NOT_INITIALIZED);
283 CASE_STR(EGL_BAD_ACCESS);
284 CASE_STR(EGL_BAD_ALLOC);
285 CASE_STR(EGL_BAD_ATTRIBUTE);
286 CASE_STR(EGL_BAD_CONTEXT);
287 CASE_STR(EGL_BAD_CONFIG);
288 CASE_STR(EGL_BAD_CURRENT_SURFACE);
289 CASE_STR(EGL_BAD_DISPLAY);
290 CASE_STR(EGL_BAD_SURFACE);
291 CASE_STR(EGL_BAD_MATCH);
292 CASE_STR(EGL_BAD_PARAMETER);
293 CASE_STR(EGL_BAD_NATIVE_PIXMAP);
294 CASE_STR(EGL_BAD_NATIVE_WINDOW);
295 CASE_STR(EGL_CONTEXT_LOST);
296 default:
297 return "Unknown";
298 }
299#undef CASE_STR
300 }
301
302 void destruct()
303 {
304 if (m_eglDisplay != EGL_NO_DISPLAY)
305 {
306 eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
307
308 if (m_eglBuffer != EGL_NO_SURFACE)
309 {
310 eglDestroySurface(m_eglDisplay, m_eglBuffer);
311 m_eglBuffer = EGL_NO_SURFACE;
312 }
313
314 if (m_eglContext != EGL_NO_CONTEXT)
315 {
316 eglDestroyContext(m_eglDisplay, m_eglContext);
317 m_eglContext = EGL_NO_CONTEXT;
318 }
319
320 eglTerminate(m_eglDisplay);
321 m_eglDisplay = EGL_NO_DISPLAY;
322 }
323
324 m_pSRView = nullptr;
325 m_pVShader = nullptr;
326 m_pPShader = nullptr;
327 m_pContext = nullptr;
328 }
329
330 EGLConfig m_eglConfig = EGL_NO_CONFIG_KHR;
331 EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
332 EGLContext m_eglContext = EGL_NO_CONTEXT;
333 EGLSurface m_eglBuffer = EGL_NO_SURFACE;
334
335 ID3D11DeviceContext* m_pContext = nullptr; // don't hold context
336 Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_pSRView = nullptr;
337 Microsoft::WRL::ComPtr<ID3D11VertexShader> m_pVShader = nullptr;
338 Microsoft::WRL::ComPtr<ID3D11PixelShader> m_pPShader = nullptr;
339
340#define TO_STRING(...) #__VA_ARGS__
341 std::string vs_out_shader_text = TO_STRING(
342 void main(uint id : SV_VertexId, out float2 tex : TEXCOORD0, out float4 pos : SV_POSITION)
343 {
344 tex = float2(id % 2, (id % 4) >> 1);
345 pos = float4((tex.x - 0.5f) * 2, -(tex.y - 0.5f) * 2, 0, 1);
346 });
347
348 std::string ps_out_shader_text = TO_STRING(
349 Texture2D texMain : register(t0);
350 SamplerState Sampler
351 {
352 Filter = MIN_MAG_MIP_LINEAR;
353 AddressU = CLAMP;
354 AddressV = CLAMP;
355 Comparison = NEVER;
356 };
357
358 float4 main(in float2 tex : TEXCOORD0) : SV_TARGET
359 {
360 return texMain.Sample(Sampler, tex);
361 });
362#undef TO_STRING
363}; /* class CGLonDX */
364
365} /* namespace gl */
366
367using CRenderHelper = gl::CGLonDX;
368} /* namespace gui */
369} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h
new file mode 100644
index 0000000..209f274
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/gl/Shader.h
@@ -0,0 +1,594 @@
1/*
2 * Copyright (C) 2005-2019 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "GL.h"
12
13#include <stdio.h>
14#include <vector>
15#include <string>
16
17#include <kodi/AddonBase.h>
18#include <kodi/Filesystem.h>
19
20#define LOG_SIZE 1024
21#define GLchar char
22
23namespace kodi
24{
25namespace gui
26{
27namespace gl
28{
29
30//========================================================================
31/// CShader - base class
32class ATTRIBUTE_HIDDEN CShader
33{
34public:
35 CShader() = default;
36 virtual ~CShader() = default;
37 virtual bool Compile(const std::string& extraBegin = "",
38 const std::string& extraEnd = "") = 0;
39 virtual void Free() = 0;
40 virtual GLuint Handle() = 0;
41
42 bool LoadSource(const std::string& file)
43 {
44 char buffer[16384];
45
46 kodi::vfs::CFile source;
47 if (!source.OpenFile(file))
48 {
49 kodi::Log(ADDON_LOG_ERROR, "CShader::%s: Failed to open file '%s'", __FUNCTION__, file.c_str());
50 return false;
51 }
52 size_t len = source.Read(buffer, sizeof(buffer));
53 m_source.assign(buffer);
54 m_source[len] = 0;
55 source.Close();
56 return true;
57 }
58
59 bool OK() const { return m_compiled; }
60
61protected:
62 std::string m_source;
63 std::string m_lastLog;
64 bool m_compiled = false;
65};
66//------------------------------------------------------------------------
67
68//========================================================================
69/// CVertexShader
70class ATTRIBUTE_HIDDEN CVertexShader : public CShader
71{
72public:
73 CVertexShader() = default;
74 ~CVertexShader() override { Free(); }
75
76 void Free() override
77 {
78 if (m_vertexShader)
79 glDeleteShader(m_vertexShader);
80 m_vertexShader = 0;
81 }
82
83 bool Compile(const std::string& extraBegin = "",
84 const std::string& extraEnd = "") override
85 {
86 GLint params[4];
87
88 Free();
89
90 m_vertexShader = glCreateShader(GL_VERTEX_SHADER);
91
92 GLsizei count = 0;
93 const char *sources[3];
94 if (!extraBegin.empty())
95 sources[count++] = extraBegin.c_str();
96 if (!m_source.empty())
97 sources[count++] = m_source.c_str();
98 if (!extraEnd.empty())
99 sources[count++] = extraEnd.c_str();
100
101 glShaderSource(m_vertexShader, count, sources, nullptr);
102 glCompileShader(m_vertexShader);
103 glGetShaderiv(m_vertexShader, GL_COMPILE_STATUS, params);
104 if (params[0] != GL_TRUE)
105 {
106 GLchar log[LOG_SIZE];
107 glGetShaderInfoLog(m_vertexShader, LOG_SIZE, nullptr, log);
108 kodi::Log(ADDON_LOG_ERROR, "CVertexShader::%s: %s", __FUNCTION__, log);
109 fprintf(stderr, "CVertexShader::%s: %s\n", __FUNCTION__, log);
110 m_lastLog = log;
111 m_compiled = false;
112 }
113 else
114 {
115 GLchar log[LOG_SIZE];
116 glGetShaderInfoLog(m_vertexShader, LOG_SIZE, nullptr, log);
117 m_lastLog = log;
118 m_compiled = true;
119 }
120 return m_compiled;
121 }
122
123 GLuint Handle() override { return m_vertexShader; }
124
125protected:
126 GLuint m_vertexShader = 0;
127};
128//------------------------------------------------------------------------
129
130//========================================================================
131/// CPixelShader
132class ATTRIBUTE_HIDDEN CPixelShader : public CShader
133{
134public:
135 CPixelShader() = default;
136 ~CPixelShader() { Free(); }
137 void Free() override
138 {
139 if (m_pixelShader)
140 glDeleteShader(m_pixelShader);
141 m_pixelShader = 0;
142 }
143
144 bool Compile(const std::string& extraBegin = "",
145 const std::string& extraEnd = "") override
146 {
147 GLint params[4];
148
149 Free();
150
151 m_pixelShader = glCreateShader(GL_FRAGMENT_SHADER);
152
153 GLsizei count = 0;
154 const char *sources[3];
155 if (!extraBegin.empty())
156 sources[count++] = extraBegin.c_str();
157 if (!m_source.empty())
158 sources[count++] = m_source.c_str();
159 if (!extraEnd.empty())
160 sources[count++] = extraEnd.c_str();
161
162 glShaderSource(m_pixelShader, count, sources, 0);
163 glCompileShader(m_pixelShader);
164 glGetShaderiv(m_pixelShader, GL_COMPILE_STATUS, params);
165 if (params[0] != GL_TRUE)
166 {
167 GLchar log[LOG_SIZE];
168 glGetShaderInfoLog(m_pixelShader, LOG_SIZE, nullptr, log);
169 kodi::Log(ADDON_LOG_ERROR, "CPixelShader::%s: %s", __FUNCTION__, log);
170 fprintf(stderr, "CPixelShader::%s: %s\n", __FUNCTION__, log);
171 m_lastLog = log;
172 m_compiled = false;
173 }
174 else
175 {
176 GLchar log[LOG_SIZE];
177 glGetShaderInfoLog(m_pixelShader, LOG_SIZE, nullptr, log);
178 m_lastLog = log;
179 m_compiled = true;
180 }
181 return m_compiled;
182 }
183
184 GLuint Handle() override { return m_pixelShader; }
185
186protected:
187 GLuint m_pixelShader = 0;
188};
189//------------------------------------------------------------------------
190
191//============================================================================
192///
193/// \defgroup cpp_kodi_gui_gl_CShaderProgram GL Shader Program
194/// \ingroup cpp_kodi_gui_gl
195/// @brief \cpp_class{ kodi::gui::gl::CShaderProgram }
196/// **Class to manage an OpenGL shader program**
197///
198/// With this class the used GL shader code can be defined on the GPU and
199/// its variables can be managed between CPU and GPU.
200///
201/// It has the header \ref Shader.h "#include <kodi/gui/gl/Shader.h>"
202/// be included to enjoy it.
203///
204/// ----------------------------------------------------------------------------
205///
206/// <b>Example:</b>
207///
208/// ~~~~~~~~~~~~~{.cpp}
209///
210/// #include <kodi/gui/gl/Shader.h>
211/// ...
212///
213/// class ATTRIBUTE_HIDDEN CExample
214/// : ...,
215/// public kodi::gui::gl::CShaderProgram
216/// {
217/// public:
218/// CExample() = default;
219///
220/// bool Start();
221/// void Render();
222///
223/// // override functions for kodi::gui::gl::CShaderProgram
224/// void OnCompiledAndLinked() override;
225/// bool OnEnabled() override;
226///
227/// private:
228/// ...
229/// GLint m_aPosition = -1;
230/// GLint m_aColor = -1;
231/// };
232///
233/// bool CExample::Start()
234/// {
235/// // Define shaders and load
236/// std::string fraqShader = kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/glsl.frag");
237/// std::string vertShader = kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/glsl.vert");
238/// if (!LoadShaderFiles(vertShader, fraqShader) || !CompileAndLink())
239/// return false;
240///
241/// ...
242/// return true;
243/// }
244///
245/// ...
246///
247/// void CExample::Render()
248/// {
249/// ...
250///
251/// EnableShader();
252/// ...
253/// DO WORK
254/// ...
255/// DisableShader();
256/// }
257///
258/// void CExample::OnCompiledAndLinked()
259/// {
260/// ...
261/// DO YOUR WORK HERE FOR WHAT IS ONE TIME REQUIRED DURING COMPILE OF SHADER, E.G.:
262///
263/// m_aPosition = glGetAttribLocation(ProgramHandle(), "a_position");
264/// m_aColor = glGetAttribLocation(ProgramHandle(), "a_color");
265/// }
266///
267/// bool OnEnabled() override
268/// {
269/// ...
270/// DO YOUR WORK HERE FOR WHAT REQUIRED DURING ENABLE OF SHADER
271/// ...
272/// return true;
273/// }
274///
275/// ADDONCREATOR(CExample);
276/// ~~~~~~~~~~~~~
277///
278
279//========================================================================
280/// CShaderProgram
281class ATTRIBUTE_HIDDEN CShaderProgram
282{
283public:
284 //==========================================================================
285 ///
286 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
287 /// @brief Construct a new shader
288 ///
289 /// Load must be done later with \ref LoadShaderFiles.
290 ///
291 CShaderProgram() = default;
292 //--------------------------------------------------------------------------
293
294 //==========================================================================
295 ///
296 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
297 /// @brief Construct a new shader and load defined shader files
298 ///
299 /// @param[in] vert Path to used GL vertext shader
300 /// @param[in] frag Path to used GL fragment shader
301 ///
302 CShaderProgram(const std::string& vert, const std::string& frag)
303 {
304 LoadShaderFiles(vert, frag);
305 }
306 //--------------------------------------------------------------------------
307
308 //==========================================================================
309 ///
310 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
311 /// @brief Destructor
312 ///
313 virtual ~CShaderProgram()
314 {
315 ShaderFree();
316 }
317 //--------------------------------------------------------------------------
318
319 //==========================================================================
320 ///
321 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
322 /// @brief To load manually the needed shader files
323 ///
324 /// @param[in] vert Path to used GL vertext shader
325 /// @param[in] frag Path to used GL fragment shader
326 ///
327 ///
328 /// @note The use of the files is optional, but it must either be passed over
329 /// here or via \ref CompileAndLink, or both of the source code.
330 ///
331 bool LoadShaderFiles(const std::string& vert, const std::string& frag)
332 {
333 if (!kodi::vfs::FileExists(vert) || !m_pVP.LoadSource(vert))
334 {
335 kodi::Log(ADDON_LOG_ERROR, "%s: Failed to load '%s'", __func__, vert.c_str());
336 return false;
337 }
338
339 if (!kodi::vfs::FileExists(frag) || !m_pFP.LoadSource(frag))
340 {
341 kodi::Log(ADDON_LOG_ERROR, "%s: Failed to load '%s'", __func__, frag.c_str());
342 return false;
343 }
344
345 return true;
346 }
347 //--------------------------------------------------------------------------
348
349 //==========================================================================
350 ///
351 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
352 /// @brief To compile and link the shader to the GL interface
353 ///
354 /// Optionally, additional source code can be transferred here, or it can be
355 /// used independently without any files
356 ///
357 /// @param[in] vertexExtraBegin [opt] To additionally add vextex source
358 /// code to the beginning of the loaded file
359 /// source code
360 /// @param[in] vertexExtraEnd [opt] To additionally add vextex source
361 /// code to the end of the loaded file
362 /// source code
363 /// @param[in] fragmentExtraBegin [opt] To additionally add fragment source
364 /// code to the beginning of the loaded file
365 /// source code
366 /// @param[in] fragmentExtraEnd [opt] To additionally add fragment source
367 /// code to the end of the loaded file
368 /// source code
369 /// @return true if compile was successed
370 ///
371 ///
372 /// @note In the case of a compile error, it will be written once into the Kodi
373 /// log and in addition to the console output to quickly detect the errors when
374 /// writing the damage.
375 ///
376 ///
377 bool CompileAndLink(const std::string& vertexExtraBegin = "",
378 const std::string& vertexExtraEnd = "",
379 const std::string& fragmentExtraBegin = "",
380 const std::string& fragmentExtraEnd = "")
381 {
382 GLint params[4];
383
384 // free resources
385 ShaderFree();
386 m_ok = false;
387
388 // compiled vertex shader
389 if (!m_pVP.Compile(vertexExtraBegin, vertexExtraEnd))
390 {
391 kodi::Log(ADDON_LOG_ERROR, "GL: Error compiling vertex shader");
392 return false;
393 }
394
395 // compile pixel shader
396 if (!m_pFP.Compile(fragmentExtraBegin, fragmentExtraEnd))
397 {
398 m_pVP.Free();
399 kodi::Log(ADDON_LOG_ERROR, "GL: Error compiling fragment shader");
400 return false;
401 }
402
403 // create program object
404 m_shaderProgram = glCreateProgram();
405 if (!m_shaderProgram)
406 {
407 kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: Failed to create GL program", __FUNCTION__);
408 ShaderFree();
409 return false;
410 }
411
412 // attach the vertex shader
413 glAttachShader(m_shaderProgram, m_pVP.Handle());
414 glAttachShader(m_shaderProgram, m_pFP.Handle());
415
416 // link the program
417 glLinkProgram(m_shaderProgram);
418 glGetProgramiv(m_shaderProgram, GL_LINK_STATUS, params);
419 if (params[0] != GL_TRUE)
420 {
421 GLchar log[LOG_SIZE];
422 glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log);
423 kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: %s", __FUNCTION__, log);
424 fprintf(stderr, "CShaderProgram::%s: %s\n", __FUNCTION__, log);
425 ShaderFree();
426 return false;
427 }
428
429 m_validated = false;
430 m_ok = true;
431 OnCompiledAndLinked();
432 return true;
433 }
434 //--------------------------------------------------------------------------
435
436 //==========================================================================
437 ///
438 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
439 /// @brief To activate the shader and use it on the GPU
440 ///
441 /// @return true if enable was successfull done
442 ///
443 ///
444 /// @note During this call, the \ref OnEnabled stored in the child is also
445 /// called
446 ///
447 bool EnableShader()
448 {
449 if (ShaderOK())
450 {
451 glUseProgram(m_shaderProgram);
452 if (OnEnabled())
453 {
454 if (!m_validated)
455 {
456 // validate the program
457 GLint params[4];
458 glValidateProgram(m_shaderProgram);
459 glGetProgramiv(m_shaderProgram, GL_VALIDATE_STATUS, params);
460 if (params[0] != GL_TRUE)
461 {
462 GLchar log[LOG_SIZE];
463 glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log);
464 kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: %s", __FUNCTION__, log);
465 fprintf(stderr, "CShaderProgram::%s: %s\n", __FUNCTION__, log);
466 }
467 m_validated = true;
468 }
469 return true;
470 }
471 else
472 {
473 glUseProgram(0);
474 return false;
475 }
476 return true;
477 }
478 return false;
479 }
480 //--------------------------------------------------------------------------
481
482 //==========================================================================
483 ///
484 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
485 /// @brief To deactivate the shader use on the GPU
486 ///
487 void DisableShader()
488 {
489 if (ShaderOK())
490 {
491 glUseProgram(0);
492 OnDisabled();
493 }
494 }
495 //--------------------------------------------------------------------------
496
497 //==========================================================================
498 ///
499 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
500 /// @brief Used to check if shader has been loaded before.
501 ///
502 /// @return true if enable was successfull done
503 ///
504 /// @note The CompileAndLink call sets these values
505 ///
506 ATTRIBUTE_FORCEINLINE bool ShaderOK() const { return m_ok; }
507 //--------------------------------------------------------------------------
508
509 //==========================================================================
510 ///
511 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
512 /// @brief To get the vertex shader class used by Kodi at the addon
513 ///
514 /// @return pointer to vertex shader class
515 ///
516 ATTRIBUTE_FORCEINLINE CVertexShader& VertexShader() { return m_pVP; }
517 //--------------------------------------------------------------------------
518
519 //==========================================================================
520 ///
521 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
522 /// @brief To get the fragment shader class used by Kodi at the addon
523 ///
524 /// @return pointer to fragment shader class
525 ///
526 ATTRIBUTE_FORCEINLINE CPixelShader& PixelShader() { return m_pFP; }
527 //--------------------------------------------------------------------------
528
529 //==========================================================================
530 ///
531 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
532 /// @brief Used to get the definition created in the OpenGL itself
533 ///
534 /// @return GLuint of GL shader program handler
535 ///
536 ATTRIBUTE_FORCEINLINE GLuint ProgramHandle() { return m_shaderProgram; }
537 //--------------------------------------------------------------------------
538
539 //==========================================================================
540 ///
541 /// \defgroup cpp_kodi_gui_gl_CShaderProgram_child Child Functions
542 /// \ingroup cpp_kodi_gui_gl_CShaderProgram
543 /// @brief \cpp_class{ kodi::gui::gl::CShaderProgram child functions }
544 ///
545 /// Functions that are added by parent in the child
546 //@{
547 //==========================================================================
548 ///
549 /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child
550 /// @brief Mandatory child function to set the necessary CPU to GPU data
551 ///
552 virtual void OnCompiledAndLinked() {};
553 //--------------------------------------------------------------------------
554
555 //==========================================================================
556 ///
557 /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child
558 /// @brief Optional function to exchange data between CPU and GPU while
559 /// activating the shader
560 ///
561 /// @return true if enable was successfull done
562 ///
563 virtual bool OnEnabled() { return true; };
564 //--------------------------------------------------------------------------
565
566 //==========================================================================
567 ///
568 /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child
569 /// @brief Optional child function that may have to be performed when
570 /// switching off the shader
571 virtual void OnDisabled() {};
572 //--------------------------------------------------------------------------
573 //@}
574
575private:
576 void ShaderFree()
577 {
578 if (m_shaderProgram)
579 glDeleteProgram(m_shaderProgram);
580 m_shaderProgram = 0;
581 m_ok = false;
582 }
583
584 CVertexShader m_pVP;
585 CPixelShader m_pFP;
586 GLuint m_shaderProgram = 0;
587 bool m_ok = false;
588 bool m_validated = false;
589};
590//------------------------------------------------------------------------
591
592} /* namespace gl */
593} /* namespace gui */
594} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h
new file mode 100644
index 0000000..2e96d21
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/renderHelper.h
@@ -0,0 +1,78 @@
1/*
2 * Copyright (C) 2005-2019 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../AddonBase.h"
12
13namespace kodi
14{
15namespace gui
16{
17struct ATTRIBUTE_HIDDEN IRenderHelper
18{
19 virtual ~IRenderHelper() = default;
20 virtual bool Init() = 0;
21 virtual void Begin() = 0;
22 virtual void End() = 0;
23}; /* class IRenderHelper */
24} /* namespace gui */
25} /* namespace kodi */
26
27#if defined(WIN32) && defined(HAS_ANGLE)
28#include "gl/GLonDX.h"
29#else
30/*
31 * Default background GUI render helper class
32 */
33namespace kodi
34{
35namespace gui
36{
37struct ATTRIBUTE_HIDDEN CRenderHelperStub : public IRenderHelper
38{
39 bool Init() override { return true; }
40 void Begin() override { }
41 void End() override { }
42}; /* class CRenderHelperStub */
43
44using CRenderHelper = CRenderHelperStub;
45} /* namespace gui */
46} /* namespace kodi */
47#endif
48
49namespace kodi
50{
51namespace gui
52{
53
54/*
55 * Create render background handler, e.g. becomes on "Windows" Angle used
56 * to emulate GL.
57 *
58 * This only be used internal and not from addon's direct.
59 *
60 * Function defines here and not in CAddonBase because of a hen and egg problem.
61 */
62inline std::shared_ptr<IRenderHelper> ATTRIBUTE_HIDDEN GetRenderHelper()
63{
64 using namespace ::kodi::addon;
65 if (static_cast<CAddonBase*>(CAddonBase::m_interface->addonBase)->m_renderHelper)
66 return static_cast<CAddonBase*>(CAddonBase::m_interface->addonBase)->m_renderHelper;
67
68 const std::shared_ptr<kodi::gui::IRenderHelper> renderHelper(new CRenderHelper());
69 if (!renderHelper->Init())
70 return nullptr;
71
72 static_cast<CAddonBase*>(CAddonBase::m_interface->addonBase)->m_renderHelper =
73 renderHelper; // Hold on base for other types
74 return renderHelper;
75}
76
77} /* namespace gui */
78} /* namespace kodi */