xref: /haiku/src/apps/haikudepot/ui/PackageInfoView.h (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2020-2023, Andrew Lindesay <apl@lindesay.co.nz>
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef PACKAGE_INFO_VIEW_H
7 #define PACKAGE_INFO_VIEW_H
8 
9 #include <GroupView.h>
10 
11 #include "Model.h"
12 #include "PackageInfo.h"
13 #include "PackageInfoListener.h"
14 #include "ProcessCoordinator.h"
15 
16 
17 class BCardLayout;
18 class BLocker;
19 class OnePackageMessagePackageListener;
20 class PackageActionView;
21 class PagesView;
22 class TitleView;
23 
24 enum {
25 	MSG_RATE_PACKAGE	= 'rate',
26 	MSG_SHOW_SCREENSHOT = 'shws',
27 };
28 
29 
30 class PackageInfoView : public BView {
31 public:
32 								PackageInfoView(Model* model,
33 									ProcessCoordinatorConsumer*
34 										processCoordinatorConsumer);
35 	virtual						~PackageInfoView();
36 
37 	virtual void				AttachedToWindow();
38 	virtual	void				MessageReceived(BMessage* message);
39 
40 			void				SetPackage(const PackageInfoRef& package);
41 			const PackageInfoRef& Package() const
42 									{ return fPackage; }
43 			void				Clear();
44 
45 			void				HandleScreenshotCached(const ScreenshotCoordinate& coordinate);
46 
47 private:
48 	static const ScreenshotCoordinate
49 								_ScreenshotThumbCoordinate(const PackageInfoRef& package);
50 			void				_SetPackageScreenshotThumb(const PackageInfoRef& package);
51 			void				_HandleScreenshotCached(const PackageInfoRef& package,
52 									const ScreenshotCoordinate& coordinate);
53 
54 private:
55 			Model*				fModel;
56 
57 			BCardLayout*		fCardLayout;
58 			TitleView*			fTitleView;
59 			PackageActionView*	fPackageActionView;
60 			PagesView*			fPagesView;
61 
62 			PackageInfoRef		fPackage;
63 			OnePackageMessagePackageListener*
64 								fPackageListener;
65 			ProcessCoordinatorConsumer*
66 								fProcessCoordinatorConsumer;
67 };
68 
69 #endif // PACKAGE_INFO_VIEW_H
70