1 /* 2 * Copyright 2011, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Philippe Houdoin 7 */ 8 #ifndef PICTURE_VIEW_H 9 #define PICTURE_VIEW_H 10 11 12 #include <Node.h> 13 #include <String.h> 14 #include <View.h> 15 16 17 class BBitmap; 18 class BFilePanel; 19 20 const uint32 kMsgLoadImage = 'mLIM'; 21 22 23 class PictureView : public BView { 24 public: 25 PictureView(float width, float height, 26 const entry_ref* ref); 27 virtual ~PictureView(); 28 29 bool HasChanged(); 30 void Revert(); 31 void Update(); 32 void Update(const entry_ref* ref); 33 34 BBitmap* Bitmap(); 35 uint32 SuggestedType(); 36 const char* SuggestedMIMEType(); 37 38 virtual void MessageReceived(BMessage* message); 39 virtual void Draw(BRect updateRect); 40 virtual void MouseDown(BPoint point); 41 virtual void KeyDown(const char* bytes, int32 numBytes); 42 virtual void WindowActivated(bool active); 43 virtual void MakeFocus(bool focused); 44 45 private: 46 void _BeginDrag(BPoint sourcePoint); 47 void _HandleDrop(BMessage* message); 48 void _ShowPopUpMenu(BPoint screen); 49 BBitmap* _CopyPicture(uint8 alpha); 50 51 status_t _LoadPicture(const entry_ref* ref); 52 void _SetPicture(BBitmap* bitmap); 53 54 BBitmap* fPicture; 55 BBitmap* fOriginalPicture; 56 BBitmap* fDefaultPicture; 57 bool fShowingPopUpMenu; 58 BRect fPictureRect; 59 uint32 fPictureType; 60 BString fPictureMIMEType; 61 bool fFocusChanging; 62 BFilePanel* fOpenPanel; 63 }; 64 65 #endif 66