1 /* 2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef FEATURED_PACKAGES_VIEW_H 6 #define FEATURED_PACKAGES_VIEW_H 7 8 9 #include <View.h> 10 11 #include "PackageInfo.h" 12 #include "PackageInfoListener.h" 13 14 15 class BGroupLayout; 16 class ScrollableGroupView; 17 18 19 class FeaturedPackagesView : public BView { 20 public: 21 FeaturedPackagesView(); 22 virtual ~FeaturedPackagesView(); 23 24 void AddPackage(const PackageInfoRef& package); 25 void RemovePackage(const PackageInfoRef& package); 26 void Clear(); 27 28 void SelectPackage(const PackageInfoRef& package, 29 bool scrollToEntry = false); 30 31 static void CleanupIcons(); 32 33 private: 34 const char* _PackageNameAtIndex(int32 index) const; 35 int32 _InsertionIndex( 36 const BString& packageName) const; 37 int32 _InsertionIndexBinary(const BString& packageName, 38 int32 startIndex, int32 endIndex) const; 39 int32 _InsertionIndexLinear(const BString& packageName, 40 int32 startIndex, int32 endIndex) const; 41 42 private: 43 BGroupLayout* fPackageListLayout; 44 ScrollableGroupView* fContainerView; 45 }; 46 47 48 #endif // FEATURED_PACKAGES_VIEW_H 49