xref: /haiku/src/tools/translation/inspector/ImageView.h (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
1ca699cf3SMatthew Wilber /*****************************************************************************/
2ca699cf3SMatthew Wilber // ImageView
3*2ca13760SColdfirex // Written by Michael Wilber, Haiku 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 //
12*2ca13760SColdfirex // Copyright (c) 2003 Haiku 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>
38d1de8bd2SMatthew Wilber #include <Path.h>
39095b7731SMatthew Wilber #include <Entry.h>
40e5ef5305SMatthew Wilber #include <TranslatorRoster.h>
41ca699cf3SMatthew Wilber 
42ca699cf3SMatthew Wilber class ImageView : public BView {
43ca699cf3SMatthew Wilber public:
44ca699cf3SMatthew Wilber 	ImageView(BRect rect, const char *name);
45ca699cf3SMatthew Wilber 	~ImageView();
46ca699cf3SMatthew Wilber 
47ca699cf3SMatthew Wilber 	void AttachedToWindow();
48ca699cf3SMatthew Wilber 	void Draw(BRect rect);
49ca699cf3SMatthew Wilber 	void FrameResized(float width, float height);
50ca699cf3SMatthew Wilber 	void MouseDown(BPoint point);
51ca699cf3SMatthew Wilber 	void MouseMoved(BPoint point, uint32 state, const BMessage *pmsg);
52ca699cf3SMatthew Wilber 	void MouseUp(BPoint point);
53ca699cf3SMatthew Wilber 	void MessageReceived(BMessage *pmsg);
54ca699cf3SMatthew Wilber 
55ca699cf3SMatthew Wilber 	void SetImage(BMessage *pmsg);
HasImage()56ca699cf3SMatthew Wilber 	bool HasImage() { return fpbitmap ? true : false; };
57ca699cf3SMatthew Wilber 
58095b7731SMatthew Wilber 	void FirstPage();
59095b7731SMatthew Wilber 	void LastPage();
60095b7731SMatthew Wilber 	void NextPage();
61095b7731SMatthew Wilber 	void PrevPage();
62095b7731SMatthew Wilber 
63ca699cf3SMatthew Wilber private:
64095b7731SMatthew Wilber 	void UpdateInfoWindow(const BPath &path, BMessage &ioExtension,
6558f77562SMatthew Wilber 		const translator_info &info, BTranslatorRoster *proster);
66e5ef5305SMatthew Wilber 	void ReDraw();
67ca699cf3SMatthew Wilber 	void AdjustScrollBars();
68ca699cf3SMatthew Wilber 	void SaveImageAtDropLocation(BMessage *pmsg);
69ca699cf3SMatthew Wilber 
70e5ef5305SMatthew Wilber 	BTranslatorRoster *SelectTranslatorRoster(BTranslatorRoster &roster);
71e5ef5305SMatthew Wilber 
72095b7731SMatthew Wilber 	entry_ref fcurrentRef;
73095b7731SMatthew Wilber 	int32 fdocumentIndex;
74095b7731SMatthew Wilber 	int32 fdocumentCount;
75ca699cf3SMatthew Wilber 	BBitmap *fpbitmap;
76ca699cf3SMatthew Wilber };
77ca699cf3SMatthew Wilber 
78ca699cf3SMatthew Wilber #endif // #ifndef IMAGEVIEW_H
79