1 /* 2 * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef BITMAP_VIEW_H 6 #define BITMAP_VIEW_H 7 8 9 #include "SharedBitmap.h" 10 11 #include <View.h> 12 13 14 class BitmapView : public BView { 15 public: 16 BitmapView(const char* name); 17 18 virtual ~BitmapView(); 19 20 virtual void AllAttached(); 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 SharedBitmap::Size bitmapSize 29 = SharedBitmap::SIZE_ANY); 30 void UnsetBitmap(); 31 void SetScaleBitmap(bool scaleBitmap); 32 33 protected: 34 virtual void DrawBackground(BRect& bounds, 35 BRect updateRect); 36 37 private: 38 BitmapRef fReference; 39 SharedBitmap::Size fBitmapSize; 40 const BBitmap* fBitmap; 41 bool fScaleBitmap; 42 }; 43 44 45 #endif // BITMAP_VIEW_H 46