xbmc
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 
16 namespace kodi
17 {
18 namespace gui
19 {
20 namespace controls
21 {
22 
23 //==============================================================================
46 class ATTR_DLL_LOCAL CFadeLabel : public CAddonGUIControlBase
47 {
48 public:
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)
61  kodi::Log(ADDON_LOG_FATAL,
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 */
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition: addon_base.h:197