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 13 enum { 14 PKG_CHANGED_LOCALIZED_TEXT = 1 << 0, 15 // ^ Covers title, summary, description and changelog. 16 PKG_CHANGED_RATINGS = 1 << 1, 17 PKG_CHANGED_SCREENSHOTS = 1 << 2, 18 PKG_CHANGED_LOCAL_INFO = 1 << 3, 19 // ^ Covers state, download and size. 20 PKG_CHANGED_ICON = 1 << 4, 21 // ^ Handled slightly differently. 22 PKG_CHANGED_CLASSIFICATION = 1 << 5, 23 // ^ This covers categories, prominence and is native desktop 24 PKG_CHANGED_VERSION_CREATE_TIMESTAMP = 1 << 6 25 // ... 26 }; 27 28 29 class PackageInfo; 30 typedef BReference<PackageInfo> PackageInfoRef; 31 32 33 class PackageInfoEvent { 34 public: 35 PackageInfoEvent(); 36 PackageInfoEvent(const PackageInfoRef& package, 37 uint32 changes); 38 PackageInfoEvent(const PackageInfoEvent& other); 39 virtual ~PackageInfoEvent(); 40 41 bool operator==(const PackageInfoEvent& other); 42 bool operator!=(const PackageInfoEvent& other); 43 PackageInfoEvent& operator=(const PackageInfoEvent& other); 44 Package()45 inline const PackageInfoRef& Package() const 46 { return fPackage; } 47 Changes()48 inline uint32 Changes() const 49 { return fChanges; } 50 51 private: 52 PackageInfoRef fPackage; 53 uint32 fChanges; 54 }; 55 56 57 class PackageInfoListener : public BReferenceable { 58 public: 59 PackageInfoListener(); 60 virtual ~PackageInfoListener(); 61 62 virtual void PackageChanged( 63 const PackageInfoEvent& event) = 0; 64 }; 65 66 67 typedef BReference<PackageInfoListener> PackageInfoListenerRef; 68 69 70 #endif // PACKAGE_INFO_LISTENER_H 71