xref: /haiku/src/apps/haikudepot/ui_generic/RatingView.h (revision bddcee2a27042b4d8d6b0142b466f30abc886648)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2018, 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 <View.h>
11 
12 #include "SharedBitmap.h"
13 
14 
15 class RatingView : public BView {
16 public:
17 								RatingView(const char* name);
18 	virtual						~RatingView();
19 
20 	virtual	void				AttachedToWindow();
21 	virtual	void				Draw(BRect updateRect);
22 
23 	virtual	BSize				MinSize();
24 	virtual	BSize				PreferredSize();
25 	virtual	BSize				MaxSize();
26 
27 			void				SetRating(float rating);
28 			float				Rating() const;
29 
30 protected:
31 	virtual const BBitmap*		StarBitmap();
32 			SharedBitmap		fStarBlueBitmap;
33 			SharedBitmap		fStarGrayBitmap;
34 
35 private:
36 			float				fRating;
37 };
38 
39 
40 #endif // RATING_VIEW_H
41