xref: /haiku/src/apps/screenshot/Utility.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2010-2014, Haiku Inc. All rights reserved.
3  * Copyright 2010 Wim van der Meer <WPJvanderMeer@gmail.com>
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef UTILITY_H
7 #define UTILITY_H
8 
9 
10 #include <Point.h>
11 #include <Rect.h>
12 #include <String.h>
13 #include <TranslatorRoster.h>
14 
15 
16 // Command constant for sending utility data to the GUI app
17 const int32 SS_UTILITY_DATA = 'SSUD';
18 
19 
20 class Utility {
21 public:
22 						Utility();
23 						~Utility();
24 
25 			void		CopyToClipboard(const BBitmap& screenshot) const;
26 			status_t	Save(BBitmap* screenshot, const char* fileName,
27 							uint32 imageType) const;
28 			BBitmap*	MakeScreenshot(bool includeCursor, bool activeWindow,
29 							bool includeBorder) const;
30 			BString		FileNameExtension(uint32 imageType) const;
31 			status_t	FindTranslator(uint32 imageType, translator_id& id,
32 							BString* _mimeType = NULL) const;
33 
34 			BBitmap*	wholeScreen;
35 			BBitmap*	cursorBitmap;
36 			BBitmap*	cursorAreaBitmap;
37 			BPoint		cursorPosition;
38 			BRect		activeWindowFrame;
39 			BRect		tabFrame;
40 			float		borderSize;
41 
42 	static	const char*	sDefaultFileNameBase;
43 
44 private:
45 			void		_MakeTabSpaceTransparent(BBitmap* screenshot,
46 							BRect frame) const;
47 			BString		_MimeType(uint32 imageType) const;
48 };
49 
50 
51 #endif // UTILITY_H
52