Added copy constructor and assignment operator.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2df254bea3
commit
63481b10d3
@ -11,12 +11,16 @@
|
|||||||
|
|
||||||
|
|
||||||
ListSelectionModel::ListSelectionModel()
|
ListSelectionModel::ListSelectionModel()
|
||||||
:
|
|
||||||
fItemCount(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ListSelectionModel::ListSelectionModel(const ListSelectionModel& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ListSelectionModel::~ListSelectionModel()
|
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
|
int32
|
||||||
ListSelectionModel::_FindItem(int32 itemIndex) const
|
ListSelectionModel::_FindItem(int32 itemIndex) const
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ListSelectionModel();
|
ListSelectionModel();
|
||||||
|
ListSelectionModel(
|
||||||
|
const ListSelectionModel& other);
|
||||||
~ListSelectionModel();
|
~ListSelectionModel();
|
||||||
|
|
||||||
int32 CountSelectedItems() const
|
int32 CountSelectedItems() const
|
||||||
@ -40,6 +42,8 @@ public:
|
|||||||
bool AddListener(Listener* listener);
|
bool AddListener(Listener* listener);
|
||||||
void RemoveListener(Listener* listener);
|
void RemoveListener(Listener* listener);
|
||||||
|
|
||||||
|
ListSelectionModel& operator=(const ListSelectionModel& other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BObjectList<Listener> ListenerList;
|
typedef BObjectList<Listener> ListenerList;
|
||||||
|
|
||||||
@ -53,7 +57,6 @@ private:
|
|||||||
int32 count);
|
int32 count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 fItemCount;
|
|
||||||
Array<int32> fSelectedItems;
|
Array<int32> fSelectedItems;
|
||||||
ListenerList fListeners;
|
ListenerList fListeners;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user