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