1 /* 2 * Copyright 2010 Wim van der Meer <WPJvanderMeer@gmail.com> 3 * Copyright Karsten Heimrich, host.haiku@gmx.de. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 * Authors: 7 * Karsten Heimrich 8 * Fredrik Modéen 9 * Wim van der Meer 10 */ 11 #ifndef SCREENSHOT_WINDOW_H 12 #define SCREENSHOT_WINDOW_H 13 14 15 #include <String.h> 16 #include <TranslationDefs.h> 17 #include <TranslatorFormats.h> 18 #include <Window.h> 19 20 21 class BBitmap; 22 class BCheckBox; 23 class BFilePanel; 24 class BMenu; 25 class BPath; 26 class BTextControl; 27 class BTextView; 28 29 class Utility; 30 31 32 class ScreenshotWindow : public BWindow { 33 public: 34 ScreenshotWindow(const Utility& utility, 35 bool silent, bool clipboard); 36 ~ScreenshotWindow(); 37 38 void MessageReceived(BMessage* message); 39 void Quit(); 40 41 private: 42 void _NewScreenshot(bool silent = false, 43 bool clipboard = false, 44 bool ignoreDelay = false); 45 void _UpdatePreviewPanel(); 46 void _DisallowChar(BTextView* textView); 47 void _SetupOutputPathMenu(const BMessage& settings); 48 void _AddItemToPathMenu(const char* path, 49 BString& label, int32 index, bool markItem, 50 uint32 shortcutKey = 0); 51 void _UpdateFilenameSelection(); 52 void _SetupTranslatorMenu(); 53 void _DisplaySaveError(BString _message); 54 status_t _SaveScreenshot(); 55 void _ShowSettings(bool activate); 56 BString _FindValidFileName(const char* name); 57 BPath _GetDirectory(); 58 void _ReadSettings(); 59 void _WriteSettings(); 60 61 const Utility& fUtility; 62 63 BView* fPreview; 64 BCheckBox* fActiveWindow; 65 BTextControl* fDelayControl; 66 BCheckBox* fWindowBorder; 67 BCheckBox* fShowCursor; 68 BTextControl* fNameControl; 69 BMenu* fTranslatorMenu; 70 BMenu* fOutputPathMenu; 71 BBitmap* fScreenshot; 72 BFilePanel* fOutputPathPanel; 73 BMenuItem* fLastSelectedPath; 74 BWindow* fSettingsWindow; 75 76 bigtime_t fDelay; 77 bool fIncludeBorder; 78 bool fIncludeCursor; 79 bool fGrabActiveWindow; 80 BString fOutputFilename; 81 BString fExtension; 82 int32 fImageFileType; 83 }; 84 85 86 #endif // SCREENSHOT_WINDOW_H 87