xref: /haiku/src/apps/showimage/ImageFileNavigator.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 2003-2010, Haiku, Inc. All Rights Reserved.
3  * Copyright 2004-2005 yellowTAB GmbH. All Rights Reserverd.
4  * Copyright 2006 Bernd Korz. All Rights Reserved
5  * Distributed under the terms of the MIT License.
6  *
7  * Authors:
8  *		Fernando Francisco de Oliveira
9  *		Michael Wilber
10  *		Michael Pfeiffer
11  *		yellowTAB GmbH
12  *		Bernd Korz
13  *		Stephan Aßmus <superstippi@gmx.de>
14  */
15 #ifndef IMAGE_FILE_NAVIGATOR_H
16 #define IMAGE_FILE_NAVIGATOR_H
17 
18 
19 #include <Entry.h>
20 #include <Messenger.h>
21 #include <String.h>
22 
23 
24 class Navigator;
25 
26 
27 class ImageFileNavigator {
28 public:
29 								ImageFileNavigator(const entry_ref& ref,
30 									const BMessenger& trackerMessenger);
31 	virtual						~ImageFileNavigator();
32 
33 			void				SetTo(const entry_ref& ref, int32 page = 1,
34 									int32 pageCount = 1);
35 			const entry_ref&	CurrentRef() const { return fCurrentRef; }
36 
37 			// The same image file may have multiple pages, TIFF images for
38 			// example. The page count is determined at image loading time.
39 			int32				CurrentPage();
40 			int32				PageCount();
41 
42 			bool				FirstPage();
43 			bool				LastPage();
44 			bool				NextPage();
45 			bool				PreviousPage();
46 			bool				HasNextPage();
47 			bool				HasPreviousPage();
48 			bool				GoToPage(int32 page);
49 
50 			bool				FirstFile();
51 			bool				NextFile();
52 			bool				PreviousFile();
53 			bool				HasNextFile();
54 			bool				HasPreviousFile();
55 
56 			bool				GetNextFile(const entry_ref& ref,
57 									entry_ref& nextRef);
58 			bool				GetPreviousFile(const entry_ref& ref,
59 									entry_ref& previousRef);
60 
61 			bool				MoveFileToTrash();
62 
63 private:
64 			Navigator*			fNavigator;
65 
66 			entry_ref			fCurrentRef;
67 			int32				fDocumentIndex;
68 				// of the image in the file
69 			int32				fDocumentCount;
70 				// number of images in the file
71 
72 			BString				fImageType;
73 				// Type of image, for use in status bar and caption
74 			BString				fImageMime;
75 };
76 
77 
78 #endif	// IMAGE_FILE_NAVIGATOR_H
79