1 /*****************************************************************************
2 * MainWindow.h: MacOS X interface module
3 *****************************************************************************
4 * Copyright (C) 2002-2012 VLC authors and VideoLAN
7 * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
8 * Jon Lech Johansen <jon-vl@nanocrew.net>
9 * Christophe Massiot <massiot@via.ecp.fr>
10 * Derk-Jan Hartman <hartman at videolan.org>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 #import <Cocoa/Cocoa.h>
28 #import "CompatibilityFixes.h"
29 #import "PXSourceList.h"
33 #import "MainWindowTitle.h"
35 @interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
36 IBOutlet id o_play_btn;
37 IBOutlet id o_bwd_btn;
38 IBOutlet id o_fwd_btn;
39 IBOutlet id o_stop_btn;
40 IBOutlet id o_playlist_btn;
41 IBOutlet id o_repeat_btn;
42 IBOutlet id o_shuffle_btn;
43 IBOutlet id o_effects_btn;
44 IBOutlet id o_fullscreen_btn;
45 IBOutlet id o_search_fld;
46 IBOutlet id o_topbar_view;
47 IBOutlet id o_volume_sld;
48 IBOutlet id o_volume_track_view;
49 IBOutlet id o_volume_down_btn;
50 IBOutlet id o_volume_up_btn;
51 IBOutlet id o_time_sld;
52 IBOutlet id o_time_sld_fancygradient_view;
53 IBOutlet id o_time_fld;
54 IBOutlet id o_progress_bar;
55 IBOutlet id o_bottombar_view;
56 IBOutlet id o_time_sld_background;
57 IBOutlet id o_playlist_table;
58 IBOutlet id o_video_view;
59 IBOutlet id o_split_view;
60 IBOutlet id o_left_split_view;
61 IBOutlet id o_right_split_view;
62 IBOutlet id o_sidebar_view;
63 IBOutlet id o_sidebar_scrollview;
64 IBOutlet id o_chosen_category_lbl;
66 IBOutlet id o_dropzone_view;
67 IBOutlet id o_dropzone_btn;
68 IBOutlet id o_dropzone_lbl;
70 IBOutlet VLCFSPanel *o_fspanel;
71 IBOutlet id o_titlebar_view;
72 IBOutlet id o_resize_view;
73 IBOutlet id o_detached_resize_view;
75 IBOutlet id o_detached_play_btn;
76 IBOutlet id o_detached_fwd_btn;
77 IBOutlet id o_detached_bwd_btn;
78 IBOutlet id o_detached_fullscreen_btn;
79 IBOutlet id o_detached_time_fld;
80 IBOutlet id o_detached_time_sld;
81 IBOutlet id o_detached_time_sld_background;
82 IBOutlet id o_detached_progress_bar;
83 IBOutlet id o_detached_time_sld_fancygradient_view;
84 IBOutlet id o_detached_bottombar_view;
85 IBOutlet id o_detached_titlebar_view;
86 IBOutlet id o_detached_video_window;
88 BOOL b_dark_interface;
89 BOOL b_nativeFullscreenMode;
90 BOOL b_video_playback_enabled;
91 BOOL b_dropzone_active;
92 BOOL b_splitview_removed;
93 int i_lastSplitViewHeight;
94 int i_lastShownVolume;
95 input_state_e cachedInputState;
97 NSImage * o_pause_img;
98 NSImage * o_pause_pressed_img;
100 NSImage * o_play_pressed_img;
101 NSImage * o_repeat_img;
102 NSImage * o_repeat_pressed_img;
103 NSImage * o_repeat_all_img;
104 NSImage * o_repeat_all_pressed_img;
105 NSImage * o_repeat_one_img;
106 NSImage * o_repeat_one_pressed_img;
107 NSImage * o_shuffle_img;
108 NSImage * o_shuffle_pressed_img;
109 NSImage * o_shuffle_on_img;
110 NSImage * o_shuffle_on_pressed_img;
112 NSTimeInterval last_fwd_event;
113 NSTimeInterval last_bwd_event;
114 BOOL just_triggered_next;
115 BOOL just_triggered_previous;
116 NSMutableArray *o_sidebaritems;
120 VLCWindow * o_fullscreen_window;
121 NSViewAnimation * o_fullscreen_anim1;
122 NSViewAnimation * o_fullscreen_anim2;
123 NSViewAnimation * o_makekey_anim;
124 NSView * o_temp_view;
125 /* set to yes if we are fullscreen and all animations are over */
127 BOOL b_window_is_invisible;
128 NSRecursiveLock * o_animation_lock;
129 NSSize nativeVideoSize;
131 NSTimer *t_hide_mouse_timer;
133 VLCColorView * o_color_backdrop;
134 NSInteger i_originalLevel;
135 NSRect previousSavedFrame;
137 + (VLCMainWindow *)sharedInstance;
139 - (IBAction)play:(id)sender;
140 - (IBAction)bwd:(id)sender;
141 - (IBAction)fwd:(id)sender;
142 - (IBAction)stop:(id)sender;
143 - (IBAction)togglePlaylist:(id)sender;
144 - (IBAction)repeat:(id)sender;
145 - (IBAction)shuffle:(id)sender;
146 - (IBAction)timeSliderAction:(id)sender;
147 - (IBAction)volumeAction:(id)sender;
148 - (IBAction)effects:(id)sender;
149 - (IBAction)fullscreen:(id)sender;
150 - (IBAction)dropzoneButtonAction:(id)sender;
152 - (void)setTitle:(NSString *)title;
153 - (void) customZoom: (id)sender;
154 - (void)windowResizedOrMoved:(NSNotification *)notification;
156 - (void)showDropZone;
157 - (void)hideDropZone;
158 - (void)showSplitView;
159 - (void)hideSplitView;
160 - (void)updateTimeSlider;
161 - (void)updateVolumeSlider;
162 - (void)updateWindow;
166 - (void)setRepeatOne;
167 - (void)setRepeatAll;
168 - (void)setRepeatOff;
171 - (void)drawFancyGradientEffectForTimeSlider;
174 - (id)setupVideoView;
175 - (void)setVideoplayEnabled;
176 - (void)resizeWindow;
177 - (void)setNativeVideoSize:(NSSize)size;
179 - (void)hideMouseCursor:(NSTimer *)timer;
180 - (void)recreateHideMouseTimer;
182 /* fullscreen handling */
183 - (void)showFullscreenController;
184 - (BOOL)isFullscreen;
185 - (void)lockFullscreenAnimation;
186 - (void)unlockFullscreenAnimation;
187 - (void)enterFullscreen;
188 - (void)leaveFullscreen;
189 - (void)leaveFullscreenAndFadeOut: (BOOL)fadeout;
190 - (void)hasEndedFullscreen;
191 - (void)hasBecomeFullscreen;
193 /* lion's native fullscreen handling */
194 - (void)windowWillEnterFullScreen:(NSNotification *)notification;
195 - (void)windowWillExitFullScreen:(NSNotification *)notification;
199 @interface VLCDetachedVideoWindow : NSWindow
201 BOOL b_dark_interface;
202 NSRect previousSavedFrame;
205 - (BOOL)isFullscreen;