From 4c3251ec645c8b71820dab7e51e612e5919d4e75 Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 23 Jul 2017 16:59:43 +0200 Subject: sync with upstream --- .../kodi-addon-dev-kit/include/kodi/gui/ListItem.h | 86 +++++++++++++++++++++- 1 file changed, 82 insertions(+), 4 deletions(-) (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h') diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h index a473f28..944b1b9 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h @@ -91,20 +91,18 @@ namespace gui /// @param[in] label Item label /// @param[in] label2 Second Item label (if needed) /// @param[in] iconImage Item icon image (if needed) - /// @param[in] thumbnailImage Thumbnail Image of item (if needed) /// @param[in] path Path to where item is defined /// CListItem( const std::string& label = "", const std::string& label2 = "", const std::string& iconImage = "", - const std::string& thumbnailImage = "", const std::string& path = "") : CAddonGUIControlBase(nullptr) { m_controlHandle = m_interface->kodi_gui->listItem->create(m_interface->kodiBase, label.c_str(), label2.c_str(), iconImage.c_str(), - thumbnailImage.c_str(), path.c_str()); + path.c_str()); } /* @@ -124,7 +122,7 @@ namespace gui /// \ingroup cpp_kodi_gui_CListItem /// @brief Class destructor /// - virtual ~CListItem() + ~CListItem() override { m_interface->kodi_gui->listItem->destroy(m_interface->kodiBase, m_controlHandle); } @@ -330,6 +328,86 @@ namespace gui } //-------------------------------------------------------------------------- + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_CListItem + /// @brief Sets a listitem property, similar to an infolabel. + /// + /// @param[in] key string - property name. + /// @param[in] value string or unicode - value of property. + /// + /// @note Key is NOT case sensitive. + /// You can use the above as keywords for arguments and skip certain\n + /// optional arguments.\n + /// Once you use a keyword, all following arguments require the + /// keyword. + /// + /// Some of these are treated internally by Kodi, such as the + /// 'StartOffset' property, which is the offset in seconds at which to + /// start playback of an item. Others may be used in the skin to add + /// extra information, such as 'WatchedCount' for tvshow items + /// + void SetProperty(const std::string& key, const std::string& value) + { + m_interface->kodi_gui->listItem->set_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str()); + } + //-------------------------------------------------------------------------- + + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_CListItem + /// @brief Returns a listitem property as a string, similar to an infolabel. + /// + /// @param[in] key string - property name. + /// @return string - List item property + /// + /// @note Key is NOT case sensitive.\n + /// You can use the above as keywords for arguments and skip certain + /// optional arguments.\n + /// Once you use a keyword, all following arguments require the + /// keyword. + /// + std::string GetProperty(const std::string& key) + { + std::string label; + char* ret = m_interface->kodi_gui->listItem->get_property(m_interface->kodiBase, m_controlHandle, key.c_str()); + if (ret != nullptr) + { + if (std::strlen(ret)) + label = ret; + m_interface->free_string(m_interface->kodiBase, ret); + } + return label; + } + //-------------------------------------------------------------------------- + + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_CListItem + /// @brief To control selection of item in list (also multiple selection, + /// in list on serveral items possible). + /// + /// @param[in] selected if true becomes set as selected + /// + void Select(bool selected) + { + m_interface->kodi_gui->listItem->select(m_interface->kodiBase, m_controlHandle, selected); + } + //-------------------------------------------------------------------------- + + //========================================================================== + /// + /// \ingroup cpp_kodi_gui_CListItem + /// @brief Returns the listitem's selected status. + /// + /// @return true if selected, otherwise false + /// + bool IsSelected() + { + return m_interface->kodi_gui->listItem->is_selected(m_interface->kodiBase, m_controlHandle); + } + //-------------------------------------------------------------------------- + }; } /* namespace gui */ -- cgit v1.2.3