]> git.sesse.net Git - vlc/blob - modules/gui/macosx/Windows.h
macosx: use custom animation for native fullscreen to continue video in animation
[vlc] / modules / gui / macosx / Windows.h
1 /*****************************************************************************
2  * Windows.h: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2012-2014 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
8  *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
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 General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #import <Cocoa/Cocoa.h>
26
27 /*****************************************************************************
28  * VLCWindow
29  *
30  *  Missing extension to NSWindow
31  *****************************************************************************/
32
33 @class VLCVoutView;
34
35 @interface VLCWindow : NSWindow <NSAnimationDelegate>
36 {
37     BOOL b_canBecomeKeyWindow;
38     BOOL b_isset_canBecomeKeyWindow;
39     BOOL b_canBecomeMainWindow;
40     BOOL b_isset_canBecomeMainWindow;
41     NSViewAnimation *o_current_animation;
42
43     BOOL              b_has_active_video;
44
45     /* 
46      * YES when all animations are over
47      * for fullscreen window: always YES
48      */
49     BOOL              b_fullscreen;
50 }
51 @property (readwrite) BOOL canBecomeKeyWindow;
52 @property (readwrite) BOOL canBecomeMainWindow;
53
54 @property (nonatomic, readwrite) BOOL hasActiveVideo;
55 @property (nonatomic, readwrite) BOOL fullscreen;
56
57 /* animate mode is only supported in >=10.4 */
58 - (void)orderFront: (id)sender animate: (BOOL)animate;
59
60 /* animate mode is only supported in >=10.4 */
61 - (void)orderOut: (id)sender animate: (BOOL)animate;
62
63 /* animate mode is only supported in >=10.4 */
64 - (void)orderOut: (id)sender animate: (BOOL)animate callback:(NSInvocation *)callback;
65
66 /* animate mode is only supported in >=10.4 */
67 - (void)closeAndAnimate: (BOOL)animate;
68
69 - (VLCVoutView *)videoView;
70
71 @end
72
73
74 static const float f_min_video_height = 70.0;
75
76 @class VLCControlsBarCommon;
77
78 /*****************************************************************************
79  * VLCVideoWindowCommon
80  *
81  *  Common code for main window, detached window and extra video window
82  *****************************************************************************/
83
84 @interface VLCVideoWindowCommon : VLCWindow <NSWindowDelegate, NSAnimationDelegate>
85 {
86     NSRect previousSavedFrame;
87     BOOL b_dark_interface;
88
89     IBOutlet id o_titlebar_view; // only set in main or detached window
90     IBOutlet VLCVoutView *o_video_view;
91
92     IBOutlet VLCControlsBarCommon *o_controls_bar;
93
94     NSSize nativeVideoSize;
95
96     // variables for fullscreen handling
97     VLCVideoWindowCommon *o_current_video_window;
98     VLCWindow       * o_fullscreen_window;
99     NSViewAnimation * o_fullscreen_anim1;
100     NSViewAnimation * o_fullscreen_anim2;
101     NSViewAnimation * o_makekey_anim;
102     NSView          * o_temp_view;
103
104     BOOL              b_window_is_invisible;
105     NSInteger i_originalLevel;
106
107     BOOL              b_video_view_was_hidden;
108
109     NSTimer *t_hide_mouse_timer;
110
111     // true when the window is in transition for entering or exiting fullscreen
112     BOOL b_in_fullscreen_transition;
113
114     NSRect frameBeforeLionFullscreen;
115 }
116
117 @property (nonatomic, assign) VLCVoutView* videoView;
118 @property (readonly) VLCControlsBarCommon* controlsBar;
119 @property (readonly) BOOL inFullscreenTransition;
120
121 - (void)setWindowLevel:(NSInteger)i_state;
122
123 - (void)resizeWindow;
124 - (void)setNativeVideoSize:(NSSize)size;
125 - (NSRect)getWindowRectForProposedVideoViewSize:(NSSize)size;
126
127
128 - (void)setTitle:(NSString *)title;
129
130 /* fullscreen handling */
131 - (void)enterFullscreen;
132 - (void)leaveFullscreen;
133
134 /* lion fullscreen handling */
135 - (void)windowWillEnterFullScreen:(NSNotification *)notification;
136 - (void)windowDidEnterFullScreen:(NSNotification *)notification;
137 - (void)windowWillExitFullScreen:(NSNotification *)notification;
138
139 @end