diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls')
12 files changed, 1653 insertions, 1581 deletions
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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 40 | class ATTRIBUTE_HIDDEN CButton : public CAddonGUIControlBase | ||
| 41 | { | ||
| 42 | public: | ||
| 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 | |||
| 95 | namespace controls | 95 | namespace controls |
| 96 | { | 96 | { |
| 97 | 97 | ||
| 98 | class CEdit : public CAddonGUIControlBase | 98 | class ATTRIBUTE_HIDDEN CEdit : public CAddonGUIControlBase |
| 99 | { | ||
| 100 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 45 | class ATTRIBUTE_HIDDEN CFadeLabel : public CAddonGUIControlBase | ||
| 46 | { | ||
| 47 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 39 | class ATTRIBUTE_HIDDEN CImage : public CAddonGUIControlBase | ||
| 40 | { | ||
| 41 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 39 | class ATTRIBUTE_HIDDEN CLabel : public CAddonGUIControlBase | ||
| 40 | { | ||
| 41 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 40 | class ATTRIBUTE_HIDDEN CProgress : public CAddonGUIControlBase | ||
| 41 | { | ||
| 42 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 42 | class ATTRIBUTE_HIDDEN CRadioButton : public CAddonGUIControlBase | ||
| 43 | { | ||
| 44 | public: | ||
| 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 | ||
| 14 | namespace kodi | 15 | namespace kodi |
| 15 | { | 16 | { |
| @@ -18,186 +19,186 @@ namespace gui | |||
| 18 | namespace controls | 19 | namespace 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 | |||
| 53 | class ATTRIBUTE_HIDDEN CRendering : public CAddonGUIControlBase | ||
| 54 | { | ||
| 55 | public: | ||
| 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 | |||
| 172 | private: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 42 | class ATTRIBUTE_HIDDEN CSettingsSlider : public CAddonGUIControlBase | ||
| 43 | { | ||
| 44 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 40 | class ATTRIBUTE_HIDDEN CSlider : public CAddonGUIControlBase | ||
| 41 | { | ||
| 42 | public: | ||
| 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 | |||
| 18 | namespace controls | 18 | namespace 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 | /// | ||
| 40 | class ATTRIBUTE_HIDDEN CTextBox : public CAddonGUIControlBase | ||
| 41 | { | ||
| 42 | public: | ||
| 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 */ |
