1/*
2 * Copyright 2013, Stephan A��mus <superstippi@gmx.de>.
3 * Copyright 2013, Rene Gollent <rene@gollent.com>.
4 * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>
5 * All rights reserved. Distributed under the terms of the MIT License.
6 */
7#ifndef PACKAGE_LIST_VIEW_H
8#define PACKAGE_LIST_VIEW_H
9
10
11#include <ColumnListView.h>
12#include <ColumnTypes.h>
13#include <Locker.h>
14#include <util/OpenHashTable.h>
15
16#include "Model.h"
17#include "PackageInfo.h"
18
19
20class PackageRow;
21class PackageListener;
22class WorkStatusView;
23
24
25class PackageListView : public BColumnListView {
26public:
27								PackageListView(Model* model);
28	virtual						~PackageListView();
29
30	virtual void				AttachedToWindow();
31	virtual	void				AllAttached();
32
33	virtual	void				MessageReceived(BMessage* message);
34
35	virtual void				SelectionChanged();
36
37	virtual void				Clear();
38			void				AddPackage(const PackageInfoRef& package);
39			void				RemovePackage(const PackageInfoRef& package);
40
41			void				SelectPackage(const PackageInfoRef& package);
42
43			void				AttachWorkStatusView(WorkStatusView* view);
44
45private:
46			PackageRow*			_FindRow(const PackageInfoRef& package);
47			PackageRow*			_FindRow(const BString& packageName);
48
49private:
50			class ItemCountView;
51			struct RowByNameHashDefinition;
52			typedef BOpenHashTable<RowByNameHashDefinition> RowByNameTable;
53
54			Model*				fModel;
55			ItemCountView*		fItemCountView;
56			PackageListener*	fPackageListener;
57			RowByNameTable*		fRowByNameTable;
58
59			WorkStatusView*		fWorkStatusView;
60
61			bool				fIgnoreSelectionChanged;
62};
63
64#endif // PACKAGE_LIST_VIEW_H
65