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 MSG_EXIT_FULL_SCREEN = 'mEFS', 46 MSG_WINDOW_HAS_QUIT = 'wndq' 47 }; 48 49 50 class ShowImageWindow : public BWindow { 51 public: 52 ShowImageWindow(BRect frame, 53 const entry_ref& ref, 54 const BMessenger& trackerMessenger); 55 virtual ~ShowImageWindow(); 56 57 void BuildContextMenu(BMenu* menu); 58 59 protected: 60 virtual void Zoom(BPoint origin, float width, float height); 61 virtual void MessageReceived(BMessage* message); 62 virtual bool QuitRequested(); 63 64 private: 65 void _AddMenus(BMenuBar* bar); 66 void _ResizeWindowToImage(); 67 void _BuildViewMenu(BMenu* menu, bool popupMenu); 68 BMenu* _BuildRatingMenu(); 69 BMenuItem* _AddItemMenu(BMenu* menu, const char* label, 70 uint32 what, char shortcut, uint32 modifier, 71 const BHandler* target, 72 bool enabled = true); 73 BMenuItem* _AddDelayItem(BMenu* menu, const char* label, 74 bigtime_t delay); 75 76 bool _ToggleMenuItem(uint32 what); 77 void _EnableMenuItem(BMenu* menu, uint32 what, 78 bool enable); 79 void _MarkMenuItem(BMenu* menu, uint32 what, 80 bool marked); 81 void _MarkSlideShowDelay(bigtime_t delay); 82 83 void _UpdateStatusText(const BMessage* message); 84 void _LoadError(const entry_ref& ref); 85 void _SaveAs(BMessage* message); 86 // Handle Save As submenu choice 87 void _SaveToFile(BMessage* message); 88 // Handle save file panel message 89 bool _ClosePrompt(); 90 status_t _LoadImage(bool forward = true); 91 bool _PreloadImage(bool forward, entry_ref& ref); 92 void _ToggleFullScreen(); 93 void _ApplySettings(); 94 void _SavePrintOptions(); 95 bool _PageSetup(); 96 void _PrepareForPrint(); 97 void _Print(BMessage* msg); 98 99 void _SetSlideShowDelay(bigtime_t delay); 100 void _StartSlideShow(); 101 void _StopSlideShow(); 102 103 void _UpdateRatingMenu(); 104 105 void _SetToolBarVisible(bool visible); 106 107 private: 108 ImageFileNavigator fNavigator; 109 BFilePanel* fSavePanel; 110 BMenuBar* fBar; 111 BMenu* fBrowseMenu; 112 BMenu* fGoToPageMenu; 113 BMenu* fSlideShowDelayMenu; 114 BMenu* fRatingMenu; 115 ToolBarView* fToolBarView; 116 BScrollView* fScrollView; 117 BScrollBar* fVerticalScrollBar; 118 ShowImageView* fImageView; 119 ShowImageStatusView* fStatusView; 120 ProgressWindow* fProgressWindow; 121 bool fModified; 122 bool fFullScreen; 123 bool fShowCaption; 124 bool fShowToolBar; 125 BRect fWindowFrame; 126 BMessage* fPrintSettings; 127 PrintOptions fPrintOptions; 128 129 BString fImageType; 130 131 BMessageRunner* fSlideShowRunner; 132 bigtime_t fSlideShowDelay; 133 }; 134 135 136 #endif // SHOW_IMAGE_WINDOW_H 137