xref: /haiku/src/tools/translation/inspector/ImageView.h (revision d1de8bd2d454b05bb74a8f7833111592b8bd7e5b)
1ca699cf3SMatthew Wilber /*****************************************************************************/
2ca699cf3SMatthew Wilber // ImageView
3ca699cf3SMatthew Wilber // Written by Michael Wilber, OBOS Translation Kit Team
4ca699cf3SMatthew Wilber //
5ca699cf3SMatthew Wilber // ImageView.h
6ca699cf3SMatthew Wilber //
7ca699cf3SMatthew Wilber // BView class for showing images.  Images can be dropped on this view
8ca699cf3SMatthew Wilber // from the tracker and images viewed in this view can be dragged
9ca699cf3SMatthew Wilber // to the tracker to be saved.
10ca699cf3SMatthew Wilber //
11ca699cf3SMatthew Wilber //
12ca699cf3SMatthew Wilber // Copyright (c) 2003 OpenBeOS Project
13ca699cf3SMatthew Wilber //
14ca699cf3SMatthew Wilber // Permission is hereby granted, free of charge, to any person obtaining a
15ca699cf3SMatthew Wilber // copy of this software and associated documentation files (the "Software"),
16ca699cf3SMatthew Wilber // to deal in the Software without restriction, including without limitation
17ca699cf3SMatthew Wilber // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18ca699cf3SMatthew Wilber // and/or sell copies of the Software, and to permit persons to whom the
19ca699cf3SMatthew Wilber // Software is furnished to do so, subject to the following conditions:
20ca699cf3SMatthew Wilber //
21ca699cf3SMatthew Wilber // The above copyright notice and this permission notice shall be included
22ca699cf3SMatthew Wilber // in all copies or substantial portions of the Software.
23ca699cf3SMatthew Wilber //
24ca699cf3SMatthew Wilber // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25ca699cf3SMatthew Wilber // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26ca699cf3SMatthew Wilber // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27ca699cf3SMatthew Wilber // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28ca699cf3SMatthew Wilber // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29ca699cf3SMatthew Wilber // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30ca699cf3SMatthew Wilber // DEALINGS IN THE SOFTWARE.
31ca699cf3SMatthew Wilber /*****************************************************************************/
32ca699cf3SMatthew Wilber 
33ca699cf3SMatthew Wilber #ifndef IMAGEVIEW_H
34ca699cf3SMatthew Wilber #define IMAGEVIEW_H
35ca699cf3SMatthew Wilber 
36ca699cf3SMatthew Wilber #include <View.h>
37ca699cf3SMatthew Wilber #include <Bitmap.h>
38*d1de8bd2SMatthew Wilber #include <Path.h>
39ca699cf3SMatthew Wilber 
40ca699cf3SMatthew Wilber class ImageView : public BView {
41ca699cf3SMatthew Wilber public:
42ca699cf3SMatthew Wilber 	ImageView(BRect rect, const char *name);
43ca699cf3SMatthew Wilber 	~ImageView();
44ca699cf3SMatthew Wilber 
45ca699cf3SMatthew Wilber 	void AttachedToWindow();
46ca699cf3SMatthew Wilber 	void Draw(BRect rect);
47ca699cf3SMatthew Wilber 	void FrameResized(float width, float height);
48ca699cf3SMatthew Wilber 	void MouseDown(BPoint point);
49ca699cf3SMatthew Wilber 	void MouseMoved(BPoint point, uint32 state, const BMessage *pmsg);
50ca699cf3SMatthew Wilber 	void MouseUp(BPoint point);
51ca699cf3SMatthew Wilber 	void MessageReceived(BMessage *pmsg);
52ca699cf3SMatthew Wilber 
53ca699cf3SMatthew Wilber 	void SetImage(BMessage *pmsg);
54ca699cf3SMatthew Wilber 	bool HasImage() { return fpbitmap ? true : false; };
55ca699cf3SMatthew Wilber 
56ca699cf3SMatthew Wilber private:
57*d1de8bd2SMatthew Wilber 	void UpdateInfoWindow(const BPath &path, const translator_info &info,
58*d1de8bd2SMatthew Wilber 		const char *tranname, const char *traninfo, int32 tranversion);
59ca699cf3SMatthew Wilber 	void ReDraw() { Draw(Bounds()); };
60ca699cf3SMatthew Wilber 	void AdjustScrollBars();
61ca699cf3SMatthew Wilber 	void SaveImageAtDropLocation(BMessage *pmsg);
62ca699cf3SMatthew Wilber 
63ca699cf3SMatthew Wilber 	BBitmap *fpbitmap;
64ca699cf3SMatthew Wilber };
65ca699cf3SMatthew Wilber 
66ca699cf3SMatthew Wilber #endif // #ifndef IMAGEVIEW_H
67