1 /* 2 * Copyright 2003-2011, 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 <Window.h> 15 16 #include "ImageFileNavigator.h" 17 #include "PrintOptionsWindow.h" 18 19 20 class BFilePanel; 21 class BMenu; 22 class BMenuBar; 23 class BMenuItem; 24 class BMessageRunner; 25 class BScrollBar; 26 class BScrollView; 27 class ProgressWindow; 28 class ShowImageView; 29 class ShowImageStatusView; 30 class ToolBarView; 31 32 33 // public message constants 34 enum { 35 MSG_MODIFIED = 'mMOD', 36 MSG_UPDATE_STATUS = 'mUPS', 37 MSG_UPDATE_STATUS_TEXT = 'mUPT', 38 MSG_SELECTION = 'mSEL', 39 MSG_FILE_NEXT = 'mFLN', 40 MSG_FILE_PREV = 'mFLP', 41 kMsgDeleteCurrentFile = 'mDcF', 42 MSG_SLIDE_SHOW = 'mSSW', 43 kMsgStopSlideShow = 'msss', 44 MSG_FULL_SCREEN = 'mFSC', 45 kShowToolBarIfEnabled = 'mSTE', 46 MSG_EXIT_FULL_SCREEN = 'mEFS', 47 MSG_WINDOW_HAS_QUIT = 'wndq' 48 }; 49 50 51 class ShowImageWindow : public BWindow { 52 public: 53 ShowImageWindow(BRect frame, 54 const entry_ref& ref, 55 const BMessenger& trackerMessenger); 56 virtual ~ShowImageWindow(); 57 58 void BuildContextMenu(BMenu* menu); 59 60 protected: 61 virtual void Zoom(BPoint origin, float width, float height); 62 virtual void MessageReceived(BMessage* message); 63 virtual bool QuitRequested(); 64 65 private: 66 void _AddMenus(BMenuBar* bar); 67 void _ResizeWindowToImage(); 68 void _BuildViewMenu(BMenu* menu, bool popupMenu); 69 BMenu* _BuildRatingMenu(); 70 BMenuItem* _AddItemMenu(BMenu* menu, const char* label, 71 uint32 what, char shortcut, uint32 modifier, 72 const BHandler* target, 73 bool enabled = true); 74 BMenuItem* _AddDelayItem(BMenu* menu, const char* label, 75 bigtime_t delay); 76 77 bool _ToggleMenuItem(uint32 what); 78 void _EnableMenuItem(BMenu* menu, uint32 what, 79 bool enable); 80 void _MarkMenuItem(BMenu* menu, uint32 what, 81 bool marked); 82 void _MarkSlideShowDelay(bigtime_t delay); 83 84 void _UpdateStatusText(const BMessage* message); 85 void _LoadError(const entry_ref& ref); 86 void _SaveAs(BMessage* message); 87 // Handle Save As submenu choice 88 void _SaveToFile(BMessage* message); 89 // Handle save file panel message 90 bool _ClosePrompt(); 91 status_t _LoadImage(bool forward = true); 92 bool _PreloadImage(bool forward, entry_ref& ref); 93 void _ToggleFullScreen(); 94 void _ApplySettings(); 95 void _SavePrintOptions(); 96 bool _PageSetup(); 97 void _PrepareForPrint(); 98 void _Print(BMessage* msg); 99 100 void _SetSlideShowDelay(bigtime_t delay); 101 void _StartSlideShow(); 102 void _StopSlideShow(); 103 104 void _UpdateRatingMenu(); 105 106 void _SetToolBarVisible(bool visible, 107 bool animate = false); 108 109 private: 110 ImageFileNavigator fNavigator; 111 BFilePanel* fSavePanel; 112 BMenuBar* fBar; 113 BMenu* fBrowseMenu; 114 BMenu* fGoToPageMenu; 115 BMenu* fSlideShowDelayMenu; 116 BMenu* fRatingMenu; 117 ToolBarView* fToolBarView; 118 bool fToolBarVisible; 119 BScrollView* fScrollView; 120 BScrollBar* fVerticalScrollBar; 121 ShowImageView* fImageView; 122 ShowImageStatusView* fStatusView; 123 ProgressWindow* fProgressWindow; 124 bool fModified; 125 bool fFullScreen; 126 bool fShowCaption; 127 bool fShowToolBar; 128 BRect fWindowFrame; 129 BMessage* fPrintSettings; 130 PrintOptions fPrintOptions; 131 132 BString fImageType; 133 134 BMessageRunner* fSlideShowRunner; 135 bigtime_t fSlideShowDelay; 136 }; 137 138 139 #endif // SHOW_IMAGE_WINDOW_H 140