1 /* 2 * Copyright Karsten Heimrich, host.haiku@gmx.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #include <String.h> 6 #include <Window.h> 7 8 #include "PreviewView.h" 9 10 class BBitmap; 11 class BBox; 12 class BButton; 13 class BCardLayout; 14 class BCheckBox; 15 class BFilePanel; 16 class BMenu; 17 class BRadioButton; 18 class BTextControl; 19 class BTextView; 20 21 22 class ScreenshotWindow : public BWindow { 23 public: 24 ScreenshotWindow(bigtime_t delay = 0, 25 bool includeBorder = false, 26 bool includeMouse = false, 27 bool grabActiveWindow = false, 28 bool showConfigWindow = false, 29 bool saveScreenshotSilent = false); 30 virtual ~ScreenshotWindow(); 31 32 virtual void MessageReceived(BMessage* message); 33 34 private: 35 void _InitWindow(); 36 void _SetupFirstLayoutItem(BCardLayout* layout); 37 void _SetupSecondLayoutItem(BCardLayout* layout); 38 void _DisallowChar(BTextView* textView); 39 void _SetupTranslatorMenu(BMenu* translatorMenu, 40 const BMessage& settings); 41 void _SetupOutputPathMenu(BMenu* outputPathMenu, 42 const BMessage& settings); 43 void _AddItemToPathMenu(const char* path, 44 BString& label, int32 index, bool markItem); 45 void _CenterAndShow(); 46 47 void _UpdatePreviewPanel(); 48 BString _FindValidFileName(const char* name); 49 int32 _PathIndexInMenu(const BString& path) const; 50 51 BMessage _ReadSettings() const; 52 void _WriteSettings() const; 53 54 void _TakeScreenshot(); 55 status_t _GetActiveWindowFrame(BRect* frame); 56 void _MakeTabSpaceTransparent(BRect* frame); 57 58 status_t _SaveScreenshot(); 59 void _SaveScreenshotSilent() const; 60 61 private: 62 PreviewView* fPreview; 63 BRadioButton* fActiveWindow; 64 BRadioButton* fWholeDesktop; 65 BTextControl* fDelayControl; 66 BCheckBox* fWindowBorder; 67 BCheckBox* fShowMouse; 68 BButton* fBackToSave; 69 BButton* fTakeScreenshot; 70 BTextControl* fNameControl; 71 BMenu* fTranslatorMenu; 72 BMenu* fOutputPathMenu; 73 BBitmap* fScreenshot; 74 BFilePanel* fOutputPathPanel; 75 BMenuItem* fLastSelectedPath; 76 77 bigtime_t fDelay; 78 float fTabHeight; 79 80 bool fIncludeBorder; 81 bool fIncludeMouse; 82 bool fGrabActiveWindow; 83 bool fShowConfigWindow; 84 BString fExtension; 85 86 int32 fTranslator; 87 int32 fImageFileType; 88 }; 89