xref: /haiku/src/apps/showimage/ShowImageWindow.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 /*****************************************************************************/
2 // ShowImageWindow
3 // Written by Fernando Francisco de Oliveira, Michael Wilber
4 //
5 // ShowImageWindow.h
6 //
7 //
8 // Copyright (c) 2003 OpenBeOS Project
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 // DEALINGS IN THE SOFTWARE.
27 /*****************************************************************************/
28 
29 #ifndef _ShowImageWindow_h
30 #define _ShowImageWindow_h
31 
32 #include <Window.h>
33 #include <FilePanel.h>
34 #include <TranslationDefs.h>
35 #include <String.h>
36 
37 class ShowImageView;
38 class ShowImageStatusView;
39 
40 // BMessage field names used in Save messages
41 #define TRANSLATOR_FLD "be:translator"
42 #define TYPE_FLD "be:type"
43 
44 class ShowImageWindow : public BWindow {
45 public:
46 	ShowImageWindow(const entry_ref *pref);
47 	virtual ~ShowImageWindow();
48 
49 	virtual void FrameResized(float width, float height);
50 	virtual void MessageReceived(BMessage *pmsg);
51 	virtual bool QuitRequested();
52 	virtual void Quit();
53 
54 	status_t InitCheck();
55 	ShowImageView *GetShowImageView() const { return fpimageView; }
56 
57 	void SetRef(const entry_ref *pref);
58 	void UpdateTitle();
59 	void LoadMenus(BMenuBar *pbar);
60 	void WindowRedimension(BBitmap *pbitmap);
61 
62 private:
63 	BMenuItem *AddItemMenu(BMenu *pmenu, char *caption,
64 		long unsigned int msg, char shortcut, uint32 modifier,
65 		char target, bool enabled);
66 
67 	void SaveAs(BMessage *pmsg);
68 		// Handle Save As submenu choice
69 	void SaveToFile(BMessage *pmsg);
70 		// Handle save file panel message
71 	bool CanQuit();
72 		// returns true if the window can be closed safely, false if not
73 
74 	BFilePanel *fpsavePanel;
75 	BMenuBar *fpbar;
76 	BMenu *fppageMenu;
77 	entry_ref *fpref;
78 	ShowImageView *fpimageView;
79 	ShowImageStatusView *fpstatusView;
80 };
81 
82 #endif /* _ShowImageWindow_h */
83