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 12 class BView; 13 class BBitmap; 14 15 16 class RatingStarsMetrics 17 { 18 public: 19 RatingStarsMetrics(BSize starSize); 20 21 const BSize StarSize() const; 22 float SpacingBetweenStars() const; 23 const BPoint LocationOfStarAtIndex(int index) const; 24 const BSize Size() const; 25 26 private: 27 BSize fStarSize; 28 }; 29 30 31 class RatingUtils 32 { 33 public: 34 static void Draw(BView* target, BPoint at, float value, 35 const BBitmap* star); 36 static void Draw(BView* target, BPoint at, float value); 37 }; 38 39 40 #endif // RATING_UTILS_H 41