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