13 M_BITMAP_ADDED
= 'mbma',
14 M_BITMAP_REMOVED
= 'mbmr'
17 class BitmapView
: public BView
, public BInvoker
20 BitmapView(BRect frame
, const char *name
, BMessage
*mod
, BBitmap
*bitmap
,
21 const char *label
= NULL
, border_style
= B_PLAIN_BORDER
,
22 int32 resize
= B_FOLLOW_LEFT
| B_FOLLOW_TOP
, int32 flags
= B_WILL_DRAW
);
24 virtual void AttachedToWindow(void);
26 virtual void Draw(BRect rect
);
27 virtual void MessageReceived(BMessage
*msg
);
28 virtual void MouseDown(BPoint pt
);
29 virtual void FrameResized(float w
, float h
);
31 virtual void SetBitmap(BBitmap
*bitmap
);
32 BBitmap
*GetBitmap(void) const { return fBitmap
; }
34 bool IsEnabled(void) const { return fEnabled
; }
35 virtual void SetEnabled(bool value
);
37 // const char *Label(void) const { return fLabel.String(); }
38 // virtual void SetLabel(const char *label);
40 border_style
Style(void) const { return fBorderStyle
; }
41 virtual void SetStyle(border_style style
);
43 bool IsFixedSize(void) const { return fFixedSize
; }
44 void SetFixedSize(bool isfixed
);
46 bool AcceptsDrops(void) const { return fAcceptDrops
; }
47 virtual void SetAcceptDrops(bool accept
);
49 bool AcceptsPaste(void) const { return fAcceptPaste
; }
50 virtual void SetAcceptPaste(bool accept
);
52 bool ConstrainsDrops(void) const { return fConstrainDrops
; }
53 virtual void SetConstrainDrops(bool value
);
55 void MaxBitmapSize(float *width
, float *height
) const;
56 virtual void SetMaxBitmapSize(const float &width
, const float &height
);
58 bool IsBitmapRemovable(void) const { return fRemovableBitmap
; }
59 void SetBitmapRemovable(bool isremovable
);
61 void RemoveBitmap(void);
62 void PasteBitmap(void);
65 void CalculateBitmapRect(void);
66 void ConstrainBitmap(void);
68 bool ClipboardHasBitmap(void);
69 BBitmap
*BitmapFromClipboard(void);
71 float fNoPhotoWidths
[4];
72 BPoint fNoPhotoOffsets
[4];
78 border_style fBorderStyle
;
83 float fMaxWidth
, fMaxHeight
;
84 bool fRemovableBitmap
;
85 BPopUpMenu
*fPopUpMenu
;
87 BMenuItem
*fPasteItem
;
88 BMenuItem
*fRemoveItem
;
91 BRect
ScaleRectToFit(const BRect
&from
, const BRect
&to
);