summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
new file mode 100644
index 0000000..82d17ff
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
@@ -0,0 +1,159 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CFadeLabel Control Fade Label
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CFadeLabel }
37 /// **Window control used to show multiple pieces of text in the same position,
38 /// by fading from one to the other**
39 ///
40 /// The fade label control is used for displaying multiple pieces of text in
41 /// the same space in Kodi. You can choose the font, size, colour, location
42 /// and contents of the text to be displayed. The first piece of information
43 /// to display fades in over 50 frames, then scrolls off to the left. Once it
44 /// is finished scrolling off screen, the second piece of information fades
45 /// in and the process repeats. A fade label control is not supported in a
46 /// list container.
47 ///
48 /// It has the header \ref FadeLabel.h "#include <kodi/gui/controls/FadeLabel.h>"
49 /// be included to enjoy it.
50 ///
51 /// Here you find the needed skin part for a \ref Fade_Label_Control "fade label control"
52 ///
53 /// @note The call of the control is only possible from the corresponding
54 /// window as its class and identification number is required.
55 ///
56 class CFadeLabel : public CAddonGUIControlBase
57 {
58 public:
59 //==========================================================================
60 ///
61 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
62 /// @brief Construct a new control.
63 ///
64 /// @param[in] window related window control class
65 /// @param[in] controlId Used skin xml control id
66 ///
67 CFadeLabel(CWindow* window, int controlId)
68 : CAddonGUIControlBase(window)
69 {
70 m_controlHandle = m_interface->kodi_gui->window->get_control_fade_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
71 if (!m_controlHandle)
72 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!");
73 }
74 //--------------------------------------------------------------------------
75
76 //==========================================================================
77 ///
78 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
79 /// @brief Destructor.
80 ///
81 ~CFadeLabel() override = default;
82 //--------------------------------------------------------------------------
83
84 //==========================================================================
85 ///
86 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
87 /// @brief Set the control on window to visible.
88 ///
89 /// @param[in] visible If true visible, otherwise hidden
90 ///
91 void SetVisible(bool visible)
92 {
93 m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle, visible);
94 }
95 //--------------------------------------------------------------------------
96
97 //==========================================================================
98 ///
99 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
100 /// @brief To add additional text string on fade label.
101 ///
102 /// @param[in] label Text to show
103 ///
104 void AddLabel(const std::string& label)
105 {
106 m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle, label.c_str());
107 }
108 //--------------------------------------------------------------------------
109
110 //==========================================================================
111 ///
112 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
113 /// @brief Get the used text from button
114 ///
115 /// @return Text shown
116 ///
117 std::string GetLabel() const
118 {
119 std::string label;
120 char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase, m_controlHandle);
121 if (ret != nullptr)
122 {
123 if (std::strlen(ret))
124 label = ret;
125 m_interface->free_string(m_interface->kodiBase, ret);
126 }
127 return label;
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
134 /// @brief To enable or disable scrolling on fade label
135 ///
136 /// @param[in] scroll To enable scrolling set to true, otherwise is
137 /// disabled
138 ///
139 void SetScrolling(bool scroll)
140 {
141 m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle, scroll);
142 }
143 //--------------------------------------------------------------------------
144
145 //==========================================================================
146 ///
147 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
148 /// @brief To reset al inserted labels.
149 ///
150 void Reset()
151 {
152 m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle);
153 }
154 //--------------------------------------------------------------------------
155 };
156
157} /* namespace controls */
158} /* namespace gui */
159} /* namespace kodi */