vfs: check userland buffers before reading them.
[haiku.git] / src / apps / showimage / ImageFileNavigator.h
blob7a7b6db4584626acc044f15e6e1cff92a0d83001
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.
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>
15 #ifndef IMAGE_FILE_NAVIGATOR_H
16 #define IMAGE_FILE_NAVIGATOR_H
19 #include <Entry.h>
20 #include <Messenger.h>
21 #include <String.h>
24 class Navigator;
27 class ImageFileNavigator {
28 public:
29 ImageFileNavigator(const entry_ref& ref,
30 const BMessenger& trackerMessenger);
31 virtual ~ImageFileNavigator();
33 void SetTo(const entry_ref& ref, int32 page = 1,
34 int32 pageCount = 1);
35 const entry_ref& CurrentRef() const { return fCurrentRef; }
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();
42 bool FirstPage();
43 bool LastPage();
44 bool NextPage();
45 bool PreviousPage();
46 bool HasNextPage();
47 bool HasPreviousPage();
48 bool GoToPage(int32 page);
50 bool FirstFile();
51 bool NextFile();
52 bool PreviousFile();
53 bool HasNextFile();
54 bool HasPreviousFile();
56 bool GetNextFile(const entry_ref& ref,
57 entry_ref& nextRef);
58 bool GetPreviousFile(const entry_ref& ref,
59 entry_ref& previousRef);
61 bool MoveFileToTrash();
63 private:
64 Navigator* fNavigator;
66 entry_ref fCurrentRef;
67 int32 fDocumentIndex;
68 // of the image in the file
69 int32 fDocumentCount;
70 // number of images in the file
72 BString fImageType;
73 // Type of image, for use in status bar and caption
74 BString fImageMime;
78 #endif // IMAGE_FILE_NAVIGATOR_H