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, 40689b99a7SFredrik Modeen int32 translator = 8); 41a75264d3SKarsten Heimrich virtual ~ScreenshotWindow(); 42a75264d3SKarsten Heimrich 43a75264d3SKarsten Heimrich virtual void MessageReceived(BMessage* message); 44a75264d3SKarsten Heimrich 45a75264d3SKarsten Heimrich private: 46a75264d3SKarsten Heimrich void _InitWindow(); 47689b99a7SFredrik Modeen BPath _GetDirectory(); 48a75264d3SKarsten Heimrich void _SetupFirstLayoutItem(BCardLayout* layout); 49a75264d3SKarsten Heimrich void _SetupSecondLayoutItem(BCardLayout* layout); 50a75264d3SKarsten Heimrich void _DisallowChar(BTextView* textView); 51ae1cc083SKarsten Heimrich void _SetupTranslatorMenu(BMenu* translatorMenu, 52ae1cc083SKarsten Heimrich const BMessage& settings); 53ae1cc083SKarsten Heimrich void _SetupOutputPathMenu(BMenu* outputPathMenu, 54ae1cc083SKarsten Heimrich const BMessage& settings); 55ae1cc083SKarsten Heimrich void _AddItemToPathMenu(const char* path, 56ae1cc083SKarsten Heimrich BString& label, int32 index, bool markItem); 57a75264d3SKarsten Heimrich 58ae1cc083SKarsten Heimrich void _UpdatePreviewPanel(); 59*a9591c50SFredrik Modeen BString _FindValidFileName(const char* name); 60ae1cc083SKarsten Heimrich int32 _PathIndexInMenu(const BString& path) const; 61ae1cc083SKarsten Heimrich 62ae1cc083SKarsten Heimrich BMessage _ReadSettings() const; 63ae1cc083SKarsten Heimrich void _WriteSettings() const; 64ae1cc083SKarsten Heimrich 65a75264d3SKarsten Heimrich void _TakeScreenshot(); 66a75264d3SKarsten Heimrich status_t _GetActiveWindowFrame(BRect* frame); 678f1c6951SJonas Sundström void _MakeTabSpaceTransparent(BRect* frame); 68a75264d3SKarsten Heimrich 69bb6301b2SPhilippe Saint-Pierre status_t _SaveScreenshot(); 709f07ffa3SKarsten Heimrich 71f3d5fb86SPhilippe Saint-Pierre PreviewView* fPreview; 72a75264d3SKarsten Heimrich BRadioButton* fActiveWindow; 73a75264d3SKarsten Heimrich BRadioButton* fWholeDesktop; 74a75264d3SKarsten Heimrich BTextControl* fDelayControl; 75a75264d3SKarsten Heimrich BCheckBox* fWindowBorder; 76aeaeba65SJoachim Seemer BCheckBox* fShowMouse; 77a75264d3SKarsten Heimrich BButton* fBackToSave; 78a75264d3SKarsten Heimrich BButton* fTakeScreenshot; 79a75264d3SKarsten Heimrich BTextControl* fNameControl; 80a75264d3SKarsten Heimrich BMenu* fTranslatorMenu; 81a75264d3SKarsten Heimrich BMenu* fOutputPathMenu; 82a75264d3SKarsten Heimrich BBitmap* fScreenshot; 83fc3bed05SKarsten Heimrich BFilePanel* fOutputPathPanel; 84fc3bed05SKarsten Heimrich BMenuItem* fLastSelectedPath; 85a75264d3SKarsten Heimrich 86a75264d3SKarsten Heimrich bigtime_t fDelay; 87b8fe3ff4SJonas Sundström float fTabHeight; 88a75264d3SKarsten Heimrich 89a75264d3SKarsten Heimrich bool fIncludeBorder; 90aeaeba65SJoachim Seemer bool fIncludeMouse; 91a75264d3SKarsten Heimrich bool fGrabActiveWindow; 92a75264d3SKarsten Heimrich bool fShowConfigWindow; 93689b99a7SFredrik Modeen bool fSaveScreenshotSilent; 946478aa27SPhilippe Saint-Pierre BString fExtension; 95a75264d3SKarsten Heimrich 96a75264d3SKarsten Heimrich int32 fTranslator; 97a75264d3SKarsten Heimrich int32 fImageFileType; 98a75264d3SKarsten Heimrich }; 99689b99a7SFredrik Modeen 100689b99a7SFredrik Modeen #endif /* SCREENSHOT_WINDOW_H */ 101