aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Morten Kvarving <spiff@xbmc.org>2013-04-05 09:40:51 -0700
committerArne Morten Kvarving <spiff@xbmc.org>2013-04-05 09:40:51 -0700
commit22c93560b18845e45a50125b88994070eb7fde15 (patch)
tree8f3b89dee49ebeb8563b22bf26163a83cfdda8b8
parent55ee5d57b346a7f92622fcbd7f28f85cae8d4b2a (diff)
parentc02df116fe5bf13a27d2eacc8724ba45ea1d0d4f (diff)
Merge pull request #2436 from aglebov/master
[python] Add removeItem to ControlList
-rw-r--r--xbmc/interfaces/legacy/Control.cpp10
-rw-r--r--xbmc/interfaces/legacy/Control.h11
2 files changed, 21 insertions, 0 deletions
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");
@@ -656,6 +657,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.
*
* example: