]> git.sesse.net Git - vlc/blob - modules/gui/minimal_macosx/VLCMinimalVoutWindow.m
gui/*macosx: Don't rely on carbon or on old non 64 bits API when possible.
[vlc] / modules / gui / minimal_macosx / VLCMinimalVoutWindow.m
1 /*****************************************************************************
2  * VLCMinimalVoutWindow.m: MacOS X Minimal interface window
3  *****************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include "intf.h"
28 #include "voutgl.h"
29 #include "VLCOpenGLVoutView.h"
30 #include "VLCMinimalVoutWindow.h"
31
32 #import <Cocoa/Cocoa.h>
33
34 @implementation VLCMinimalVoutWindow
35 - (id)initWithContentRect:(NSRect)contentRect
36 {
37     if( self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
38     {
39         initialFrame = contentRect;
40         fullscreen = NO;
41         [self setBackgroundColor:[NSColor blackColor]];
42         [self setHasShadow:YES];
43         [self setMovableByWindowBackground: YES];
44         [self center];
45     }
46     return self;
47 }
48
49 /* @protocol VLCOpenGLVoutEmbedding */
50 - (void)addVoutSubview:(NSView *)view
51 {
52     [view setAutoresizingMask:NSViewHeightSizable|NSViewWidthSizable];
53     [[self contentView] addSubview:view];
54     [view setFrame:[[self contentView] bounds]];
55 }
56
57 - (void)removeVoutSubview:(NSView *)view
58 {
59     [self close];
60     [self release];
61 }
62
63 - (void)enterFullscreen
64 {
65     fullscreen = YES;
66     initialFrame = [self frame];
67     [NSMenu setMenuBarVisible:NO];
68     [self setFrame:[[self screen] frame] display:YES animate:YES];
69 }
70
71 - (void)leaveFullscreen
72 {
73     fullscreen = NO;
74     [NSMenu setMenuBarVisible:YES];
75     [self setFrame:initialFrame display:YES animate:YES];
76 }
77
78 - (BOOL)stretchesVideo
79 {
80     return NO;
81 }
82
83 - (void)setOnTop: (BOOL)ontop
84 {
85
86 }
87 @end
88