xref: /haiku/src/apps/tv/MainWin.h (revision d4161a35c7714e0189910d31d0a9cee9dff581ab)
1*d4161a35SMarcus Overhagen /*
2*d4161a35SMarcus Overhagen  * Copyright (c) 2004-2007 Marcus Overhagen <marcus@overhagen.de>
3*d4161a35SMarcus Overhagen  *
4*d4161a35SMarcus Overhagen  * Permission is hereby granted, free of charge, to any person
5*d4161a35SMarcus Overhagen  * obtaining a copy of this software and associated documentation
6*d4161a35SMarcus Overhagen  * files (the "Software"), to deal in the Software without restriction,
7*d4161a35SMarcus Overhagen  * including without limitation the rights to use, copy, modify,
8*d4161a35SMarcus Overhagen  * merge, publish, distribute, sublicense, and/or sell copies of
9*d4161a35SMarcus Overhagen  * the Software, and to permit persons to whom the Software is
10*d4161a35SMarcus Overhagen  * furnished to do so, subject to the following conditions:
11*d4161a35SMarcus Overhagen  *
12*d4161a35SMarcus Overhagen  * The above copyright notice and this permission notice shall be
13*d4161a35SMarcus Overhagen  * included in all copies or substantial portions of the Software.
14*d4161a35SMarcus Overhagen  *
15*d4161a35SMarcus Overhagen  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16*d4161a35SMarcus Overhagen  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17*d4161a35SMarcus Overhagen  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18*d4161a35SMarcus Overhagen  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19*d4161a35SMarcus Overhagen  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20*d4161a35SMarcus Overhagen  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21*d4161a35SMarcus Overhagen  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22*d4161a35SMarcus Overhagen  * OTHER DEALINGS IN THE SOFTWARE.
23*d4161a35SMarcus Overhagen  */
24*d4161a35SMarcus Overhagen 
25*d4161a35SMarcus Overhagen #ifndef __MAIN_WIN_H
26*d4161a35SMarcus Overhagen #define __MAIN_WIN_H
27*d4161a35SMarcus Overhagen 
28*d4161a35SMarcus Overhagen #include <Window.h>
29*d4161a35SMarcus Overhagen #include <Menu.h>
30*d4161a35SMarcus Overhagen #include <Button.h>
31*d4161a35SMarcus Overhagen #include <Slider.h>
32*d4161a35SMarcus Overhagen #include "Controller.h"
33*d4161a35SMarcus Overhagen #include "VideoView.h"
34*d4161a35SMarcus Overhagen 
35*d4161a35SMarcus Overhagen class MainWin : public BWindow
36*d4161a35SMarcus Overhagen {
37*d4161a35SMarcus Overhagen public:
38*d4161a35SMarcus Overhagen 						MainWin(BRect rect);
39*d4161a35SMarcus Overhagen 						~MainWin();
40*d4161a35SMarcus Overhagen 
41*d4161a35SMarcus Overhagen 	void				FrameResized(float new_width, float new_height);
42*d4161a35SMarcus Overhagen 	void				Zoom(BPoint rec_position, float rec_width, float rec_height);
43*d4161a35SMarcus Overhagen 	void				DispatchMessage(BMessage *message, BHandler *handler);
44*d4161a35SMarcus Overhagen 	void				MessageReceived(BMessage *msg);
45*d4161a35SMarcus Overhagen 	bool				QuitRequested();
46*d4161a35SMarcus Overhagen 
47*d4161a35SMarcus Overhagen 	void				MouseDown(BMessage *msg);
48*d4161a35SMarcus Overhagen 	void				MouseMoved(BMessage *msg);
49*d4161a35SMarcus Overhagen 	void				MouseUp(BMessage *msg);
50*d4161a35SMarcus Overhagen 	status_t			KeyDown(BMessage *msg);
51*d4161a35SMarcus Overhagen 
52*d4161a35SMarcus Overhagen 	void				CreateMenu();
53*d4161a35SMarcus Overhagen 
54*d4161a35SMarcus Overhagen 	void				SetupInterfaceMenu();
55*d4161a35SMarcus Overhagen 	void				SetupChannelMenu();
56*d4161a35SMarcus Overhagen 
57*d4161a35SMarcus Overhagen 	void				SelectInitialInterface();
58*d4161a35SMarcus Overhagen 
59*d4161a35SMarcus Overhagen 	void				SelectInterface(int i);
60*d4161a35SMarcus Overhagen 	void				SelectChannel(int i);
61*d4161a35SMarcus Overhagen 
62*d4161a35SMarcus Overhagen 	void				SetInterfaceMenuMarker();
63*d4161a35SMarcus Overhagen 	void				SetChannelMenuMarker();
64*d4161a35SMarcus Overhagen 
65*d4161a35SMarcus Overhagen 	void				VideoFormatChange(int width, int height, float width_scale, float height_scale);
66*d4161a35SMarcus Overhagen 
67*d4161a35SMarcus Overhagen 	void				UpdateWindowTitle();
68*d4161a35SMarcus Overhagen 
69*d4161a35SMarcus Overhagen 	void				AdjustFullscreenRenderer();
70*d4161a35SMarcus Overhagen 	void 				AdjustWindowedRenderer(bool user_resized);
71*d4161a35SMarcus Overhagen 
72*d4161a35SMarcus Overhagen 	void				ToggleFullscreen();
73*d4161a35SMarcus Overhagen 	void				ToggleKeepAspectRatio();
74*d4161a35SMarcus Overhagen 	void				ToggleAlwaysOnTop();
75*d4161a35SMarcus Overhagen 	void				ToggleNoBorder();
76*d4161a35SMarcus Overhagen 	void				ToggleNoMenu();
77*d4161a35SMarcus Overhagen 	void				ToggleNoBorderNoMenu();
78*d4161a35SMarcus Overhagen 
79*d4161a35SMarcus Overhagen 	void				ShowContextMenu(const BPoint &screen_point);
80*d4161a35SMarcus Overhagen 
81*d4161a35SMarcus Overhagen 	BMenuBar *			fMenuBar;
82*d4161a35SMarcus Overhagen 	BView *				fBackground;
83*d4161a35SMarcus Overhagen 	VideoView *			fVideoView;
84*d4161a35SMarcus Overhagen 
85*d4161a35SMarcus Overhagen 	BMenu *				fFileMenu;
86*d4161a35SMarcus Overhagen 	BMenu *				fChannelMenu;
87*d4161a35SMarcus Overhagen 	BMenu *				fInterfaceMenu;
88*d4161a35SMarcus Overhagen 	BMenu *				fSettingsMenu;
89*d4161a35SMarcus Overhagen 	BMenu *				fDebugMenu;
90*d4161a35SMarcus Overhagen 
91*d4161a35SMarcus Overhagen 	Controller *		fController;
92*d4161a35SMarcus Overhagen 	volatile bool		fIsFullscreen;
93*d4161a35SMarcus Overhagen 	volatile bool		fKeepAspectRatio;
94*d4161a35SMarcus Overhagen 	volatile bool		fAlwaysOnTop;
95*d4161a35SMarcus Overhagen 	volatile bool		fNoMenu;
96*d4161a35SMarcus Overhagen 	volatile bool		fNoBorder;
97*d4161a35SMarcus Overhagen 	int					fSourceWidth;
98*d4161a35SMarcus Overhagen 	int					fSourceHeight;
99*d4161a35SMarcus Overhagen 	float				fWidthScale;
100*d4161a35SMarcus Overhagen 	float				fHeightScale;
101*d4161a35SMarcus Overhagen 	int					fMenuBarHeight;
102*d4161a35SMarcus Overhagen 	BRect				fSavedFrame;
103*d4161a35SMarcus Overhagen 	bool				fMouseDownTracking;
104*d4161a35SMarcus Overhagen 	BPoint				fMouseDownMousePos;
105*d4161a35SMarcus Overhagen 	BPoint				fMouseDownWindowPos;
106*d4161a35SMarcus Overhagen 	bool				fFrameResizedTriggeredAutomatically;
107*d4161a35SMarcus Overhagen 	bool				fIgnoreFrameResized;
108*d4161a35SMarcus Overhagen 	bool				fFrameResizedCalled;
109*d4161a35SMarcus Overhagen };
110*d4161a35SMarcus Overhagen 
111*d4161a35SMarcus Overhagen #endif
112