diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h')
| -rw-r--r-- | xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h new file mode 100644 index 0000000..2634568 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/TextBox.h | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include "../../c-api/gui/controls/text_box.h" | ||
| 12 | #include "../Window.h" | ||
| 13 | |||
| 14 | #ifdef __cplusplus | ||
| 15 | |||
| 16 | namespace kodi | ||
| 17 | { | ||
| 18 | namespace gui | ||
| 19 | { | ||
| 20 | namespace controls | ||
| 21 | { | ||
| 22 | |||
| 23 | //============================================================================ | ||
| 24 | /// @defgroup cpp_kodi_gui_windows_controls_CTextBox Control Text Box | ||
| 25 | /// @ingroup cpp_kodi_gui_windows_controls | ||
| 26 | /// @brief @cpp_class{ kodi::gui::controls::CTextBox } | ||
| 27 | /// **Used to show a multi-page piece of text**\n | ||
| 28 | /// The text box control can be used to display descriptions, help texts or | ||
| 29 | /// other larger texts. | ||
| 30 | /// | ||
| 31 | /// It corresponds to the representation which is also to be seen on the | ||
| 32 | /// @ref CDialogTextViewer. | ||
| 33 | /// | ||
| 34 | /// It has the header @ref TextBox.h "#include <kodi/gui/controls/TextBox.h>" | ||
| 35 | /// be included to enjoy it. | ||
| 36 | /// | ||
| 37 | /// Here you find the needed skin part for a @ref Text_Box "textbox 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 CTextBox : public CAddonGUIControlBase | ||
| 43 | { | ||
| 44 | public: | ||
| 45 | //========================================================================== | ||
| 46 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 47 | /// @brief Construct a new control. | ||
| 48 | /// | ||
| 49 | /// @param[in] window related window control class | ||
| 50 | /// @param[in] controlId Used skin xml control id | ||
| 51 | /// | ||
| 52 | CTextBox(CWindow* window, int controlId) : CAddonGUIControlBase(window) | ||
| 53 | { | ||
| 54 | m_controlHandle = m_interface->kodi_gui->window->get_control_text_box( | ||
| 55 | m_interface->kodiBase, m_Window->GetControlHandle(), controlId); | ||
| 56 | if (!m_controlHandle) | ||
| 57 | kodi::Log(ADDON_LOG_FATAL, | ||
| 58 | "kodi::gui::controls::CTextBox can't create control class from Kodi !!!"); | ||
| 59 | } | ||
| 60 | //-------------------------------------------------------------------------- | ||
| 61 | |||
| 62 | //========================================================================== | ||
| 63 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 64 | /// @brief Destructor. | ||
| 65 | /// | ||
| 66 | ~CTextBox() override = default; | ||
| 67 | //-------------------------------------------------------------------------- | ||
| 68 | |||
| 69 | //========================================================================== | ||
| 70 | /// @ingroup cpp_kodi_gui_windows_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, | ||
| 78 | visible); | ||
| 79 | } | ||
| 80 | //-------------------------------------------------------------------------- | ||
| 81 | |||
| 82 | //========================================================================== | ||
| 83 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 84 | /// @brief To reset box an remove all the text. | ||
| 85 | /// | ||
| 86 | void Reset() { m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle); } | ||
| 87 | //-------------------------------------------------------------------------- | ||
| 88 | |||
| 89 | //========================================================================== | ||
| 90 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 91 | /// @brief To set the text on box. | ||
| 92 | /// | ||
| 93 | /// @param[in] text Text to show | ||
| 94 | /// | ||
| 95 | void SetText(const std::string& text) | ||
| 96 | { | ||
| 97 | m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, | ||
| 98 | text.c_str()); | ||
| 99 | } | ||
| 100 | //-------------------------------------------------------------------------- | ||
| 101 | |||
| 102 | //========================================================================== | ||
| 103 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 104 | /// @brief Get the used text from control. | ||
| 105 | /// | ||
| 106 | /// @return Text shown | ||
| 107 | /// | ||
| 108 | std::string GetText() const | ||
| 109 | { | ||
| 110 | std::string text; | ||
| 111 | char* ret = | ||
| 112 | m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle); | ||
| 113 | if (ret != nullptr) | ||
| 114 | { | ||
| 115 | if (std::strlen(ret)) | ||
| 116 | text = ret; | ||
| 117 | m_interface->free_string(m_interface->kodiBase, ret); | ||
| 118 | } | ||
| 119 | return text; | ||
| 120 | } | ||
| 121 | //-------------------------------------------------------------------------- | ||
| 122 | |||
| 123 | //========================================================================== | ||
| 124 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 125 | /// @brief To scroll text on other position. | ||
| 126 | /// | ||
| 127 | /// @param[in] position The line position to scroll to | ||
| 128 | /// | ||
| 129 | void Scroll(unsigned int position) | ||
| 130 | { | ||
| 131 | m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, | ||
| 132 | position); | ||
| 133 | } | ||
| 134 | //-------------------------------------------------------------------------- | ||
| 135 | |||
| 136 | //========================================================================== | ||
| 137 | /// @ingroup cpp_kodi_gui_windows_controls_CTextBox | ||
| 138 | /// @brief To set automatic scrolling of textbox | ||
| 139 | /// | ||
| 140 | /// Specifies the timing and conditions of any autoscrolling this textbox | ||
| 141 | /// should have. Times are in milliseconds. The content is delayed for the | ||
| 142 | /// given delay, then scrolls at a rate of one line per time interval until | ||
| 143 | /// the end. If the repeat tag is present, it then delays for the repeat | ||
| 144 | /// time, fades out over 1 second, and repeats. It does not wrap or reset | ||
| 145 | /// to the top at the end of the scroll. | ||
| 146 | /// | ||
| 147 | /// @param[in] delay Content delay | ||
| 148 | /// @param[in] time One line per time interval | ||
| 149 | /// @param[in] repeat Delays with given time, fades out over 1 second, and | ||
| 150 | /// repeats | ||
| 151 | /// | ||
| 152 | void SetAutoScrolling(int delay, int time, int repeat) | ||
| 153 | { | ||
| 154 | m_interface->kodi_gui->control_text_box->set_auto_scrolling( | ||
| 155 | m_interface->kodiBase, m_controlHandle, delay, time, repeat); | ||
| 156 | } | ||
| 157 | //-------------------------------------------------------------------------- | ||
| 158 | }; | ||
| 159 | |||
| 160 | } /* namespace controls */ | ||
| 161 | } /* namespace gui */ | ||
| 162 | } /* namespace kodi */ | ||
| 163 | |||
| 164 | #endif /* __cplusplus */ | ||
