Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
FadeLabel.h
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//==============================================================================
46class ATTR_DLL_LOCAL CFadeLabel : public CAddonGUIControlBase
47{
48public:
49 //============================================================================
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)
62 "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!");
63 }
64 //----------------------------------------------------------------------------
65
66 //============================================================================
70 ~CFadeLabel() override = default;
71 //----------------------------------------------------------------------------
72
73 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 */
Definition ListItem.h:26
Definition Window.h:110
Definition FadeLabel.h:47
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition addon_base.h:197
void SetScrolling(bool scroll)
To enable or disable scrolling on fade label.
Definition FadeLabel.h:126
CFadeLabel(CWindow *window, int controlId)
Construct a new control.
Definition FadeLabel.h:56
~CFadeLabel() override=default
Destructor.
void Reset()
To reset al inserted labels.
Definition FadeLabel.h:137
void AddLabel(const std::string &label)
To add additional text string on fade label.
Definition FadeLabel.h:92
std::string GetLabel() const
Get the used text from button.
Definition FadeLabel.h:105
void SetVisible(bool visible)
Set the control on window to visible.
Definition FadeLabel.h:79
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1938