summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-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/FadeLabel.h')
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h148
1 files changed, 148 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h
new file mode 100644
index 0000000..01847fb
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/FadeLabel.h
@@ -0,0 +1,148 @@
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/fade_label.h"
12#include "../Window.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace controls
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_windows_controls_CFadeLabel Control Fade Label
25/// @ingroup cpp_kodi_gui_windows_controls
26/// @brief @cpp_class{ kodi::gui::controls::CFadeLabel }
27/// **Window control used to show multiple pieces of text in the same position,
28/// by fading from one to the other**\n
29/// The fade label control is used for displaying multiple pieces of text in
30/// the same space in Kodi.
31///
32/// You can choose the font, size, colour, location and contents of the text to
33/// be displayed. The first piece of information to display fades in over 50
34/// frames, then scrolls off to the left. Once it is finished scrolling off
35/// screen, the second piece of information fades in and the process repeats.
36/// A fade label control is not supported in a list container.
37///
38/// It has the header @ref FadeLabel.h "#include <kodi/gui/controls/FadeLabel.h>"
39/// be included to enjoy it.
40///
41/// Here you find the needed skin part for a @ref Fade_Label_Control "fade label control".
42///
43/// @note The call of the control is only possible from the corresponding
44/// window as its class and identification number is required.
45///
46class ATTRIBUTE_HIDDEN CFadeLabel : public CAddonGUIControlBase
47{
48public:
49 //============================================================================
50 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
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) : CAddonGUIControlBase(window)
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 //============================================================================
67 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
68 /// @brief Destructor.
69 ///
70 ~CFadeLabel() override = default;
71 //----------------------------------------------------------------------------
72
73 //============================================================================
74 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
75 /// @brief Set the control on window to visible.
76 ///
77 /// @param[in] visible If true visible, otherwise hidden
78 ///
79 void SetVisible(bool visible)
80 {
81 m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle,
82 visible);
83 }
84 //----------------------------------------------------------------------------
85
86 //============================================================================
87 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
88 /// @brief To add additional text string on fade label.
89 ///
90 /// @param[in] label Text to show
91 ///
92 void AddLabel(const std::string& label)
93 {
94 m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle,
95 label.c_str());
96 }
97 //----------------------------------------------------------------------------
98
99 //============================================================================
100 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
101 /// @brief Get the used text from button.
102 ///
103 /// @return Text shown
104 ///
105 std::string GetLabel() const
106 {
107 std::string label;
108 char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase,
109 m_controlHandle);
110 if (ret != nullptr)
111 {
112 if (std::strlen(ret))
113 label = ret;
114 m_interface->free_string(m_interface->kodiBase, ret);
115 }
116 return label;
117 }
118 //----------------------------------------------------------------------------
119
120 //============================================================================
121 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
122 /// @brief To enable or disable scrolling on fade label.
123 ///
124 /// @param[in] scroll To enable scrolling set to true, otherwise is disabled
125 ///
126 void SetScrolling(bool scroll)
127 {
128 m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle,
129 scroll);
130 }
131 //----------------------------------------------------------------------------
132
133 //============================================================================
134 /// @ingroup cpp_kodi_gui_windows_controls_CFadeLabel
135 /// @brief To reset al inserted labels.
136 ///
137 void Reset()
138 {
139 m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle);
140 }
141 //----------------------------------------------------------------------------
142};
143
144} /* namespace controls */
145} /* namespace gui */
146} /* namespace kodi */
147
148#endif /* __cplusplus */