1a75264d3SKarsten Heimrich /* 2a75264d3SKarsten Heimrich * Copyright Karsten Heimrich, host.haiku@gmx.de. All rights reserved. 3a75264d3SKarsten Heimrich * Distributed under the terms of the MIT License. 4689b99a7SFredrik Modeen * 5689b99a7SFredrik Modeen * Authors: 6689b99a7SFredrik Modeen * Karsten Heimrich 7689b99a7SFredrik Modeen * Fredrik Modéen 8a75264d3SKarsten Heimrich */ 9689b99a7SFredrik Modeen #ifndef SCREENSHOT_WINDOW_H 10689b99a7SFredrik Modeen #define SCREENSHOT_WINDOW_H 11689b99a7SFredrik Modeen 12689b99a7SFredrik Modeen 13fc3bed05SKarsten Heimrich #include <String.h> 14a75264d3SKarsten Heimrich #include <Window.h> 15689b99a7SFredrik Modeen #include <TranslatorFormats.h> 16a75264d3SKarsten Heimrich 17a75264d3SKarsten Heimrich 18a75264d3SKarsten Heimrich class BBitmap; 19a75264d3SKarsten Heimrich class BButton; 20a75264d3SKarsten Heimrich class BCardLayout; 21a75264d3SKarsten Heimrich class BCheckBox; 22fc3bed05SKarsten Heimrich class BFilePanel; 23a75264d3SKarsten Heimrich class BMenu; 24a75264d3SKarsten Heimrich class BRadioButton; 25a75264d3SKarsten Heimrich class BTextControl; 26a75264d3SKarsten Heimrich class BTextView; 27689b99a7SFredrik Modeen class BPath; 28689b99a7SFredrik Modeen class PreviewView; 29a75264d3SKarsten Heimrich 30a75264d3SKarsten Heimrich 31a75264d3SKarsten Heimrich class ScreenshotWindow : public BWindow { 32a75264d3SKarsten Heimrich public: 339f07ffa3SKarsten Heimrich ScreenshotWindow(bigtime_t delay = 0, 349f07ffa3SKarsten Heimrich bool includeBorder = false, 35aeaeba65SJoachim Seemer bool includeMouse = false, 369f07ffa3SKarsten Heimrich bool grabActiveWindow = false, 379f07ffa3SKarsten Heimrich bool showConfigWindow = false, 38689b99a7SFredrik Modeen bool saveScreenshotSilent = false, 39689b99a7SFredrik Modeen int32 imageFileType = B_PNG_FORMAT, 40*362b036dSAxel Dörfler int32 translator = 8, 41*362b036dSAxel Dörfler const char* outputFilename = NULL); 42a75264d3SKarsten Heimrich virtual ~ScreenshotWindow(); 43a75264d3SKarsten Heimrich 44a75264d3SKarsten Heimrich virtual void MessageReceived(BMessage* message); 45a75264d3SKarsten Heimrich 46a75264d3SKarsten Heimrich private: 47a75264d3SKarsten Heimrich void _InitWindow(); 48689b99a7SFredrik Modeen BPath _GetDirectory(); 49a75264d3SKarsten Heimrich void _SetupFirstLayoutItem(BCardLayout* layout); 50a75264d3SKarsten Heimrich void _SetupSecondLayoutItem(BCardLayout* layout); 51a75264d3SKarsten Heimrich void _DisallowChar(BTextView* textView); 52ae1cc083SKarsten Heimrich void _SetupTranslatorMenu(BMenu* translatorMenu, 53ae1cc083SKarsten Heimrich const BMessage& settings); 54ae1cc083SKarsten Heimrich void _SetupOutputPathMenu(BMenu* outputPathMenu, 55ae1cc083SKarsten Heimrich const BMessage& settings); 56ae1cc083SKarsten Heimrich void _AddItemToPathMenu(const char* path, 57ae1cc083SKarsten Heimrich BString& label, int32 index, bool markItem); 58a75264d3SKarsten Heimrich 59ae1cc083SKarsten Heimrich void _UpdatePreviewPanel(); 600d84b313SStephan Aßmus void _UpdateFilenameSelection(); 61a9591c50SFredrik Modeen BString _FindValidFileName(const char* name); 62ae1cc083SKarsten Heimrich int32 _PathIndexInMenu(const BString& path) const; 63ae1cc083SKarsten Heimrich 64ae1cc083SKarsten Heimrich BMessage _ReadSettings() const; 65ae1cc083SKarsten Heimrich void _WriteSettings() const; 66ae1cc083SKarsten Heimrich 67a75264d3SKarsten Heimrich void _TakeScreenshot(); 68a75264d3SKarsten Heimrich status_t _GetActiveWindowFrame(BRect* frame); 698f1c6951SJonas Sundström void _MakeTabSpaceTransparent(BRect* frame); 70a75264d3SKarsten Heimrich 71bb6301b2SPhilippe Saint-Pierre status_t _SaveScreenshot(); 729f07ffa3SKarsten Heimrich 73f3d5fb86SPhilippe Saint-Pierre PreviewView* fPreview; 74a75264d3SKarsten Heimrich BRadioButton* fActiveWindow; 75a75264d3SKarsten Heimrich BRadioButton* fWholeDesktop; 76a75264d3SKarsten Heimrich BTextControl* fDelayControl; 77a75264d3SKarsten Heimrich BCheckBox* fWindowBorder; 78aeaeba65SJoachim Seemer BCheckBox* fShowMouse; 79a75264d3SKarsten Heimrich BButton* fBackToSave; 80a75264d3SKarsten Heimrich BButton* fTakeScreenshot; 810d84b313SStephan Aßmus BButton* fSaveScreenshot; 82a75264d3SKarsten Heimrich BTextControl* fNameControl; 83a75264d3SKarsten Heimrich BMenu* fTranslatorMenu; 84a75264d3SKarsten Heimrich BMenu* fOutputPathMenu; 85a75264d3SKarsten Heimrich BBitmap* fScreenshot; 86fc3bed05SKarsten Heimrich BFilePanel* fOutputPathPanel; 87fc3bed05SKarsten Heimrich BMenuItem* fLastSelectedPath; 88a75264d3SKarsten Heimrich 89a75264d3SKarsten Heimrich bigtime_t fDelay; 90b8fe3ff4SJonas Sundström float fTabHeight; 91a75264d3SKarsten Heimrich 92a75264d3SKarsten Heimrich bool fIncludeBorder; 93aeaeba65SJoachim Seemer bool fIncludeMouse; 94a75264d3SKarsten Heimrich bool fGrabActiveWindow; 95a75264d3SKarsten Heimrich bool fShowConfigWindow; 96689b99a7SFredrik Modeen bool fSaveScreenshotSilent; 97*362b036dSAxel Dörfler BString fOutputFilename; 986478aa27SPhilippe Saint-Pierre BString fExtension; 99a75264d3SKarsten Heimrich 100a75264d3SKarsten Heimrich int32 fTranslator; 101a75264d3SKarsten Heimrich int32 fImageFileType; 102a75264d3SKarsten Heimrich }; 103689b99a7SFredrik Modeen 104689b99a7SFredrik Modeen #endif /* SCREENSHOT_WINDOW_H */ 105