xref: /haiku/src/apps/showimage/ShowImageWindow.h (revision 746cac055adc6ac3308c7bc2d29040fb95689cc9)
1 /*
2  * Copyright 2003-2008, 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 		// virtual	void Zoom(BPoint origin, float width, float height);
38 
39 		status_t InitCheck();
40 		ShowImageView *GetShowImageView() const { return fImageView; }
41 
42 		void UpdateTitle();
43 		void AddMenus(BMenuBar *bar);
44 		void BuildContextMenu(BMenu *menu);
45 		void WindowRedimension(BBitmap *bitmap);
46 
47 	private:
48 		class RecentDocumentsMenu;
49 
50 		void BuildViewMenu(BMenu *menu, bool popupMenu);
51 		BMenuItem *AddItemMenu(BMenu *menu, const char *label,
52 			uint32 what, const char shortcut, uint32 modifier,
53 			const BHandler *target, bool enabled = true);
54 		BMenuItem* AddDelayItem(BMenu *menu, const char *label, float value);
55 
56 		bool ToggleMenuItem(uint32 what);
57 		void EnableMenuItem(BMenu *menu, uint32 what, bool enable);
58 		void MarkMenuItem(BMenu *menu, uint32 what, bool marked);
59 		void MarkSlideShowDelay(float value);
60 		void ResizeToWindow(bool shrink, uint32 what);
61 
62 		void SaveAs(BMessage *message);
63 			// Handle Save As submenu choice
64 		void SaveToFile(BMessage *message);
65 			// Handle save file panel message
66 		bool ClosePrompt();
67 		void ToggleFullScreen();
68 		void LoadSettings();
69 		void SavePrintOptions();
70 		bool PageSetup();
71 		void PrepareForPrint();
72 		void Print(BMessage *msg);
73 
74 		void OpenResizerWindow(int32 width, int32 height);
75 		void UpdateResizerWindow(int32 width, int32 height);
76 		void CloseResizerWindow();
77 
78 		BFilePanel *fSavePanel;
79 		BMenuBar *fBar;
80 		BMenu *fOpenMenu;
81 		BMenu *fBrowseMenu;
82 		BMenu *fGoToPageMenu;
83 		BMenu *fSlideShowDelay;
84 		ShowImageView *fImageView;
85 		ShowImageStatusView *fStatusView;
86 		bool fModified;
87 		bool fFullScreen;
88 		BRect fWindowFrame;
89 		bool fShowCaption;
90 		BMessage *fPrintSettings;
91 		PrintOptions fPrintOptions;
92 		BMessenger *fResizerWindowMessenger;
93 		BMenuItem *fResizeItem;
94 		int32 fHeight, fWidth;
95 };
96 
97 #endif	// SHOW_IMAGE_WINDOW_H
98