1/*
2 * Copyright 2013, Stephan A��mus <superstippi@gmx.de>.
3 * Copyright 2022, Andrew Lindesay <apl@lindesay.co.nz>.
4 * All rights reserved. Distributed under the terms of the MIT License.
5 */
6#ifndef PACKAGE_INFO_LISTENER_H
7#define PACKAGE_INFO_LISTENER_H
8
9
10#include <Referenceable.h>
11
12
13enum {
14	PKG_CHANGED_TITLE						= 1 << 0,
15	PKG_CHANGED_SUMMARY						= 1 << 1,
16	PKG_CHANGED_DESCRIPTION					= 1 << 2,
17	PKG_CHANGED_RATINGS						= 1 << 3,
18	PKG_CHANGED_SCREENSHOTS					= 1 << 4,
19	PKG_CHANGED_STATE						= 1 << 5,
20	PKG_CHANGED_ICON						= 1 << 6,
21	PKG_CHANGED_CHANGELOG					= 1 << 7,
22	PKG_CHANGED_CATEGORIES					= 1 << 8,
23	PKG_CHANGED_PROMINENCE					= 1 << 9,
24	PKG_CHANGED_SIZE						= 1 << 10,
25	PKG_CHANGED_DEPOT						= 1 << 11,
26	PKG_CHANGED_VERSION						= 1 << 12,
27	PKG_CHANGED_VERSION_CREATE_TIMESTAMP	= 1 << 13
28	// ...
29};
30
31
32class PackageInfo;
33typedef BReference<PackageInfo>	PackageInfoRef;
34
35
36class PackageInfoEvent {
37public:
38								PackageInfoEvent();
39								PackageInfoEvent(const PackageInfoRef& package,
40									uint32 changes);
41								PackageInfoEvent(const PackageInfoEvent& other);
42	virtual						~PackageInfoEvent();
43
44			bool				operator==(const PackageInfoEvent& other);
45			bool				operator!=(const PackageInfoEvent& other);
46			PackageInfoEvent&	operator=(const PackageInfoEvent& other);
47
48	inline	const PackageInfoRef& Package() const
49									{ return fPackage; }
50
51	inline	uint32				Changes() const
52									{ return fChanges; }
53
54private:
55			PackageInfoRef		fPackage;
56			uint32				fChanges;
57};
58
59
60class PackageInfoListener : public BReferenceable {
61public:
62								PackageInfoListener();
63	virtual						~PackageInfoListener();
64
65	virtual	void				PackageChanged(
66									const PackageInfoEvent& event) = 0;
67};
68
69
70typedef BReference<PackageInfoListener> PackageInfoListenerRef;
71
72
73#endif // PACKAGE_INFO_LISTENER_H
74