diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h new file mode 100644 index 0000000..44310ed --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h | |||
| @@ -0,0 +1,121 @@ | |||
| 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 | |||
| 25 | namespace kodi | ||
| 26 | { | ||
| 27 | namespace gui | ||
| 28 | { | ||
| 29 | namespace controls | ||
| 30 | { | ||
| 31 | |||
| 32 | //============================================================================ | ||
| 33 | /// | ||
| 34 | /// \defgroup cpp_kodi_gui_controls_CProgress Control Progress | ||
| 35 | /// \ingroup cpp_kodi_gui | ||
| 36 | /// @brief \cpp_class{ kodi::gui::controls::CProgress } | ||
| 37 | /// **Window control to show the progress of a particular operation** | ||
| 38 | /// | ||
| 39 | /// The progress control is used to show the progress of an item that may take | ||
| 40 | /// a long time, or to show how far through a movie you are. You can choose | ||
| 41 | /// the position, size, and look of the progress control. | ||
| 42 | /// | ||
| 43 | /// It has the header \ref Progress.h "#include <kodi/gui/controls/Progress.h>" | ||
| 44 | /// be included to enjoy it. | ||
| 45 | /// | ||
| 46 | /// Here you find the needed skin part for a \ref Progress_Control "progress control" | ||
| 47 | /// | ||
| 48 | /// @note The call of the control is only possible from the corresponding | ||
| 49 | /// window as its class and identification number is required. | ||
| 50 | /// | ||
| 51 | class CProgress : public CAddonGUIControlBase | ||
| 52 | { | ||
| 53 | public: | ||
| 54 | //========================================================================== | ||
| 55 | /// | ||
| 56 | /// \ingroup cpp_kodi_gui_controls_CProgress | ||
| 57 | /// @brief Construct a new control | ||
| 58 | /// | ||
| 59 | /// @param[in] window related window control class | ||
| 60 | /// @param[in] controlId Used skin xml control id | ||
| 61 | /// | ||
| 62 | CProgress(CWindow* window, int controlId) | ||
| 63 | : CAddonGUIControlBase(window) | ||
| 64 | { | ||
| 65 | m_controlHandle = m_interface->kodi_gui->window->get_control_progress(m_interface->kodiBase, m_Window->GetControlHandle(), controlId); | ||
| 66 | if (!m_controlHandle) | ||
| 67 | kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CProgress can't create control class from Kodi !!!"); | ||
| 68 | } | ||
| 69 | //-------------------------------------------------------------------------- | ||
| 70 | |||
| 71 | //========================================================================== | ||
| 72 | /// | ||
| 73 | /// \ingroup cpp_kodi_gui_controls_CProgress | ||
| 74 | /// @brief Destructor | ||
| 75 | /// | ||
| 76 | ~CProgress() override = default; | ||
| 77 | //-------------------------------------------------------------------------- | ||
| 78 | |||
| 79 | //========================================================================== | ||
| 80 | /// | ||
| 81 | /// \ingroup cpp_kodi_gui_controls_CProgress | ||
| 82 | /// @brief Set the control on window to visible | ||
| 83 | /// | ||
| 84 | /// @param[in] visible If true visible, otherwise hidden | ||
| 85 | /// | ||
| 86 | void SetVisible(bool visible) | ||
| 87 | { | ||
| 88 | m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle, visible); | ||
| 89 | } | ||
| 90 | //-------------------------------------------------------------------------- | ||
| 91 | |||
| 92 | //========================================================================== | ||
| 93 | /// | ||
| 94 | /// \ingroup cpp_kodi_gui_controls_CProgress | ||
| 95 | /// @brief To set Percent position of control | ||
| 96 | /// | ||
| 97 | /// @param[in] percent The percent position to use | ||
| 98 | /// | ||
| 99 | void SetPercentage(float percent) | ||
| 100 | { | ||
| 101 | m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle, percent); | ||
| 102 | } | ||
| 103 | //-------------------------------------------------------------------------- | ||
| 104 | |||
| 105 | //========================================================================== | ||
| 106 | /// | ||
| 107 | /// \ingroup cpp_kodi_gui_controls_CProgress | ||
| 108 | /// @brief Get the active percent position of progress bar | ||
| 109 | /// | ||
| 110 | /// @return Progress position as percent | ||
| 111 | /// | ||
| 112 | float GetPercentage() const | ||
| 113 | { | ||
| 114 | return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase, m_controlHandle); | ||
| 115 | } | ||
| 116 | //-------------------------------------------------------------------------- | ||
| 117 | }; | ||
| 118 | |||
| 119 | } /* namespace controls */ | ||
| 120 | } /* namespace gui */ | ||
| 121 | } /* namespace kodi */ | ||
