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"
30 #import "PXSourceListDataSource.h"
34 #import "MainWindowTitle.h"
36 @interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
37 IBOutlet id o_play_btn;
38 IBOutlet id o_bwd_btn;
39 IBOutlet id o_fwd_btn;
40 IBOutlet id o_stop_btn;
41 IBOutlet id o_playlist_btn;
42 IBOutlet id o_repeat_btn;
43 IBOutlet id o_shuffle_btn;
44 IBOutlet id o_effects_btn;
45 IBOutlet id o_fullscreen_btn;
46 IBOutlet id o_search_fld;
47 IBOutlet id o_topbar_view;
48 IBOutlet id o_volume_sld;
49 IBOutlet id o_volume_track_view;
50 IBOutlet id o_volume_down_btn;
51 IBOutlet id o_volume_up_btn;
52 IBOutlet id o_time_sld;
53 IBOutlet id o_time_sld_fancygradient_view;
54 IBOutlet id o_time_fld;
55 IBOutlet id o_progress_bar;
56 IBOutlet id o_bottombar_view;
57 IBOutlet id o_time_sld_background;
58 IBOutlet id o_playlist_table;
59 IBOutlet id o_video_view;
60 IBOutlet id o_split_view;
61 IBOutlet id o_left_split_view;
62 IBOutlet id o_right_split_view;
63 IBOutlet id o_sidebar_view;
64 IBOutlet id o_sidebar_scrollview;
65 IBOutlet id o_chosen_category_lbl;
67 IBOutlet id o_dropzone_view;
68 IBOutlet id o_dropzone_btn;
69 IBOutlet id o_dropzone_lbl;
70 IBOutlet id o_dropzone_box;
72 IBOutlet VLCFSPanel *o_fspanel;
73 IBOutlet id o_titlebar_view;
74 IBOutlet id o_resize_view;
75 IBOutlet id o_detached_resize_view;
77 IBOutlet id o_detached_play_btn;
78 IBOutlet id o_detached_fwd_btn;
79 IBOutlet id o_detached_bwd_btn;
80 IBOutlet id o_detached_fullscreen_btn;
81 IBOutlet id o_detached_time_fld;
82 IBOutlet id o_detached_time_sld;
83 IBOutlet id o_detached_time_sld_background;
84 IBOutlet id o_detached_progress_bar;
85 IBOutlet id o_detached_time_sld_fancygradient_view;
86 IBOutlet id o_detached_bottombar_view;
87 IBOutlet id o_detached_titlebar_view;
88 IBOutlet id o_detached_video_window;
90 BOOL b_dark_interface;
91 BOOL b_nativeFullscreenMode;
92 BOOL b_video_playback_enabled;
93 BOOL b_dropzone_active;
94 BOOL b_splitview_removed;
95 BOOL b_minimized_view;
97 BOOL b_show_jump_buttons;
98 BOOL b_show_playmode_buttons;
99 int i_lastSplitViewHeight;
100 input_state_e cachedInputState;
102 NSImage * o_pause_img;
103 NSImage * o_pause_pressed_img;
104 NSImage * o_play_img;
105 NSImage * o_play_pressed_img;
106 NSImage * o_repeat_img;
107 NSImage * o_repeat_pressed_img;
108 NSImage * o_repeat_all_img;
109 NSImage * o_repeat_all_pressed_img;
110 NSImage * o_repeat_one_img;
111 NSImage * o_repeat_one_pressed_img;
112 NSImage * o_shuffle_img;
113 NSImage * o_shuffle_pressed_img;
114 NSImage * o_shuffle_on_img;
115 NSImage * o_shuffle_on_pressed_img;
117 NSTimeInterval last_fwd_event;
118 NSTimeInterval last_bwd_event;
119 BOOL just_triggered_next;
120 BOOL just_triggered_previous;
121 NSButton * o_prev_btn;
122 NSButton * o_next_btn;
124 NSMutableArray *o_sidebaritems;
128 VLCWindow * o_fullscreen_window;
129 NSViewAnimation * o_fullscreen_anim1;
130 NSViewAnimation * o_fullscreen_anim2;
131 NSViewAnimation * o_makekey_anim;
132 NSView * o_temp_view;
133 /* set to yes if we are fullscreen and all animations are over */
135 BOOL b_window_is_invisible;
136 NSRecursiveLock * o_animation_lock;
137 NSSize nativeVideoSize;
139 NSTimer *t_hide_mouse_timer;
141 VLCColorView * o_color_backdrop;
142 NSInteger i_originalLevel;
143 NSRect previousSavedFrame;
145 + (VLCMainWindow *)sharedInstance;
147 - (IBAction)play:(id)sender;
148 - (IBAction)bwd:(id)sender;
149 - (IBAction)fwd:(id)sender;
150 - (IBAction)stop:(id)sender;
151 - (IBAction)togglePlaylist:(id)sender;
152 - (IBAction)repeat:(id)sender;
153 - (IBAction)shuffle:(id)sender;
154 - (IBAction)timeSliderAction:(id)sender;
155 - (IBAction)volumeAction:(id)sender;
156 - (IBAction)effects:(id)sender;
157 - (IBAction)fullscreen:(id)sender;
158 - (IBAction)dropzoneButtonAction:(id)sender;
160 - (void)setTitle:(NSString *)title;
161 - (void) customZoom:(id)sender;
162 - (void)windowResizedOrMoved:(NSNotification *)notification;
164 - (void)showDropZone;
165 - (void)hideDropZone;
166 - (void)showSplitView;
167 - (void)hideSplitView;
168 - (void)updateTimeSlider;
169 - (void)updateVolumeSlider;
170 - (void)updateWindow;
174 - (void)setRepeatOne;
175 - (void)setRepeatAll;
176 - (void)setRepeatOff;
178 - (void)toggleJumpButtons;
179 - (void)togglePlaymodeButtons;
181 - (void)drawFancyGradientEffectForTimeSlider;
184 - (id)setupVideoView;
185 - (void)setVideoplayEnabled;
186 - (void)resizeWindow;
187 - (void)setNativeVideoSize:(NSSize)size;
189 - (void)hideMouseCursor:(NSTimer *)timer;
190 - (void)recreateHideMouseTimer;
192 /* fullscreen handling */
193 - (void)showFullscreenController;
194 - (BOOL)isFullscreen;
195 - (void)lockFullscreenAnimation;
196 - (void)unlockFullscreenAnimation;
197 - (void)enterFullscreen;
198 - (void)leaveFullscreen;
199 - (void)leaveFullscreenAndFadeOut: (BOOL)fadeout;
200 - (void)hasEndedFullscreen;
201 - (void)hasBecomeFullscreen;
203 /* lion's native fullscreen handling */
204 - (void)windowWillEnterFullScreen:(NSNotification *)notification;
205 - (void)windowDidEnterFullScreen:(NSNotification *)notification;
206 - (void)windowWillExitFullScreen:(NSNotification *)notification;
208 - (id)detachedTitlebarView;
211 @interface VLCDetachedVideoWindow : NSWindow
213 BOOL b_dark_interface;
215 NSRect previousSavedFrame;
218 - (BOOL)isFullscreen;
219 - (void)customZoom:(id)sender;