Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Progress.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/progress.h"
12#include "../Window.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace controls
21{
22
23//==============================================================================
41class ATTR_DLL_LOCAL CProgress : public CAddonGUIControlBase
42{
43public:
44 //============================================================================
51 CProgress(CWindow* window, int controlId) : CAddonGUIControlBase(window)
52 {
53 m_controlHandle = m_interface->kodi_gui->window->get_control_progress(
54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
57 "kodi::gui::controls::CProgress can't create control class from Kodi !!!");
58 }
59 //----------------------------------------------------------------------------
60
61 //============================================================================
65 ~CProgress() override = default;
66 //----------------------------------------------------------------------------
67
68 //============================================================================
74 void SetVisible(bool visible)
75 {
76 m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle,
77 visible);
78 }
79 //----------------------------------------------------------------------------
80
81 //============================================================================
87 void SetPercentage(float percent)
88 {
89 m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle,
90 percent);
91 }
92 //----------------------------------------------------------------------------
93
94 //============================================================================
100 float GetPercentage() const
101 {
102 return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase,
103 m_controlHandle);
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 Progress.h:42
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition addon_base.h:197
void SetPercentage(float percent)
To set Percent position of control.
Definition Progress.h:87
~CProgress() override=default
Destructor.
CProgress(CWindow *window, int controlId)
Construct a new control.
Definition Progress.h:51
void SetVisible(bool visible)
Set the control on window to visible.
Definition Progress.h:74
float GetPercentage() const
Get the active percent position of progress bar.
Definition Progress.h:100
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1938