xref: /haiku/src/apps/haikudepot/ui/PackageListView.h (revision e3857211d305a595c2d0b58768f25623d5967675)
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 enum {
21 	MSG_PACKAGE_SELECTED		= 'pkgs',
22 };
23 
24 
25 class PackageListView : public BColumnListView {
26 public:
27 								PackageListView(BLocker* modelLock);
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 			void				AddPackage(const PackageInfoRef& package);
38 
39 private:
40 			PackageRow*			_FindRow(const PackageInfoRef& package,
41 									PackageRow* parent = NULL);
42 			PackageRow*			_FindRow(const BString& packageTitle,
43 									PackageRow* parent = NULL);
44 
45 private:
46 			class ItemCountView;
47 
48 			BLocker*			fModelLock;
49 			ItemCountView*		fItemCountView;
50 			PackageListener*	fPackageListener;
51 };
52 
53 #endif // PACKAGE_LIST_VIEW_H
54