xref: /haiku/src/apps/haikudepot/ui_generic/RatingView.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2018-2020, Andrew Lindesay <apl@lindesay.co.nz>.
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef RATING_VIEW_H
7 #define RATING_VIEW_H
8 
9 
10 #include <Referenceable.h>
11 #include <View.h>
12 
13 #include "SharedBitmap.h"
14 
15 
16 class RatingView : public BView {
17 public:
18 								RatingView(const char* name);
19 	virtual						~RatingView();
20 
21 	virtual	void				AttachedToWindow();
22 	virtual	void				Draw(BRect updateRect);
23 
24 	virtual	BSize				MinSize();
25 	virtual	BSize				PreferredSize();
26 	virtual	BSize				MaxSize();
27 
28 			void				SetRating(float rating);
29 			float				Rating() const;
30 
31 protected:
32 	virtual const BBitmap*		StarBitmap();
33 			BReference<SharedBitmap>
34 								fStarBlueBitmap;
35 			BReference<SharedBitmap>
36 								fStarGrayBitmap;
37 
38 private:
39 			float				fRating;
40 };
41 
42 
43 #endif // RATING_VIEW_H
44