2010-05-07 04:47:10 -05:00
|
|
|
/*
|
2010-05-27 19:47:00 -05:00
|
|
|
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
|
2010-05-07 04:47:10 -05:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _BITMAP_VIEW_H
|
|
|
|
#define _BITMAP_VIEW_H
|
|
|
|
|
|
|
|
#include <View.h>
|
|
|
|
|
|
|
|
class BBitmap;
|
|
|
|
|
|
|
|
class BitmapView : public BView {
|
|
|
|
public:
|
2013-01-04 07:52:14 -06:00
|
|
|
BitmapView(const char* name = NULL,
|
|
|
|
uint32 flags = B_WILL_DRAW);
|
|
|
|
~BitmapView();
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
virtual void AttachedToWindow();
|
2010-05-29 23:24:53 -05:00
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
status_t InitCheck();
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
BBitmap* Bitmap() const;
|
2010-06-15 12:09:31 -05:00
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
status_t SetBitmap(const char* filename);
|
|
|
|
status_t SetBitmap(const BBitmap* bitmap);
|
2021-07-27 20:48:03 -05:00
|
|
|
void SetSquare(bool isSquare);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
virtual BSize MinSize();
|
|
|
|
virtual BSize MaxSize();
|
|
|
|
virtual BSize PreferredSize();
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
virtual void Draw(BRect frame);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
private:
|
2021-07-27 20:48:03 -05:00
|
|
|
BRect _ViewBounds();
|
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
BBitmap* fBitmap;
|
2021-07-27 20:48:03 -05:00
|
|
|
bool fIsSquare;
|
2013-01-04 07:52:14 -06:00
|
|
|
float fWidth;
|
|
|
|
float fHeight;
|
2010-05-07 04:47:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _BITMAP_VIEW_H
|