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 79 void ShowContextMenu(const BPoint &screen_point); 80 81 BMenuBar * fMenuBar; 82 BView * fBackground; 83 VideoView * fVideoView; 84 85 BMenu * fFileMenu; 86 BMenu * fChannelMenu; 87 BMenu * fInterfaceMenu; 88 BMenu * fSettingsMenu; 89 BMenu * fDebugMenu; 90 91 Controller * fController; 92 volatile bool fIsFullscreen; 93 volatile bool fKeepAspectRatio; 94 volatile bool fAlwaysOnTop; 95 volatile bool fNoMenu; 96 volatile bool fNoBorder; 97 int fSourceWidth; 98 int fSourceHeight; 99 float fWidthScale; 100 float fHeightScale; 101 int fMenuBarHeight; 102 BRect fSavedFrame; 103 bool fMouseDownTracking; 104 BPoint fMouseDownMousePos; 105 BPoint fMouseDownWindowPos; 106 bool fFrameResizedTriggeredAutomatically; 107 bool fIgnoreFrameResized; 108 bool fFrameResizedCalled; 109 }; 110 111 #endif 112