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