1 /* 2 * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>. 3 * Copyright 2013, Rene Gollent <rene@gollent.com>. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef PACKAGE_LIST_VIEW_H 7 #define PACKAGE_LIST_VIEW_H 8 9 10 #include <ColumnListView.h> 11 #include <ColumnTypes.h> 12 #include <Locker.h> 13 #include <util/OpenHashTable.h> 14 15 #include "PackageInfo.h" 16 17 18 class PackageRow; 19 class PackageListener; 20 class WorkStatusView; 21 22 23 class PackageListView : public BColumnListView { 24 public: 25 PackageListView(BLocker* modelLock); 26 virtual ~PackageListView(); 27 28 virtual void AttachedToWindow(); 29 virtual void AllAttached(); 30 31 virtual void MessageReceived(BMessage* message); 32 33 virtual void SelectionChanged(); 34 35 virtual void Clear(); 36 void AddPackage(const PackageInfoRef& package); 37 void RemovePackage(const PackageInfoRef& package); 38 39 void SelectPackage(const PackageInfoRef& package); 40 41 void AttachWorkStatusView(WorkStatusView* view); 42 43 private: 44 PackageRow* _FindRow(const PackageInfoRef& package); 45 PackageRow* _FindRow(const BString& packageName); 46 47 private: 48 class ItemCountView; 49 struct RowByNameHashDefinition; 50 typedef BOpenHashTable<RowByNameHashDefinition> RowByNameTable; 51 52 BLocker* fModelLock; 53 ItemCountView* fItemCountView; 54 PackageListener* fPackageListener; 55 RowByNameTable* fRowByNameTable; 56 57 WorkStatusView* fWorkStatusView; 58 }; 59 60 #endif // PACKAGE_LIST_VIEW_H 61