1 /*****************************************************************************
2 * misc.h: code not specific to vlc
3 *****************************************************************************
4 * Copyright (C) 2003-2013 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>
26 #import "CompatibilityFixes.h"
28 /*****************************************************************************
29 * NSSound (VLCAdditions)
31 * added code to change the system volume, needed for the apple remote code
32 * this is simplified code, which won't let you set the exact volume
33 * (that's what the audio output is for after all), but just the system volume
34 * in steps of 1/16 (matching the default AR or volume key implementation).
35 *****************************************************************************/
37 @interface NSSound (VLCAdditions)
38 + (float)systemVolumeForChannel:(int)channel;
39 + (bool)setSystemVolume:(float)volume forChannel:(int)channel;
40 + (void)increaseSystemVolume;
41 + (void)decreaseSystemVolume;
44 /*****************************************************************************
45 * NSAnimation (VLCAddition)
46 *****************************************************************************/
48 @interface NSAnimation (VLCAdditions)
49 @property (readwrite) void * userInfo;
53 /*****************************************************************************
54 * NSScreen (VLCAdditions)
56 * Missing extension to NSScreen
57 *****************************************************************************/
59 @interface NSScreen (VLCAdditions)
61 + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID;
64 - (BOOL)isScreen: (NSScreen*)screen;
65 - (CGDirectDisplayID)displayID;
66 - (void)blackoutOtherScreens;
67 + (void)unblackoutScreens;
69 - (void)setFullscreenPresentationOptions;
70 - (void)setNonFullscreenPresentationOptions;
74 /*****************************************************************************
75 * VLBrushedMetalImageView
76 *****************************************************************************/
78 @interface VLBrushedMetalImageView : NSImageView
83 /*****************************************************************************
85 *****************************************************************************/
87 @interface MPSlider : NSSlider
91 /*****************************************************************************
93 *****************************************************************************/
95 @interface VLCProgressView : NSView
97 - (void)scrollWheel:(NSEvent *)o_event;
102 /*****************************************************************************
104 *****************************************************************************/
106 @interface TimeLineSlider : NSSlider
112 @property (readonly) CGFloat knobPosition;
114 - (void)drawRect:(NSRect)rect;
115 - (void)drawKnobInRect:(NSRect)knobRect;
119 /*****************************************************************************
120 * VLCVolumeSliderCommon
121 *****************************************************************************/
123 @interface VLCVolumeSliderCommon : NSSlider
125 BOOL _usesBrightArtwork;
127 @property (readwrite, nonatomic) BOOL usesBrightArtwork;
129 - (void)scrollWheel:(NSEvent *)o_event;
130 - (void)drawFullVolumeMarker;
132 - (CGFloat)fullVolumePos;
136 /*****************************************************************************
138 *****************************************************************************/
140 @interface ITSlider : VLCVolumeSliderCommon
146 - (void)drawRect:(NSRect)rect;
147 - (void)drawKnobInRect:(NSRect)knobRect;
151 /*****************************************************************************
152 * VLCTimeField interface
153 *****************************************************************************
154 * we need the implementation to catch our click-event in the controller window
155 *****************************************************************************/
157 @interface VLCTimeField : NSTextField
159 NSShadow * o_string_shadow;
160 NSTextAlignment textAlignment;
162 NSString *o_remaining_identifier;
163 BOOL b_time_remaining;
165 @property (readonly) BOOL timeRemaining;
167 -(id)initWithFrame:(NSRect)frameRect;
169 - (void)setRemainingIdentifier:(NSString *)o_string;
173 /*****************************************************************************
174 * VLCMainWindowSplitView interface
175 *****************************************************************************/
176 @interface VLCMainWindowSplitView : NSSplitView
180 /*****************************************************************************
181 * VLCThreePartImageView interface
182 *****************************************************************************/
183 @interface VLCThreePartImageView : NSView
185 NSImage * o_left_img;
186 NSImage * o_middle_img;
187 NSImage * o_right_img;
190 - (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right;
193 /*****************************************************************************
194 * VLCThreePartDropView interface
195 *****************************************************************************/
196 @interface VLCThreePartDropView : VLCThreePartImageView
200 /*****************************************************************************
201 * PositionFormatter interface
203 * Formats a text field to only accept decimals and :
204 *****************************************************************************/
205 @interface PositionFormatter : NSFormatter
207 NSCharacterSet *o_forbidden_characters;
209 - (NSString*)stringForObjectValue:(id)obj;
211 - (BOOL)getObjectValue:(id*)obj forString:(NSString*)string errorDescription:(NSString**)error;
213 - (bool)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
217 /*****************************************************************************
219 *****************************************************************************/
221 @interface NSView (EnableSubviews)
222 - (void)enableSubviews:(BOOL)b_enable;