xref: /haiku/src/apps/haikudepot/ui/PackageListView.h (revision 7d6915b4d08ffe728cd38af02843d5e98ddfe0db)
1 /*
2  * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2013, Rene Gollent <rene@gollent.com>.
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef PACKAGE_LIST_VIEW_H
7 #define PACKAGE_LIST_VIEW_H
8 
9 
10 #include <ColumnListView.h>
11 #include <ColumnTypes.h>
12 #include <Locker.h>
13 
14 #include "PackageInfo.h"
15 
16 
17 class PackageRow;
18 class PackageListener;
19 
20 class PackageListView : public BColumnListView {
21 public:
22 								PackageListView(BLocker* modelLock);
23 	virtual						~PackageListView();
24 
25 	virtual void				AttachedToWindow();
26 	virtual	void				AllAttached();
27 
28 	virtual	void				MessageReceived(BMessage* message);
29 
30 	virtual void				SelectionChanged();
31 
32 	virtual void				Clear();
33 			void				AddPackage(const PackageInfoRef& package);
34 			void				RemovePackage(const PackageInfoRef& package);
35 
36 			void				SelectPackage(const PackageInfoRef& package);
37 
38 private:
39 			PackageRow*			_FindRow(const PackageInfoRef& package,
40 									PackageRow* parent = NULL);
41 			PackageRow*			_FindRow(const BString& packageTitle,
42 									PackageRow* parent = NULL);
43 
44 private:
45 			class ItemCountView;
46 
47 			BLocker*			fModelLock;
48 			ItemCountView*		fItemCountView;
49 			PackageListener*	fPackageListener;
50 };
51 
52 #endif // PACKAGE_LIST_VIEW_H
53