1 /* 2 * Copyright 2020-2024, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef RATING_UTILS_H 6 #define RATING_UTILS_H 7 8 9 #include <Referenceable.h> 10 11 #include "UserRatingInfo.h" 12 13 14 class BView; 15 class BBitmap; 16 17 18 class RatingStarsMetrics 19 { 20 public: 21 RatingStarsMetrics(BSize starSize); 22 23 const BSize StarSize() const; 24 float SpacingBetweenStars() const; 25 const BPoint LocationOfStarAtIndex(int index) const; 26 const BSize Size() const; 27 28 private: 29 BSize fStarSize; 30 }; 31 32 33 class RatingUtils 34 { 35 public: 36 static void Draw(BView* target, BPoint at, float value, 37 const BBitmap* star); 38 static void Draw(BView* target, BPoint at, float value); 39 40 static bool ShouldTryPopulateUserRatings(UserRatingInfoRef userRatingInfo); 41 }; 42 43 44 #endif // RATING_UTILS_H 45