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( 32 const PackageInfo& package); 33 34 private: 35 BOutlineListView* fContentListView; 36 37 thread_id fContentPopulator; 38 sem_id fContentPopulatorSem; 39 BLocker fPackageLock; 40 PackageInfoRef fPackage; 41 PackageState fLastPackageState; 42 }; 43 44 #endif // PACKAGE_CONTENTS_VIEW_H 45