1 /* 2 * Copyright 2003-2006, 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 #include <FilePanel.h> 17 #include <Menu.h> 18 #include <String.h> 19 #include <TranslationDefs.h> 20 #include <Window.h> 21 22 class ShowImageView; 23 class ShowImageStatusView; 24 25 // BMessage field names used in Save messages 26 #define TRANSLATOR_FLD "be:translator" 27 #define TYPE_FLD "be:type" 28 29 class RecentDocumentsMenu : public BMenu { 30 public: 31 RecentDocumentsMenu(const char *title, menu_layout layout = B_ITEMS_IN_COLUMN); 32 bool AddDynamicItem(add_state addState); 33 34 private: 35 void UpdateRecentDocumentsMenu(); 36 }; 37 38 class ShowImageWindow : public BWindow { 39 public: 40 ShowImageWindow(const entry_ref *ref, const BMessenger& trackerMessenger); 41 virtual ~ShowImageWindow(); 42 43 virtual void FrameResized(float width, float height); 44 virtual void MessageReceived(BMessage *message); 45 virtual bool QuitRequested(); 46 virtual void Zoom(BPoint origin, float width, float height); 47 48 status_t InitCheck(); 49 ShowImageView *GetShowImageView() const { return fImageView; } 50 51 void UpdateTitle(); 52 void BuildViewMenu(BMenu *menu); 53 void AddMenus(BMenuBar *bar); 54 void WindowRedimension(BBitmap *bitmap); 55 56 private: 57 BMenuItem *AddItemMenu(BMenu *menu, char *caption, 58 uint32 command, char shortcut, uint32 modifier, 59 char target, bool enabled); 60 BMenuItem* AddDelayItem(BMenu *menu, char *caption, float value); 61 62 bool ToggleMenuItem(uint32 what); 63 void EnableMenuItem(BMenu *menu, uint32 what, bool enable); 64 void MarkMenuItem(BMenu *menu, uint32 what, bool marked); 65 void MarkSlideShowDelay(float value); 66 void ResizeToWindow(bool shrink, uint32 what); 67 68 void SaveAs(BMessage *message); 69 // Handle Save As submenu choice 70 void SaveToFile(BMessage *message); 71 // Handle save file panel message 72 bool ClosePrompt(); 73 void ToggleFullScreen(); 74 void LoadSettings(); 75 void SavePrintOptions(); 76 bool PageSetup(); 77 void PrepareForPrint(); 78 void Print(BMessage *msg); 79 80 BFilePanel *fSavePanel; 81 BMenuBar *fBar; 82 BMenu *fOpenMenu; 83 BMenu *fBrowseMenu; 84 BMenu *fGoToPageMenu; 85 BMenu *fSlideShowDelay; 86 ShowImageView *fImageView; 87 ShowImageStatusView *fStatusView; 88 bool fModified; 89 bool fFullScreen; 90 BRect fWindowFrame; 91 bool fShowCaption; 92 BMessage *fPrintSettings; 93 PrintOptions fPrintOptions; 94 }; 95 96 #endif // SHOW_IMAGE_WINDOW_H 97