summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h257
1 files changed, 130 insertions, 127 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
index 13ce1da..b4e8ae0 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
@@ -18,147 +18,150 @@ namespace gui
18namespace controls 18namespace controls
19{ 19{
20 20
21 //============================================================================ 21//============================================================================
22///
23/// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CTextBox }
26/// **Used to show a multi-page piece of text**
27///
28/// The text box control can be used to display descriptions, help texts or
29/// other larger texts. It corresponds to the representation which is also to
30/// be seen on the CDialogTextViewer.
31///
32/// It has the header \ref TextBox.h "#include <kodi/gui/controls/TextBox.h>"
33/// be included to enjoy it.
34///
35/// Here you find the needed skin part for a \ref Text_Box "textbox control".
36///
37/// @note The call of the control is only possible from the corresponding
38/// window as its class and identification number is required.
39///
40class ATTRIBUTE_HIDDEN CTextBox : public CAddonGUIControlBase
41{
42public:
43 //==========================================================================
44 ///
45 /// \ingroup cpp_kodi_gui_controls_CTextBox
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
22 /// 50 ///
23 /// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box 51 CTextBox(CWindow* window, int controlId) : CAddonGUIControlBase(window)
24 /// \ingroup cpp_kodi_gui 52 {
25 /// @brief \cpp_class{ kodi::gui::controls::CTextBox } 53 m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(
26 /// **Used to show a multi-page piece of text** 54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL,
57 "kodi::gui::controls::CTextBox can't create control class from Kodi !!!");
58 }
59 //--------------------------------------------------------------------------
60
61 //==========================================================================
27 /// 62 ///
28 /// The text box control can be used to display descriptions, help texts or 63 /// \ingroup cpp_kodi_gui_controls_CTextBox
29 /// other larger texts. It corresponds to the representation which is also to 64 /// @brief Destructor
30 /// be seen on the CDialogTextViewer.
31 /// 65 ///
32 /// It has the header \ref TextBox.h "#include <kodi/gui/controls/TextBox.h>" 66 ~CTextBox() override = default;
33 /// be included to enjoy it. 67 //--------------------------------------------------------------------------
68
69 //==========================================================================
34 /// 70 ///
35 /// Here you find the needed skin part for a \ref Text_Box "textbox control". 71 /// \ingroup cpp_kodi_gui_controls_CTextBox
72 /// @brief Set the control on window to visible
36 /// 73 ///
37 /// @note The call of the control is only possible from the corresponding 74 /// @param[in] visible If true visible, otherwise hidden
38 /// window as its class and identification number is required.
39 /// 75 ///
40 class CTextBox : public CAddonGUIControlBase 76 void SetVisible(bool visible)
41 { 77 {
42 public: 78 m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle,
43 //========================================================================== 79 visible);
44 /// 80 }
45 /// \ingroup cpp_kodi_gui_controls_CTextBox 81 //--------------------------------------------------------------------------
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
50 ///
51 CTextBox(CWindow* window, int controlId)
52 : CAddonGUIControlBase(window)
53 {
54 m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CTextBox can't create control class from Kodi !!!");
57 }
58 //--------------------------------------------------------------------------
59
60 //==========================================================================
61 ///
62 /// \ingroup cpp_kodi_gui_controls_CTextBox
63 /// @brief Destructor
64 ///
65 ~CTextBox() override = default;
66 //--------------------------------------------------------------------------
67
68 //==========================================================================
69 ///
70 /// \ingroup cpp_kodi_gui_controls_CTextBox
71 /// @brief Set the control on window to visible
72 ///
73 /// @param[in] visible If true visible, otherwise hidden
74 ///
75 void SetVisible(bool visible)
76 {
77 m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, visible);
78 }
79 //--------------------------------------------------------------------------
80 82
81 //========================================================================== 83 //==========================================================================
82 /// 84 ///
83 /// \ingroup cpp_kodi_gui_controls_CTextBox 85 /// \ingroup cpp_kodi_gui_controls_CTextBox
84 /// @brief To reset box an remove all the text 86 /// @brief To reset box an remove all the text
85 /// 87 ///
86 void Reset() 88 void Reset() { m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle); }
87 { 89 //--------------------------------------------------------------------------
88 m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle);
89 }
90 //--------------------------------------------------------------------------
91 90
92 //========================================================================== 91 //==========================================================================
93 /// 92 ///
94 /// \ingroup cpp_kodi_gui_controls_CTextBox 93 /// \ingroup cpp_kodi_gui_controls_CTextBox
95 /// @brief To set the text on box 94 /// @brief To set the text on box
96 /// 95 ///
97 /// @param[in] text Text to show 96 /// @param[in] text Text to show
98 /// 97 ///
99 void SetText(const std::string& text) 98 void SetText(const std::string& text)
100 { 99 {
101 m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, text.c_str()); 100 m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle,
102 } 101 text.c_str());
103 //-------------------------------------------------------------------------- 102 }
103 //--------------------------------------------------------------------------
104 104
105 //========================================================================== 105 //==========================================================================
106 /// 106 ///
107 /// \ingroup cpp_kodi_gui_controls_CTextBox 107 /// \ingroup cpp_kodi_gui_controls_CTextBox
108 /// @brief Get the used text from control 108 /// @brief Get the used text from control
109 /// 109 ///
110 /// @return Text shown 110 /// @return Text shown
111 /// 111 ///
112 std::string GetText() const 112 std::string GetText() const
113 {
114 std::string text;
115 char* ret =
116 m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle);
117 if (ret != nullptr)
113 { 118 {
114 std::string text; 119 if (std::strlen(ret))
115 char* ret = m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle); 120 text = ret;
116 if (ret != nullptr) 121 m_interface->free_string(m_interface->kodiBase, ret);
117 {
118 if (std::strlen(ret))
119 text = ret;
120 m_interface->free_string(m_interface->kodiBase, ret);
121 }
122 return text;
123 } 122 }
124 //-------------------------------------------------------------------------- 123 return text;
124 }
125 //--------------------------------------------------------------------------
125 126
126 //========================================================================== 127 //==========================================================================
127 /// 128 ///
128 /// \ingroup cpp_kodi_gui_controls_CTextBox 129 /// \ingroup cpp_kodi_gui_controls_CTextBox
129 /// @brief To scroll text on other position 130 /// @brief To scroll text on other position
130 /// 131 ///
131 /// @param[in] position The line position to scroll to 132 /// @param[in] position The line position to scroll to
132 /// 133 ///
133 void Scroll(unsigned int position) 134 void Scroll(unsigned int position)
134 { 135 {
135 m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, position); 136 m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle,
136 } 137 position);
137 //-------------------------------------------------------------------------- 138 }
139 //--------------------------------------------------------------------------
138 140
139 //========================================================================== 141 //==========================================================================
140 /// 142 ///
141 /// \ingroup cpp_kodi_gui_controls_CTextBox 143 /// \ingroup cpp_kodi_gui_controls_CTextBox
142 /// @brief To set automatic scrolling of textbox 144 /// @brief To set automatic scrolling of textbox
143 /// 145 ///
144 /// Specifies the timing and conditions of any autoscrolling this textbox 146 /// Specifies the timing and conditions of any autoscrolling this textbox
145 /// should have. Times are in milliseconds. The content is delayed for the 147 /// should have. Times are in milliseconds. The content is delayed for the
146 /// given delay, then scrolls at a rate of one line per time interval until 148 /// given delay, then scrolls at a rate of one line per time interval until
147 /// the end. If the repeat tag is present, it then delays for the repeat 149 /// the end. If the repeat tag is present, it then delays for the repeat
148 /// time, fades out over 1 second, and repeats. It does not wrap or reset 150 /// time, fades out over 1 second, and repeats. It does not wrap or reset
149 /// to the top at the end of the scroll. 151 /// to the top at the end of the scroll.
150 /// 152 ///
151 /// @param[in] delay Content delay 153 /// @param[in] delay Content delay
152 /// @param[in] time One line per time interval 154 /// @param[in] time One line per time interval
153 /// @param[in] repeat Delays with given time, fades out over 1 155 /// @param[in] repeat Delays with given time, fades out over 1
154 /// second, and repeats 156 /// second, and repeats
155 /// 157 ///
156 void SetAutoScrolling(int delay, int time, int repeat) 158 void SetAutoScrolling(int delay, int time, int repeat)
157 { 159 {
158 m_interface->kodi_gui->control_text_box->set_auto_scrolling(m_interface->kodiBase, m_controlHandle, delay, time, repeat); 160 m_interface->kodi_gui->control_text_box->set_auto_scrolling(
159 } 161 m_interface->kodiBase, m_controlHandle, delay, time, repeat);
160 //-------------------------------------------------------------------------- 162 }
161 }; 163 //--------------------------------------------------------------------------
164};
162 165
163} /* namespace controls */ 166} /* namespace controls */
164} /* namespace gui */ 167} /* namespace gui */