xref: /haiku/src/apps/tv/MainWin.h (revision 8130a01dbe1a2553a3bdd0f9018268c31ef2ba0c)
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 <Button.h>
29 #include <Catalog.h>
30 #include <Locale.h>
31 #include <Menu.h>
32 #include <Slider.h>
33 #include <Window.h>
34 
35 #include "Controller.h"
36 #include "VideoView.h"
37 
38 class MainWin : public BWindow
39 {
40 public:
41 						MainWin(BRect rect);
42 						~MainWin();
43 
44 	void				FrameResized(float new_width, float new_height);
45 	void				Zoom(BPoint rec_position, float rec_width, float rec_height);
46 	void				DispatchMessage(BMessage *message, BHandler *handler);
47 	void				MessageReceived(BMessage *msg);
48 	bool				QuitRequested();
49 
50 	void				MouseDown(BMessage *msg);
51 	void				MouseMoved(BMessage *msg);
52 	void				MouseUp(BMessage *msg);
53 	status_t			KeyDown(BMessage *msg);
54 
55 	void				CreateMenu();
56 
57 	void				SetupInterfaceMenu();
58 	void				SetupChannelMenu();
59 
60 	void				SelectInitialInterface();
61 
62 	void				SelectInterface(int i);
63 	void				SelectChannel(int i);
64 
65 	void				SetInterfaceMenuMarker();
66 	void				SetChannelMenuMarker();
67 
68 	void				VideoFormatChange(int width, int height, float width_scale, float height_scale);
69 
70 	void				UpdateWindowTitle();
71 
72 	void				AdjustFullscreenRenderer();
73 	void 				AdjustWindowedRenderer(bool user_resized);
74 
75 	void				ToggleFullscreen();
76 	void				ToggleKeepAspectRatio();
77 	void				ToggleAlwaysOnTop();
78 	void				ToggleNoBorder();
79 	void				ToggleNoMenu();
80 	void				ToggleNoBorderNoMenu();
81 
82 	void				ShowContextMenu(const BPoint &screen_point);
83 
84 	BMenuBar *			fMenuBar;
85 	BView *				fBackground;
86 	VideoView *			fVideoView;
87 
88 	BMenu *				fFileMenu;
89 	BMenu *				fChannelMenu;
90 	BMenu *				fInterfaceMenu;
91 	BMenu *				fSettingsMenu;
92 	BMenu *				fDebugMenu;
93 
94 	Controller *		fController;
95 	volatile bool		fIsFullscreen;
96 	volatile bool		fKeepAspectRatio;
97 	volatile bool		fAlwaysOnTop;
98 	volatile bool		fNoMenu;
99 	volatile bool		fNoBorder;
100 	int					fSourceWidth;
101 	int					fSourceHeight;
102 	float				fWidthScale;
103 	float				fHeightScale;
104 	int					fMenuBarHeight;
105 	BRect				fSavedFrame;
106 	bool				fMouseDownTracking;
107 	BPoint				fMouseDownMousePos;
108 	BPoint				fMouseDownWindowPos;
109 	bool				fFrameResizedTriggeredAutomatically;
110 	bool				fIgnoreFrameResized;
111 	bool				fFrameResizedCalled;
112 };
113 
114 #endif
115