diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h')
| -rw-r--r-- | xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h new file mode 100644 index 0000000..d10b85f --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/Label.h | |||
| @@ -0,0 +1,118 @@ | |||
| 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/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 | //============================================================================== | ||
| 24 | /// @defgroup cpp_kodi_gui_windows_controls_CLabel Control Label | ||
| 25 | /// @ingroup cpp_kodi_gui_windows_controls | ||
| 26 | /// @brief @cpp_class{ kodi::gui::controls::CLabel } | ||
| 27 | /// **Window control used to show some lines of text**\n | ||
| 28 | /// The label control is used for displaying text in Kodi. You can choose | ||
| 29 | /// the font, size, colour, location and contents of the text to be displayed. | ||
| 30 | /// | ||
| 31 | /// It has the header @ref Label.h "#include <kodi/gui/controls/Label.h>" | ||
| 32 | /// be included to enjoy it. | ||
| 33 | /// | ||
| 34 | /// Here you find the needed skin part for a @ref Label_Control "label control". | ||
| 35 | /// | ||
| 36 | /// @note The call of the control is only possible from the corresponding | ||
| 37 | /// window as its class and identification number is required. | ||
| 38 | /// | ||
| 39 | class ATTRIBUTE_HIDDEN CLabel : public CAddonGUIControlBase | ||
| 40 | { | ||
| 41 | public: | ||
| 42 | //============================================================================ | ||
| 43 | /// @ingroup cpp_kodi_gui_windows_controls_CLabel | ||
| 44 | /// @brief Construct a new control. | ||
| 45 | /// | ||
| 46 | /// @param[in] window Related window control class | ||
| 47 | /// @param[in] controlId Used skin xml control id | ||
| 48 | /// | ||
| 49 | CLabel(CWindow* window, int controlId) : CAddonGUIControlBase(window) | ||
| 50 | { | ||
| 51 | m_controlHandle = m_interface->kodi_gui->window->get_control_label( | ||
| 52 | m_interface->kodiBase, m_Window->GetControlHandle(), controlId); | ||
| 53 | if (!m_controlHandle) | ||
| 54 | kodi::Log(ADDON_LOG_FATAL, | ||
| 55 | "kodi::gui::controls::CLabel can't create control class from Kodi !!!"); | ||
| 56 | } | ||
| 57 | //---------------------------------------------------------------------------- | ||
| 58 | |||
| 59 | //============================================================================ | ||
| 60 | /// @ingroup cpp_kodi_gui_windows_controls_CLabel | ||
| 61 | /// @brief Destructor. | ||
| 62 | /// | ||
| 63 | ~CLabel() override = default; | ||
| 64 | //---------------------------------------------------------------------------- | ||
| 65 | |||
| 66 | //============================================================================ | ||
| 67 | /// @ingroup cpp_kodi_gui_windows_controls_CLabel | ||
| 68 | /// @brief Set the control on window to visible. | ||
| 69 | /// | ||
| 70 | /// @param[in] visible If true visible, otherwise hidden | ||
| 71 | /// | ||
| 72 | void SetVisible(bool visible) | ||
| 73 | { | ||
| 74 | m_interface->kodi_gui->control_label->set_visible(m_interface->kodiBase, m_controlHandle, | ||
| 75 | visible); | ||
| 76 | } | ||
| 77 | //---------------------------------------------------------------------------- | ||
| 78 | |||
| 79 | //============================================================================ | ||
| 80 | /// @ingroup cpp_kodi_gui_windows_controls_CLabel | ||
| 81 | /// @brief To set the text string on label. | ||
| 82 | /// | ||
| 83 | /// @param[in] text Text to show | ||
| 84 | /// | ||
| 85 | void SetLabel(const std::string& text) | ||
| 86 | { | ||
| 87 | m_interface->kodi_gui->control_label->set_label(m_interface->kodiBase, m_controlHandle, | ||
| 88 | text.c_str()); | ||
| 89 | } | ||
| 90 | //---------------------------------------------------------------------------- | ||
| 91 | |||
| 92 | //============================================================================ | ||
| 93 | /// @ingroup cpp_kodi_gui_windows_controls_CLabel | ||
| 94 | /// @brief Get the used text from control. | ||
| 95 | /// | ||
| 96 | /// @return Used text on label control | ||
| 97 | /// | ||
| 98 | std::string GetLabel() const | ||
| 99 | { | ||
| 100 | std::string label; | ||
| 101 | char* ret = | ||
| 102 | m_interface->kodi_gui->control_label->get_label(m_interface->kodiBase, m_controlHandle); | ||
| 103 | if (ret != nullptr) | ||
| 104 | { | ||
| 105 | if (std::strlen(ret)) | ||
| 106 | label = ret; | ||
| 107 | m_interface->free_string(m_interface->kodiBase, ret); | ||
| 108 | } | ||
| 109 | return label; | ||
| 110 | } | ||
| 111 | //---------------------------------------------------------------------------- | ||
| 112 | }; | ||
| 113 | |||
| 114 | } /* namespace controls */ | ||
| 115 | } /* namespace gui */ | ||
| 116 | } /* namespace kodi */ | ||
| 117 | |||
| 118 | #endif /* __cplusplus */ | ||
