1 /* 2 * Copyright 2015, TigerKid001. 3 * Copyright 2020-2022, Andrew Lindesay <apl@lindesay.co.nz> 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef PACKAGE_CONTENTS_VIEW_H 7 #define PACKAGE_CONTENTS_VIEW_H 8 9 #include <Locker.h> 10 #include <View.h> 11 12 #include "PackageInfo.h" 13 14 class BOutlineListView; 15 16 17 class PackageContentsView : public BView { 18 public: 19 PackageContentsView(const char* name); 20 virtual ~PackageContentsView(); 21 22 virtual void AttachedToWindow(); 23 virtual void AllAttached(); 24 25 void SetPackage(const PackageInfoRef& package); 26 void Clear(); 27 28 private: 29 void _InitContentPopulator(); 30 static int32 _ContentPopulatorThread(void* arg); 31 bool _PopulatePackageContents(const PackageInfoRef& package); 32 33 private: 34 BOutlineListView* fContentListView; 35 36 thread_id fContentPopulator; 37 sem_id fContentPopulatorSem; 38 BLocker fPackageLock; 39 PackageInfoRef fPackage; 40 PackageState fLastPackageState; 41 }; 42 43 #endif // PACKAGE_CONTENTS_VIEW_H 44