1 /*****************************************************************************/ 2 // ShowImageWindow 3 // Written by Fernando Francisco de Oliveira, Michael Wilber, Michael Pfeiffer 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 <Menu.h> 33 #include <Window.h> 34 #include <FilePanel.h> 35 #include <TranslationDefs.h> 36 #include <String.h> 37 38 #include "PrintOptionsWindow.h" 39 40 class ShowImageView; 41 class ShowImageStatusView; 42 43 // BMessage field names used in Save messages 44 #define TRANSLATOR_FLD "be:translator" 45 #define TYPE_FLD "be:type" 46 47 class RecentDocumentsMenu : public BMenu 48 { 49 public: 50 RecentDocumentsMenu(const char *title, menu_layout layout = B_ITEMS_IN_COLUMN); 51 bool AddDynamicItem(add_state s); 52 53 private: 54 void UpdateRecentDocumentsMenu(); 55 }; 56 57 class ShowImageWindow : public BWindow { 58 public: 59 ShowImageWindow(const entry_ref *pref, const BMessenger& trackerMessenger); 60 virtual ~ShowImageWindow(); 61 62 virtual void FrameResized(float width, float height); 63 virtual void MessageReceived(BMessage *pmsg); 64 virtual bool QuitRequested(); 65 virtual void Quit(); 66 virtual void Zoom(BPoint origin, float width, float height); 67 68 status_t InitCheck(); 69 ShowImageView *GetShowImageView() const { return fImageView; } 70 71 void UpdateTitle(); 72 void BuildViewMenu(BMenu *menu); 73 void LoadMenus(BMenuBar *pbar); 74 void WindowRedimension(BBitmap *pbitmap); 75 76 private: 77 BMenuItem *AddItemMenu(BMenu *pmenu, char *caption, 78 long unsigned int msg, char shortcut, uint32 modifier, 79 char target, bool enabled); 80 81 BMenuItem* AddDelayItem(BMenu *pmenu, char *caption, float value); 82 83 bool ToggleMenuItem(uint32 what); 84 void EnableMenuItem(BMenu *menu, uint32 what, bool enable); 85 void MarkMenuItem(BMenu *menu, uint32 what, bool marked); 86 void MarkSlideShowDelay(float value); 87 void ResizeToWindow(bool shrink, uint32 what); 88 89 void SaveAs(BMessage *pmsg); 90 // Handle Save As submenu choice 91 void SaveToFile(BMessage *pmsg); 92 // Handle save file panel message 93 bool ClosePrompt(); 94 bool CanQuit(); 95 // returns true if the window can be closed safely, false if not 96 void ToggleFullScreen(); 97 void LoadSettings(); 98 void SavePrintOptions(); 99 bool PageSetup(); 100 void PrepareForPrint(); 101 void Print(BMessage *msg); 102 103 BFilePanel *fSavePanel; 104 BMenuBar *fBar; 105 BMenu *fOpenMenu; 106 BMenu *fBrowseMenu; 107 BMenu *fGoToPageMenu; 108 BMenu *fSlideShowDelay; 109 ShowImageView *fImageView; 110 ShowImageStatusView *fStatusView; 111 bool fModified; 112 bool fFullScreen; 113 BRect fWindowFrame; 114 bool fShowCaption; 115 BMessage *fPrintSettings; 116 PrintOptions fPrintOptions; 117 }; 118 119 #endif /* _ShowImageWindow_h */ 120