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