xref: /haiku/src/apps/showimage/ShowImageWindow.h (revision b6b0567fbd186f8ce8a0c90bdc7a7b5b4c649678)
1 /*
2  * Copyright 2003-2009, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Fernando Francisco de Oliveira
7  *		Michael Wilber
8  *		Michael Pfeiffer
9  */
10 #ifndef SHOW_IMAGE_WINDOW_H
11 #define SHOW_IMAGE_WINDOW_H
12 
13 
14 #include "PrintOptionsWindow.h"
15 
16 
17 #include <Window.h>
18 
19 
20 class BFilePanel;
21 class BMenu;
22 class BMenuBar;
23 class BMenuItem;
24 class ShowImageView;
25 class ShowImageStatusView;
26 
27 
28 class ShowImageWindow : public BWindow {
29 	public:
30 		ShowImageWindow(const entry_ref *ref, const BMessenger& trackerMessenger);
31 		virtual ~ShowImageWindow();
32 
33 		virtual void FrameResized(float width, float height);
34 		virtual void MessageReceived(BMessage *message);
35 		virtual bool QuitRequested();
36 		virtual void ScreenChanged(BRect frame, color_space mode);
37 
38 		status_t InitCheck();
39 		ShowImageView* GetShowImageView() const { return fImageView; }
40 
41 		void UpdateTitle();
42 		void AddMenus(BMenuBar *bar);
43 		void BuildContextMenu(BMenu *menu);
44 		void WindowRedimension(BBitmap *bitmap);
45 
46 	private:
47 		class RecentDocumentsMenu;
48 
49 		void _BuildViewMenu(BMenu *menu, bool popupMenu);
50 		BMenuItem* _AddItemMenu(BMenu *menu, const char *label,
51 			uint32 what, const char shortcut, uint32 modifier,
52 			const BHandler *target, bool enabled = true);
53 		BMenuItem* _AddDelayItem(BMenu *menu, const char *label, float value);
54 
55 		bool _ToggleMenuItem(uint32 what);
56 		void _EnableMenuItem(BMenu *menu, uint32 what, bool enable);
57 		void _MarkMenuItem(BMenu *menu, uint32 what, bool marked);
58 		void _MarkSlideShowDelay(float value);
59 		void _ResizeToWindow(bool shrink, uint32 what);
60 
61 		void _SaveAs(BMessage *message);
62 			// Handle Save As submenu choice
63 		void _SaveToFile(BMessage *message);
64 			// Handle save file panel message
65 		bool _ClosePrompt();
66 		void _ToggleFullScreen();
67 		void _LoadSettings();
68 		void _SavePrintOptions();
69 		bool _PageSetup();
70 		void _PrepareForPrint();
71 		void _Print(BMessage *msg);
72 
73 		void _OpenResizerWindow(int32 width, int32 height);
74 		void _UpdateResizerWindow(int32 width, int32 height);
75 		void _CloseResizerWindow();
76 
77 		BFilePanel* fSavePanel;
78 		BMenuBar* fBar;
79 		BMenu* fOpenMenu;
80 		BMenu* fBrowseMenu;
81 		BMenu* fGoToPageMenu;
82 		BMenu* fSlideShowDelay;
83 		ShowImageView* fImageView;
84 		ShowImageStatusView* fStatusView;
85 		bool fModified;
86 		bool fFullScreen;
87 		BRect fWindowFrame;
88 		bool fShowCaption;
89 		BMessage* fPrintSettings;
90 		PrintOptions fPrintOptions;
91 		BMessenger* fResizerWindowMessenger;
92 		BMenuItem* fResizeItem;
93 		int32 fHeight;
94 		int32 fWidth;
95 };
96 
97 #endif	// SHOW_IMAGE_WINDOW_H
98