xref: /haiku/src/apps/mediaplayer/MainWin.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * MainWin.h - Media Player for the Haiku Operating System
3  *
4  * Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  *
19  */
20 #ifndef __MAIN_WIN_H
21 #define __MAIN_WIN_H
22 
23 #include <Window.h>
24 #include <Menu.h>
25 #include <Button.h>
26 #include <Slider.h>
27 #include <FilePanel.h>
28 #include "Controller.h"
29 #include "ControllerView.h"
30 #include "VideoView.h"
31 #include "Player.h"
32 #include "Playlist.h"
33 
34 class MainWin : public BWindow, public Player
35 {
36 public:
37 						MainWin();
38 						~MainWin();
39 
40 	void				FrameResized(float new_width, float new_height);
41 	void				Zoom(BPoint rec_position, float rec_width, float rec_height);
42 	void				RefsReceived(BMessage *msg);
43 	void				DispatchMessage(BMessage *message, BHandler *handler);
44 	void				MessageReceived(BMessage *msg);
45 	bool				QuitRequested();
46 
47 	void				MouseDown(BMessage *msg);
48 	void				MouseMoved(BMessage *msg);
49 	void				MouseUp(BMessage *msg);
50 	status_t			KeyDown(BMessage *msg);
51 
52 	void				CreateMenu();
53 	void				SetupWindow();
54 	void				SetupTrackMenus();
55 	void				SetWindowSizeLimits();
56 	void				ResizeWindow(int percent);
57 	void				ResizeVideoView(int x, int y, int width, int height);
58 
59 	void				ShowFileInfo();
60 
61 						// from Player
62 	void				OpenFile(const entry_ref &ref);
63 
64 	void				VideoFormatChange(int width, int height, float width_scale, float height_scale);
65 
66 	void				ToggleFullscreen();
67 	void				ToggleKeepAspectRatio();
68 	void				ToggleAlwaysOnTop();
69 	void				ToggleNoBorder();
70 	void				ToggleNoMenu();
71 	void				ToggleNoControls();
72 	void				ToggleNoBorderNoMenu();
73 
74 	void				ShowContextMenu(const BPoint &screen_point);
75 
76 	BMenuBar *			fMenuBar;
77 	BView *				fBackground;
78 	VideoView *			fVideoView;
79 	BFilePanel *		fFilePanel;
80 	ControllerView *	fControls;
81 
82 	BMenu *				fFileMenu;
83 	BMenu *				fViewMenu;
84 	BMenu *				fAudioMenu;
85 	BMenu *				fVideoMenu;
86 	BMenu *				fSettingsMenu;
87 	BMenu *				fDebugMenu;
88 
89 	bool				fHasFile;
90 	bool				fHasVideo;
91 
92 	Playlist *			fPlaylist;
93 	Controller *		fController;
94 	volatile bool		fIsFullscreen;
95 	volatile bool		fKeepAspectRatio;
96 	volatile bool		fAlwaysOnTop;
97 	volatile bool		fNoMenu;
98 	volatile bool		fNoBorder;
99 	volatile bool		fNoControls;
100 	int					fSourceWidth;
101 	int					fSourceHeight;
102 	float				fWidthScale;
103 	float				fHeightScale;
104 	int					fMenuBarHeight;
105 	int					fControlsHeight;
106 	int					fControlsWidth;
107 	BRect				fSavedFrame;
108 	bool				fMouseDownTracking;
109 	BPoint				fMouseDownMousePos;
110 	BPoint				fMouseDownWindowPos;
111 };
112 
113 #endif
114