xref: /haiku/src/apps/haikudepot/ui_generic/BitmapView.h (revision 13581b3d2a71545960b98fefebc5225b5bf29072)
1 /*
2  * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>.
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef BITMAP_VIEW_H
7 #define BITMAP_VIEW_H
8 
9 
10 #include "SharedBitmap.h"
11 
12 #include <View.h>
13 
14 
15 class BitmapView : public BView {
16 public:
17 								BitmapView(const char* name);
18 
19 	virtual						~BitmapView();
20 
21 	virtual	void				Draw(BRect updateRect);
22 
23 	virtual	BSize				MinSize();
24 	virtual	BSize				PreferredSize();
25 	virtual	BSize				MaxSize();
26 
27 			void				SetBitmap(SharedBitmap* bitmap,
28 									BitmapSize bitmapSize = BITMAP_SIZE_ANY);
29 			void				UnsetBitmap();
30 			void				SetScaleBitmap(bool scaleBitmap);
31 
32 private:
33 			BitmapRef			fReference;
34 			BitmapSize			fBitmapSize;
35 			const BBitmap*		fBitmap;
36 			bool				fScaleBitmap;
37 };
38 
39 
40 #endif // BITMAP_VIEW_H
41