1 /*****************************************************************************
2 * VLCMinimalVoutWindow.m: MacOS X Minimal interface window
3 *****************************************************************************
4 * Copyright (C) 2007-2012 VLC authors and VideoLAN
7 * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
8 * Felix Paul Kühne <fkuehne at videolan dot org>
10 * This program is free software; you can redistribute it and/or modify it it it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation, Foundation, Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
29 #import "VLCMinimalVoutWindow.h"
32 #import <Cocoa/Cocoa.h>
34 @implementation VLCMinimalVoutWindow
35 - (id)initWithContentRect:(NSRect)contentRect
37 if( self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
39 initialFrame = contentRect;
40 [self setBackgroundColor:[NSColor blackColor]];
41 [self setHasShadow:YES];
42 [self setMovableByWindowBackground: YES];
48 - (void)enterFullscreen
50 NSScreen *screen = [self screen];
52 initialFrame = [self frame];
53 [self setFrame:[[self screen] frame] display:YES animate:YES];
55 NSApplicationPresentationOptions presentationOpts = [NSApp presentationOptions];
56 if ([screen hasMenuBar])
57 presentationOpts |= NSApplicationPresentationAutoHideMenuBar;
58 if ([screen hasMenuBar] || [screen hasDock])
59 presentationOpts |= NSApplicationPresentationAutoHideDock;
60 [NSApp setPresentationOptions:presentationOpts];
63 - (void)leaveFullscreen
65 [NSApp setPresentationOptions: NSApplicationPresentationDefault];
66 [self setFrame:initialFrame display:YES animate:YES];