From c02df116fe5bf13a27d2eacc8724ba45ea1d0d4f Mon Sep 17 00:00:00 2001 From: Artem Glebov Date: Wed, 13 Mar 2013 16:13:08 +0300 Subject: [python] Add removeItem to ControlList --- xbmc/interfaces/legacy/Control.cpp | 10 ++++++++++ xbmc/interfaces/legacy/Control.h | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/xbmc/interfaces/legacy/Control.cpp b/xbmc/interfaces/legacy/Control.cpp index f6e369b240..346be6b8b9 100644 --- a/xbmc/interfaces/legacy/Control.cpp +++ b/xbmc/interfaces/legacy/Control.cpp @@ -1225,6 +1225,16 @@ namespace XBMCAddon g_windowManager.SendThreadMessage(msg, iParentId); } + void ControlList::removeItem(int index) throw(UnimplementedException,WindowException) + { + if (index < 0 || index >= (int)vecItems.size()) + throw WindowException("Index out of range"); + + vecItems.erase(vecItems.begin() + index); + + sendLabelBind(vecItems.size()); + } + void ControlList::reset() throw(UnimplementedException) { CGUIMessage msg(GUI_MSG_LABEL_RESET, iParentId, iControlId); diff --git a/xbmc/interfaces/legacy/Control.h b/xbmc/interfaces/legacy/Control.h index 6bddb3a3d5..acbc1c3d49 100644 --- a/xbmc/interfaces/legacy/Control.h +++ b/xbmc/interfaces/legacy/Control.h @@ -101,6 +101,7 @@ namespace XBMCAddon const char* focusedColor = NULL, const String& label2 = emptyString) DECL_UNIMP("Control"); virtual void reset() DECL_UNIMP("Control"); + virtual void removeItem(int index) DECL_UNIMP2("Control",WindowException); virtual void setSelected(bool selected) DECL_UNIMP("Control"); virtual void setPercent(float pct) DECL_UNIMP("Control"); virtual void setDisabledColor(const char* color) DECL_UNIMP("Control"); @@ -655,6 +656,16 @@ namespace XBMCAddon */ virtual void selectItem(long item) throw(UnimplementedException); + /** + * removeItem(index) -- Remove an item by index number. + * + * index : integer - index number of the item to remove. + * + * example: + * - cList.removeItem(12) + */ + virtual void removeItem(int index) throw (UnimplementedException,WindowException); + /** * reset() -- Clear all ListItems in this control list. * -- cgit v1.2.3