libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / resedit / BitmapView.h
blob879915557bfa192a451c1f87daa4387aa61266b7
1 #ifndef BMPVIEW_H
2 #define BMPVIEW_H
4 #include <Bitmap.h>
5 #include <Message.h>
6 #include <Invoker.h>
7 #include <PopUpMenu.h>
8 #include <String.h>
9 #include <View.h>
11 enum
13 M_BITMAP_ADDED = 'mbma',
14 M_BITMAP_REMOVED = 'mbmr'
17 class BitmapView : public BView, public BInvoker
19 public:
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);
23 ~BitmapView(void);
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);
64 private:
65 void CalculateBitmapRect(void);
66 void ConstrainBitmap(void);
68 bool ClipboardHasBitmap(void);
69 BBitmap *BitmapFromClipboard(void);
71 float fNoPhotoWidths[4];
72 BPoint fNoPhotoOffsets[4];
74 BBitmap *fBitmap;
75 BRect fBitmapRect;
76 bool fEnabled;
77 BString fLabel;
78 border_style fBorderStyle;
79 bool fFixedSize;
80 bool fAcceptDrops;
81 bool fAcceptPaste;
82 bool fConstrainDrops;
83 float fMaxWidth, fMaxHeight;
84 bool fRemovableBitmap;
85 BPopUpMenu *fPopUpMenu;
86 uint32 fMouseButtons;
87 BMenuItem *fPasteItem;
88 BMenuItem *fRemoveItem;
91 BRect ScaleRectToFit(const BRect &from, const BRect &to);
93 #endif