1 /*****************************************************************************
2 * misc.h: code not specific to vlc
3 *****************************************************************************
4 * Copyright (C) 2003-2014 VLC authors and VideoLAN
7 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8 * Felix Paul Kühne <fkuehne at videolan dot org>
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.
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.
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 *****************************************************************************/
25 #import <Cocoa/Cocoa.h>
27 /*****************************************************************************
28 * NSSound (VLCAdditions)
30 * added code to change the system volume, needed for the apple remote code
31 * this is simplified code, which won't let you set the exact volume
32 * (that's what the audio output is for after all), but just the system volume
33 * in steps of 1/16 (matching the default AR or volume key implementation).
34 *****************************************************************************/
36 @interface NSSound (VLCAdditions)
37 + (float)systemVolumeForChannel:(int)channel;
38 + (bool)setSystemVolume:(float)volume forChannel:(int)channel;
39 + (void)increaseSystemVolume;
40 + (void)decreaseSystemVolume;
43 /*****************************************************************************
44 * NSAnimation (VLCAddition)
45 *****************************************************************************/
47 @interface NSAnimation (VLCAdditions)
48 @property (readwrite) void * userInfo;
52 /*****************************************************************************
53 * NSScreen (VLCAdditions)
55 * Missing extension to NSScreen
56 *****************************************************************************/
58 @interface NSScreen (VLCAdditions)
60 + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID;
63 - (BOOL)isScreen: (NSScreen*)screen;
64 - (CGDirectDisplayID)displayID;
65 - (void)blackoutOtherScreens;
66 + (void)unblackoutScreens;
68 - (void)setFullscreenPresentationOptions;
69 - (void)setNonFullscreenPresentationOptions;
72 /*****************************************************************************
75 * Disables default drag / drop behaviour of an NSImageView.
76 * set it for all sub image views withing an VLCDragDropView.
77 *****************************************************************************/
80 @interface VLCDropDisabledImageView : NSImageView
84 /*****************************************************************************
86 *****************************************************************************/
88 @interface VLCDragDropView : NSView
90 bool b_activeDragAndDrop;
95 @property (nonatomic, assign) id dropHandler;
96 @property (nonatomic, assign) BOOL drawBorder;
99 - (void)enablePlaylistItems;
104 /*****************************************************************************
106 *****************************************************************************/
108 @interface MPSlider : NSSlider
112 /*****************************************************************************
114 *****************************************************************************/
116 @interface VLCProgressView : NSView
118 - (void)scrollWheel:(NSEvent *)o_event;
123 /*****************************************************************************
125 *****************************************************************************/
127 @interface TimeLineSlider : NSSlider
133 @property (readonly) CGFloat knobPosition;
135 - (void)drawRect:(NSRect)rect;
136 - (void)drawKnobInRect:(NSRect)knobRect;
140 /*****************************************************************************
141 * VLCVolumeSliderCommon
142 *****************************************************************************/
144 @interface VLCVolumeSliderCommon : NSSlider
146 BOOL _usesBrightArtwork;
148 @property (readwrite, nonatomic) BOOL usesBrightArtwork;
150 - (void)scrollWheel:(NSEvent *)o_event;
151 - (void)drawFullVolumeMarker;
153 - (CGFloat)fullVolumePos;
157 @interface VolumeSliderCell : NSSliderCell
160 /*****************************************************************************
162 *****************************************************************************/
164 @interface ITSlider : VLCVolumeSliderCommon
170 - (void)drawRect:(NSRect)rect;
171 - (void)drawKnobInRect:(NSRect)knobRect;
175 /*****************************************************************************
176 * VLCTimeField interface
177 *****************************************************************************
178 * we need the implementation to catch our click-event in the controller window
179 *****************************************************************************/
181 @interface VLCTimeField : NSTextField
183 NSShadow * o_string_shadow;
184 NSTextAlignment textAlignment;
186 NSString *o_remaining_identifier;
187 BOOL b_time_remaining;
189 @property (readonly) BOOL timeRemaining;
191 -(id)initWithFrame:(NSRect)frameRect;
193 - (void)setRemainingIdentifier:(NSString *)o_string;
197 /*****************************************************************************
198 * VLCMainWindowSplitView interface
199 *****************************************************************************/
200 @interface VLCMainWindowSplitView : NSSplitView
204 /*****************************************************************************
205 * VLCThreePartImageView interface
206 *****************************************************************************/
207 @interface VLCThreePartImageView : NSView
209 NSImage * o_left_img;
210 NSImage * o_middle_img;
211 NSImage * o_right_img;
214 - (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right;
218 /*****************************************************************************
219 * PositionFormatter interface
221 * Formats a text field to only accept decimals and :
222 *****************************************************************************/
223 @interface PositionFormatter : NSFormatter
225 NSCharacterSet *o_forbidden_characters;
227 - (NSString*)stringForObjectValue:(id)obj;
229 - (BOOL)getObjectValue:(id*)obj forString:(NSString*)string errorDescription:(NSString**)error;
231 - (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
235 /*****************************************************************************
237 *****************************************************************************/
239 @interface NSView (EnableSubviews)
240 - (void)enableSubviews:(BOOL)b_enable;
243 /*****************************************************************************
244 * VLCByteCountFormatter addition
245 *****************************************************************************/
247 #ifndef MAC_OS_X_VERSION_10_8
249 // Specifies display of file or storage byte counts. The actual behavior for this is platform-specific; on OS X 10.7 and less, this uses the binary style, but decimal style on 10.8 and above
250 NSByteCountFormatterCountStyleFile = 0,
251 // Specifies display of memory byte counts. The actual behavior for this is platform-specific; on OS X 10.7 and less, this uses the binary style, but that may change over time.
252 NSByteCountFormatterCountStyleMemory = 1,
253 // The following two allow specifying the number of bytes for KB explicitly. It's better to use one of the above values in most cases.
254 NSByteCountFormatterCountStyleDecimal = 2, // 1000 bytes are shown as 1 KB
255 NSByteCountFormatterCountStyleBinary = 3 // 1024 bytes are shown as 1 KB
257 typedef NSInteger NSByteCountFormatterCountStyle;
260 @interface VLCByteCountFormatter : NSFormatter {
263 + (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)countStyle;