]> git.sesse.net Git - vlc/blob - modules/gui/macosx/intf.h
ceb9b9c7934821b9499a968aa3c0b7782ed8c2f1
[vlc] / modules / gui / macosx / intf.h
1 /*****************************************************************************
2  * intf.h: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2012 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Derk-Jan Hartman <hartman at videolan dot org>
10  *          Felix Paul Kühne <fkuehne at videolan dot org>
11  *
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.
16  *
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.
21  *
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  *****************************************************************************/
26
27 #ifdef HAVE_CONFIG_H
28 #   include "config.h"
29 #endif
30
31 #import <vlc_common.h>
32 #import <vlc_interface.h>
33 #import <vlc_playlist.h>
34 #import <vlc_vout.h>
35 #import <vlc_aout.h>
36 #import <vlc_input.h>
37 #import <vlc_vout_window.h>
38
39 #import <Cocoa/Cocoa.h>
40 #import "CompatibilityFixes.h"
41 #import "SPMediaKeyTap.h"                   /* for the media key support */
42 #import "misc.h"
43 #import "MainWindow.h"
44 #import "StringUtility.h"
45
46 #import <IOKit/pwr_mgt/IOPMLib.h>           /* for sleep prevention */
47
48 /*****************************************************************************
49  * Local prototypes.
50  *****************************************************************************/
51 #define VLCIntf [[VLCMain sharedInstance] intf]
52
53 // You need to release those objects after use
54 input_thread_t *getInput(void);
55 vout_thread_t *getVout(void);
56 audio_output_t *getAout(void);
57
58 /*****************************************************************************
59  * intf_sys_t: description and status of the interface
60  *****************************************************************************/
61 struct intf_sys_t
62 {
63     /* menus handlers */
64     bool b_input_update;
65     bool b_aout_update;
66     bool b_vout_update;
67
68     /* The messages window */
69     msg_subscription_t sub;
70 };
71
72 /*****************************************************************************
73  * VLCMain interface
74  *****************************************************************************/
75 @class AppleRemote;
76 @class VLCInformation;
77 @class VLCEmbeddedWindow;
78 @class VLCControls;
79 @class VLCPlaylist;
80 @class VLCVoutWindowController;
81
82 @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
83 {
84     intf_thread_t *p_intf;      /* The main intf object */
85     input_thread_t *p_current_input;
86     id o_mainmenu;              /* VLCMainMenu */
87     id o_prefs;                 /* VLCPrefs       */
88     id o_sprefs;                /* VLCSimplePrefs */
89     id o_open;                  /* VLCOpen        */
90     id o_wizard;                /* VLCWizard      */
91     id o_coredialogs;           /* VLCCoreDialogProvider */
92     id o_info;                  /* VLCInformation */
93     id o_eyetv;                 /* VLCEyeTVController */
94     id o_bookmarks;             /* VLCBookmarks */
95     id o_coreinteraction;       /* VLCCoreInteraction */
96     BOOL nib_main_loaded;       /* main nibfile */
97     BOOL nib_open_loaded;       /* open nibfile */
98     BOOL nib_about_loaded;      /* about nibfile */
99     BOOL nib_wizard_loaded;     /* wizard nibfile */
100     BOOL nib_prefs_loaded;      /* preferences nibfile */
101     BOOL nib_info_loaded;       /* information panel nibfile */
102     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
103     BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
104     BOOL b_active_videoplayback;
105     BOOL b_nativeFullscreenMode;
106
107     VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
108
109     IBOutlet VLCControls * o_controls;     /* VLCControls    */
110     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
111
112     /* messages panel */
113     IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
114     NSMutableArray * o_msg_arr;                 /* messages array */
115     NSLock * o_msg_lock;                        /* messages lock */
116     BOOL b_msg_arr_changed;                     /* did the array change? */
117     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
118     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
119     IBOutlet NSButton * o_msgs_refresh_btn;     /* update the panel */
120     IBOutlet id o_msgs_table;
121
122     /* CrashReporter panel */
123     IBOutlet NSButton * o_crashrep_dontSend_btn;
124     IBOutlet NSButton * o_crashrep_send_btn;
125     IBOutlet NSTextView * o_crashrep_fld;
126     IBOutlet NSTextField * o_crashrep_title_txt;
127     IBOutlet NSTextField * o_crashrep_desc_txt;
128     IBOutlet NSWindow * o_crashrep_win;
129     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
130     IBOutlet NSButton * o_crashrep_dontaskagain_ckb;
131     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
132     NSURLConnection * crashLogURLConnection;
133
134     AppleRemote * o_remote;
135     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
136
137     /* media key support */
138     BOOL b_mediaKeySupport;
139     BOOL b_mediakeyJustJumped;
140     SPMediaKeyTap * o_mediaKeyController;
141
142     NSArray *o_usedHotkeys;
143
144     /* sleep management */
145     IOPMAssertionID systemSleepAssertionID;
146
147     VLCVoutWindowController *o_vout_controller;
148 }
149
150 @property (readonly) VLCVoutWindowController* voutController;
151
152 + (VLCMain *)sharedInstance;
153
154 - (intf_thread_t *)intf;
155 - (void)setIntf:(intf_thread_t *)p_mainintf;
156
157 - (id)mainMenu;
158 - (VLCMainWindow *)mainWindow;
159 - (id)controls;
160 - (id)bookmarks;
161 - (id)open;
162 - (id)simplePreferences;
163 - (id)preferences;
164 - (id)playlist;
165 - (id)info;
166 - (id)wizard;
167 - (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height forWindow:(vout_window_t *)p_wnd;
168 - (id)coreDialogProvider;
169 - (id)eyeTVController;
170 - (id)appleRemoteController;
171 - (void)setActiveVideoPlayback:(BOOL)b_value;
172 - (BOOL)activeVideoPlayback;
173 - (void)applicationWillTerminate:(NSNotification *)notification;
174 - (void)updateCurrentlyUsedHotkeys;
175 - (void)fullscreenChanged;
176 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
177 - (void)checkFullscreenChange:(NSNumber *)o_full;
178 - (void)PlaylistItemChanged;
179 - (void)playbackStatusUpdated;
180 - (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
181 - (void)playbackModeUpdated;
182 - (void)updateVolume;
183 - (void)updatePlaybackPosition;
184 - (void)updateName;
185 - (void)playlistUpdated;
186 - (void)updateRecordState: (BOOL)b_value;
187 - (void)updateInfoandMetaPanel;
188 - (void)updateMainMenu;
189 - (void)updateMainWindow;
190 - (void)showMainWindow;
191 - (void)showFullscreenController;
192 - (void)updateDelays;
193 - (void)initStrings;
194
195 - (IBAction)crashReporterAction:(id)sender;
196 - (IBAction)openCrashLog:(id)sender;
197 - (IBAction)saveDebugLog:(id)sender;
198 - (IBAction)showMessagesPanel:(id)sender;
199 - (IBAction)updateMessagesPanel:(id)sender;
200
201 - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
202
203 - (void)updateTogglePlaylistState;
204
205 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
206
207 - (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
208 @end
209
210 @interface VLCMain (Internal)
211 - (void)handlePortMessage:(NSPortMessage *)o_msg;
212 - (void)resetMediaKeyJump;
213 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
214 @end
215
216 /*****************************************************************************
217  * VLCApplication interface
218  *****************************************************************************/
219
220 @interface VLCApplication : NSApplication
221
222 @end