From 5f8335c1e49ce108ef3481863833c98efa00411b Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 2 Jul 2020 23:09:26 +0200 Subject: sync with upstream --- .../include/kodi/gui/controls/TextBox.h | 257 +++++++++++---------- 1 file changed, 130 insertions(+), 127 deletions(-) (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h') 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 namespace controls { - //============================================================================ +//============================================================================ +/// +/// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box +/// \ingroup cpp_kodi_gui +/// @brief \cpp_class{ kodi::gui::controls::CTextBox } +/// **Used to show a multi-page piece of text** +/// +/// The text box control can be used to display descriptions, help texts or +/// other larger texts. It corresponds to the representation which is also to +/// be seen on the CDialogTextViewer. +/// +/// It has the header \ref TextBox.h "#include " +/// be included to enjoy it. +/// +/// Here you find the needed skin part for a \ref Text_Box "textbox control". +/// +/// @note The call of the control is only possible from the corresponding +/// window as its class and identification number is required. +/// +class ATTRIBUTE_HIDDEN CTextBox : public CAddonGUIControlBase +{ +public: + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief Construct a new control + /// + /// @param[in] window related window control class + /// @param[in] controlId Used skin xml control id /// - /// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box - /// \ingroup cpp_kodi_gui - /// @brief \cpp_class{ kodi::gui::controls::CTextBox } - /// **Used to show a multi-page piece of text** + CTextBox(CWindow* window, int controlId) : CAddonGUIControlBase(window) + { + m_controlHandle = m_interface->kodi_gui->window->get_control_text_box( + m_interface->kodiBase, m_Window->GetControlHandle(), controlId); + if (!m_controlHandle) + kodi::Log(ADDON_LOG_FATAL, + "kodi::gui::controls::CTextBox can't create control class from Kodi !!!"); + } + //-------------------------------------------------------------------------- + + //========================================================================== /// - /// The text box control can be used to display descriptions, help texts or - /// other larger texts. It corresponds to the representation which is also to - /// be seen on the CDialogTextViewer. + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief Destructor /// - /// It has the header \ref TextBox.h "#include " - /// be included to enjoy it. + ~CTextBox() override = default; + //-------------------------------------------------------------------------- + + //========================================================================== /// - /// Here you find the needed skin part for a \ref Text_Box "textbox control". + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief Set the control on window to visible /// - /// @note The call of the control is only possible from the corresponding - /// window as its class and identification number is required. + /// @param[in] visible If true visible, otherwise hidden /// - class CTextBox : public CAddonGUIControlBase + void SetVisible(bool visible) { - public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Construct a new control - /// - /// @param[in] window related window control class - /// @param[in] controlId Used skin xml control id - /// - CTextBox(CWindow* window, int controlId) - : CAddonGUIControlBase(window) - { - m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(m_interface->kodiBase, m_Window->GetControlHandle(), controlId); - if (!m_controlHandle) - kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CTextBox can't create control class from Kodi !!!"); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Destructor - /// - ~CTextBox() override = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Set the control on window to visible - /// - /// @param[in] visible If true visible, otherwise hidden - /// - void SetVisible(bool visible) - { - m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, visible); - } - //-------------------------------------------------------------------------- + m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, + visible); + } + //-------------------------------------------------------------------------- - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To reset box an remove all the text - /// - void Reset() - { - m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle); - } - //-------------------------------------------------------------------------- + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief To reset box an remove all the text + /// + void Reset() { m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle); } + //-------------------------------------------------------------------------- - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To set the text on box - /// - /// @param[in] text Text to show - /// - void SetText(const std::string& text) - { - m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, text.c_str()); - } - //-------------------------------------------------------------------------- + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief To set the text on box + /// + /// @param[in] text Text to show + /// + void SetText(const std::string& text) + { + m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, + text.c_str()); + } + //-------------------------------------------------------------------------- - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief Get the used text from control - /// - /// @return Text shown - /// - std::string GetText() const + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief Get the used text from control + /// + /// @return Text shown + /// + std::string GetText() const + { + std::string text; + char* ret = + m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle); + if (ret != nullptr) { - std::string text; - char* ret = m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle); - if (ret != nullptr) - { - if (std::strlen(ret)) - text = ret; - m_interface->free_string(m_interface->kodiBase, ret); - } - return text; + if (std::strlen(ret)) + text = ret; + m_interface->free_string(m_interface->kodiBase, ret); } - //-------------------------------------------------------------------------- + return text; + } + //-------------------------------------------------------------------------- - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To scroll text on other position - /// - /// @param[in] position The line position to scroll to - /// - void Scroll(unsigned int position) - { - m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, position); - } - //-------------------------------------------------------------------------- + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief To scroll text on other position + /// + /// @param[in] position The line position to scroll to + /// + void Scroll(unsigned int position) + { + m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, + position); + } + //-------------------------------------------------------------------------- - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_controls_CTextBox - /// @brief To set automatic scrolling of textbox - /// - /// Specifies the timing and conditions of any autoscrolling this textbox - /// should have. Times are in milliseconds. The content is delayed for the - /// given delay, then scrolls at a rate of one line per time interval until - /// the end. If the repeat tag is present, it then delays for the repeat - /// time, fades out over 1 second, and repeats. It does not wrap or reset - /// to the top at the end of the scroll. - /// - /// @param[in] delay Content delay - /// @param[in] time One line per time interval - /// @param[in] repeat Delays with given time, fades out over 1 - /// second, and repeats - /// - void SetAutoScrolling(int delay, int time, int repeat) - { - m_interface->kodi_gui->control_text_box->set_auto_scrolling(m_interface->kodiBase, m_controlHandle, delay, time, repeat); - } - //-------------------------------------------------------------------------- - }; + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_controls_CTextBox + /// @brief To set automatic scrolling of textbox + /// + /// Specifies the timing and conditions of any autoscrolling this textbox + /// should have. Times are in milliseconds. The content is delayed for the + /// given delay, then scrolls at a rate of one line per time interval until + /// the end. If the repeat tag is present, it then delays for the repeat + /// time, fades out over 1 second, and repeats. It does not wrap or reset + /// to the top at the end of the scroll. + /// + /// @param[in] delay Content delay + /// @param[in] time One line per time interval + /// @param[in] repeat Delays with given time, fades out over 1 + /// second, and repeats + /// + void SetAutoScrolling(int delay, int time, int repeat) + { + m_interface->kodi_gui->control_text_box->set_auto_scrolling( + m_interface->kodiBase, m_controlHandle, delay, time, repeat); + } + //-------------------------------------------------------------------------- +}; } /* namespace controls */ } /* namespace gui */ -- cgit v1.2.3