xref: /haiku/src/apps/mediaplayer/VideoView.h (revision 25a7b01d15612846f332751841da3579db313082)
1 /*
2  * Copyright 2006-2010 Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT license.
4  */
5 #ifndef VIDEO_VIEW_H
6 #define VIDEO_VIEW_H
7 
8 
9 #include <View.h>
10 
11 #include "ListenerAdapter.h"
12 #include "VideoTarget.h"
13 
14 
15 enum {
16 	M_HIDE_FULL_SCREEN_CONTROLS = 'hfsc'
17 };
18 
19 
20 class SubtitleBitmap;
21 
22 
23 class VideoView : public BView, public VideoTarget {
24 public:
25 								VideoView(BRect frame, const char* name,
26 									uint32 resizeMask);
27 	virtual						~VideoView();
28 
29 	// BView interface
30 	virtual	void				Draw(BRect updateRect);
31 	virtual	void				MessageReceived(BMessage* message);
32 	virtual	void				Pulse();
33 	virtual	void				MouseMoved(BPoint where, uint32 transit,
34 									const BMessage* dragMessage = NULL);
35 
36 	// VideoTarget interface
37 	virtual	void				SetBitmap(const BBitmap* bitmap);
38 
39 	// VideoView
40 			void				GetOverlayScaleLimits(float* minScale,
41 									float* maxScale) const;
42 
43 			void				OverlayScreenshotPrepare();
44 			void				OverlayScreenshotCleanup();
45 
46 			bool				UseOverlays() const;
47 			bool				IsOverlayActive();
48 			void				DisableOverlay();
49 
50 			void				SetPlaying(bool playing);
51 			void				SetFullscreen(bool fullScreen);
52 			void				SetFullscreenControlsVisible(bool visible);
53 			void				SetVideoFrame(const BRect& frame);
54 
55 			void				SetSubTitle(const char* text);
56 			void				SetSubTitleMaxBottom(float bottom);
57 
58 private:
59 			void				_DrawBitmap(const BBitmap* bitmap);
60 			void				_DrawSubtitle();
61 			void				_AdoptGlobalSettings();
62 			void				_SetOverlayMode(bool overlayMode);
63 			void				_LayoutSubtitle();
64 
65 private:
66 			BRect				fVideoFrame;
67 			bool				fOverlayMode;
68 			overlay_restrictions fOverlayRestrictions;
69 			rgb_color			fOverlayKeyColor;
70 			bool				fIsPlaying;
71 			bool				fIsFullscreen;
72 			bool				fFullscreenControlsVisible;
73 			bool				fFirstPulseAfterFullscreen;
74 			uint8				fSendHideCounter;
75 			bigtime_t			fLastMouseMove;
76 
77 			SubtitleBitmap*		fSubtitleBitmap;
78 			BRect				fSubtitleFrame;
79 			float				fSubtitleMaxButtom;
80 			bool				fHasSubtitle;
81 			bool				fSubtitleChanged;
82 
83 			// Settings values:
84 			ListenerAdapter		fGlobalSettingsListener;
85 			bool				fUseOverlays;
86 			bool				fUseBilinearScaling;
87 			uint32				fSubtitlePlacement;
88 };
89 
90 #endif // VIDEO_VIEW_H
91