diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h | 308 |
1 files changed, 159 insertions, 149 deletions
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 */ |
