diff --git a/src/apps/debuganalyzer/gui/ListSelectionModel.cpp b/src/apps/debuganalyzer/gui/ListSelectionModel.cpp index 59b1730ec9..d1ea40d16a 100644 --- a/src/apps/debuganalyzer/gui/ListSelectionModel.cpp +++ b/src/apps/debuganalyzer/gui/ListSelectionModel.cpp @@ -11,12 +11,16 @@ ListSelectionModel::ListSelectionModel() - : - fItemCount(0) { } +ListSelectionModel::ListSelectionModel(const ListSelectionModel& other) +{ + *this = other; +} + + ListSelectionModel::~ListSelectionModel() { } @@ -148,6 +152,24 @@ ListSelectionModel::RemoveListener(Listener* listener) } +ListSelectionModel& +ListSelectionModel::operator=(const ListSelectionModel& other) +{ + Clear(); + + fSelectedItems = other.fSelectedItems; + + int32 selectedCount = CountSelectedItems(); + if (selectedCount > 0) { + int32 firstSelected = fSelectedItems[0]; + int32 lastSelected = fSelectedItems[selectedCount - 1]; + _NotifyItemsDeselected(firstSelected, lastSelected - firstSelected + 1); + } + + return *this; +} + + int32 ListSelectionModel::_FindItem(int32 itemIndex) const { diff --git a/src/apps/debuganalyzer/gui/ListSelectionModel.h b/src/apps/debuganalyzer/gui/ListSelectionModel.h index 6a44b20078..dfd4c10558 100644 --- a/src/apps/debuganalyzer/gui/ListSelectionModel.h +++ b/src/apps/debuganalyzer/gui/ListSelectionModel.h @@ -19,6 +19,8 @@ public: public: ListSelectionModel(); + ListSelectionModel( + const ListSelectionModel& other); ~ListSelectionModel(); int32 CountSelectedItems() const @@ -40,6 +42,8 @@ public: bool AddListener(Listener* listener); void RemoveListener(Listener* listener); + ListSelectionModel& operator=(const ListSelectionModel& other); + private: typedef BObjectList ListenerList; @@ -53,7 +57,6 @@ private: int32 count); private: - int32 fItemCount; Array fSelectedItems; ListenerList fListeners; };