Kodi Development  20.0
for Binary and Script based Add-Ons
Image.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/image.h"
12 #include "../Window.h"
13 
14 #ifdef __cplusplus
15 
16 namespace kodi
17 {
18 namespace gui
19 {
20 namespace controls
21 {
22 
23 //============================================================================
39 class ATTRIBUTE_HIDDEN CImage : public CAddonGUIControlBase
40 {
41 public:
42  //==========================================================================
49  CImage(CWindow* window, int controlId) : CAddonGUIControlBase(window)
50  {
51  m_controlHandle = m_interface->kodi_gui->window->get_control_image(
52  m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
53  if (!m_controlHandle)
55  "kodi::gui::controls::CImage can't create control class from Kodi !!!");
56  }
57  //--------------------------------------------------------------------------
58 
59  //==========================================================================
63  ~CImage() override = default;
64  //--------------------------------------------------------------------------
65 
66  //==========================================================================
72  void SetVisible(bool visible)
73  {
74  m_interface->kodi_gui->control_image->set_visible(m_interface->kodiBase, m_controlHandle,
75  visible);
76  }
77  //--------------------------------------------------------------------------
78 
79  //==========================================================================
87  void SetFileName(const std::string& filename, bool useCache = true)
88  {
89  m_interface->kodi_gui->control_image->set_filename(m_interface->kodiBase, m_controlHandle,
90  filename.c_str(), useCache);
91  }
92  //--------------------------------------------------------------------------
93 
94  //==========================================================================
100  void SetColorDiffuse(uint32_t colorDiffuse)
101  {
102  m_interface->kodi_gui->control_image->set_color_diffuse(m_interface->kodiBase, m_controlHandle,
103  colorDiffuse);
104  }
105  //--------------------------------------------------------------------------
106 };
107 
108 } /* namespace controls */
109 } /* namespace gui */
110 } /* namespace kodi */
111 
112 #endif /* __cplusplus */
Definition: ListItem.h:26
Definition: Window.h:110
Definition: Image.h:40
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition: addon_base.h:187
~CImage() override=default
Destructor.
CImage(CWindow *window, int controlId)
Construct a new control.
Definition: Image.h:49
void SetColorDiffuse(uint32_t colorDiffuse)
To set set the diffuse color on image.
Definition: Image.h:100
void SetVisible(bool visible)
Set the control on window to visible.
Definition: Image.h:72
void SetFileName(const std::string &filename, bool useCache=true)
To set the filename used on image control.
Definition: Image.h:87
void ATTRIBUTE_HIDDEN Log(const AddonLog loglevel, const char *format,...)
Add a message to Kodi's log.
Definition: AddonBase.h:749