xref: /haiku/src/apps/showimage/ShowImageWindow.h (revision a7dde370f552f5376edbf25046ec9cf2ba8bbd1a)
1 /*
2  * Copyright 2003-2010, 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,
31 									const BMessenger& trackerMessenger);
32 	virtual						~ShowImageWindow();
33 
34 	virtual	void				FrameResized(float width, float height);
35 	virtual	void				MessageReceived(BMessage* message);
36 	virtual	bool				QuitRequested();
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, char shortcut, uint32 modifier,
52 									const BHandler* target,
53 									bool enabled = true);
54 			BMenuItem*			_AddDelayItem(BMenu* menu, const char* label,
55 									float value);
56 
57 			bool				_ToggleMenuItem(uint32 what);
58 			void				_EnableMenuItem(BMenu* menu, uint32 what,
59 									bool enable);
60 			void				_MarkMenuItem(BMenu* menu, uint32 what,
61 									bool marked);
62 			void				_MarkSlideShowDelay(float value);
63 			void				_ResizeToWindow(bool shrink, uint32 what);
64 
65 			void				_SaveAs(BMessage* message);
66 									// Handle Save As submenu choice
67 			void				_SaveToFile(BMessage* message);
68 									// Handle save file panel message
69 			bool				_ClosePrompt();
70 			void				_ToggleFullScreen();
71 			void				_LoadSettings();
72 			void				_SavePrintOptions();
73 			bool				_PageSetup();
74 			void				_PrepareForPrint();
75 			void				_Print(BMessage* msg);
76 
77 			void				_OpenResizerWindow(int32 width, int32 height);
78 			void				_UpdateResizerWindow(int32 width, int32 height);
79 			void				_CloseResizerWindow();
80 
81 private:
82 			BFilePanel*			fSavePanel;
83 			BMenuBar*			fBar;
84 			BMenu*				fOpenMenu
85 ;			BMenu*				fBrowseMenu;
86 			BMenu*				fGoToPageMenu;
87 			BMenu*				fSlideShowDelay;
88 			ShowImageView*		fImageView;
89 			ShowImageStatusView* fStatusView;
90 			bool				fModified;
91 			bool				fFullScreen;
92 			BRect				fWindowFrame;
93 			bool				fShowCaption;
94 			BMessage*			fPrintSettings;
95 			PrintOptions		fPrintOptions;
96 			BMessenger*			fResizerWindowMessenger;
97 			BMenuItem*			fResizeItem;
98 			int32				fHeight;
99 			int32				fWidth;
100 };
101 
102 
103 #endif	// SHOW_IMAGE_WINDOW_H
104