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 ScreenChanged(BRect frame, color_space mode); 47 // virtual void Zoom(BPoint origin, float width, float height); 48 49 status_t InitCheck(); 50 ShowImageView *GetShowImageView() const { return fImageView; } 51 52 void UpdateTitle(); 53 void AddMenus(BMenuBar *bar); 54 void BuildContextMenu(BMenu *menu); 55 void WindowRedimension(BBitmap *bitmap); 56 57 private: 58 void BuildViewMenu(BMenu *menu, bool popupMenu); 59 BMenuItem *AddItemMenu(BMenu *menu, char *caption, 60 uint32 command, char shortcut, uint32 modifier, 61 char target, bool enabled); 62 BMenuItem* AddDelayItem(BMenu *menu, char *caption, float value); 63 64 bool ToggleMenuItem(uint32 what); 65 void EnableMenuItem(BMenu *menu, uint32 what, bool enable); 66 void MarkMenuItem(BMenu *menu, uint32 what, bool marked); 67 void MarkSlideShowDelay(float value); 68 void ResizeToWindow(bool shrink, uint32 what); 69 70 void SaveAs(BMessage *message); 71 // Handle Save As submenu choice 72 void SaveToFile(BMessage *message); 73 // Handle save file panel message 74 bool ClosePrompt(); 75 void ToggleFullScreen(); 76 void LoadSettings(); 77 void SavePrintOptions(); 78 bool PageSetup(); 79 void PrepareForPrint(); 80 void Print(BMessage *msg); 81 82 void OpenResizerWindow(int32 width, int32 height); 83 void UpdateResizerWindow(int32 width, int32 height); 84 void CloseResizerWindow(); 85 86 BFilePanel *fSavePanel; 87 BMenuBar *fBar; 88 BMenu *fOpenMenu; 89 BMenu *fBrowseMenu; 90 BMenu *fGoToPageMenu; 91 BMenu *fSlideShowDelay; 92 ShowImageView *fImageView; 93 ShowImageStatusView *fStatusView; 94 bool fModified; 95 bool fFullScreen; 96 BRect fWindowFrame; 97 bool fShowCaption; 98 BMessage *fPrintSettings; 99 PrintOptions fPrintOptions; 100 BMessenger *fResizerWindowMessenger; 101 BMenuItem *fResizeItem; 102 int32 fHeight, fWidth; 103 }; 104 105 #endif // SHOW_IMAGE_WINDOW_H 106