/*****************************************************************************
* misc.h: code not specific to vlc
*****************************************************************************
- * Copyright (C) 2003-2011 VLC authors and VideoLAN
+ * Copyright (C) 2003-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*****************************************************************************/
#import <Cocoa/Cocoa.h>
-#import <ApplicationServices/ApplicationServices.h>
-#import "CompatibilityFixes.h"
+
+/*****************************************************************************
+ * NSSound (VLCAdditions)
+ *
+ * added code to change the system volume, needed for the apple remote code
+ * this is simplified code, which won't let you set the exact volume
+ * (that's what the audio output is for after all), but just the system volume
+ * in steps of 1/16 (matching the default AR or volume key implementation).
+ *****************************************************************************/
+
+@interface NSSound (VLCAdditions)
++ (float)systemVolumeForChannel:(int)channel;
++ (bool)setSystemVolume:(float)volume forChannel:(int)channel;
++ (void)increaseSystemVolume;
++ (void)decreaseSystemVolume;
+@end
/*****************************************************************************
* NSAnimation (VLCAddition)
*****************************************************************************/
@interface NSAnimation (VLCAdditions)
-- (void)setUserInfo: (void *)userInfo;
-- (void *)userInfo;
+@property (readwrite) void * userInfo;
+
@end
/*****************************************************************************
@interface NSScreen (VLCAdditions)
+ (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID;
-- (BOOL)isMainScreen;
+- (BOOL)hasMenuBar;
+- (BOOL)hasDock;
- (BOOL)isScreen: (NSScreen*)screen;
- (CGDirectDisplayID)displayID;
- (void)blackoutOtherScreens;
+ (void)unblackoutScreens;
+
+- (void)setFullscreenPresentationOptions;
+- (void)setNonFullscreenPresentationOptions;
@end
/*****************************************************************************
- * VLCWindow
+ * VLCDragDropView
*
- * Missing extension to NSWindow
+ * Disables default drag / drop behaviour of an NSImageView.
+ * set it for all sub image views withing an VLCDragDropView.
*****************************************************************************/
-@interface VLCWindow : NSWindow <NSWindowDelegate>
-{
- BOOL b_canBecomeKeyWindow;
- BOOL b_isset_canBecomeKeyWindow;
- NSViewAnimation *animation;
-}
-- (void)setCanBecomeKeyWindow: (BOOL)canBecomeKey;
+@interface VLCDropDisabledImageView : NSImageView
+
+@end
-/* animate mode is only supported in >=10.4 */
-- (void)orderFront: (id)sender animate: (BOOL)animate;
+/*****************************************************************************
+ * VLCDragDropView
+ *****************************************************************************/
+
+@interface VLCDragDropView : NSView
+{
+ bool b_activeDragAndDrop;
+
+ id _dropHandler;
+}
-/* animate mode is only supported in >=10.4 */
-- (void)orderOut: (id)sender animate: (BOOL)animate;
+@property (nonatomic, assign) id dropHandler;
+@property (nonatomic, assign) BOOL drawBorder;
-/* animate mode is only supported in >=10.4 */
-- (void)orderOut: (id)sender animate: (BOOL)animate callback:(NSInvocation *)callback;
-/* animate mode is only supported in >=10.4 */
-- (void)closeAndAnimate: (BOOL)animate;
+- (void)enablePlaylistItems;
-- (BOOL)isFullscreen;
@end
/*****************************************************************************
- * VLCControllerView
+ * MPSlider
*****************************************************************************/
-@interface VLCControllerView : NSView
-{
-}
+@interface MPSlider : NSSlider
@end
/*****************************************************************************
- * VLBrushedMetalImageView
+ * ProgressView
*****************************************************************************/
-@interface VLBrushedMetalImageView : NSImageView
-{
+@interface VLCProgressView : NSView
-}
+- (void)scrollWheel:(NSEvent *)o_event;
@end
/*****************************************************************************
- * MPSlider
+ * TimeLineSlider
*****************************************************************************/
-@interface MPSlider : NSSlider
+@interface TimeLineSlider : NSSlider
{
+ NSImage *o_knob_img;
+ NSRect img_rect;
+ BOOL b_dark;
}
+@property (readonly) CGFloat knobPosition;
+
+- (void)drawRect:(NSRect)rect;
+- (void)drawKnobInRect:(NSRect)knobRect;
@end
/*****************************************************************************
- * TimeLineSlider
+ * VLCVolumeSliderCommon
*****************************************************************************/
-@interface TimeLineSlider : NSSlider
+@interface VLCVolumeSliderCommon : NSSlider
{
- NSImage *o_knob_img;
- NSRect img_rect;
+ BOOL _usesBrightArtwork;
}
-- (CGFloat)knobPosition;
+@property (readwrite, nonatomic) BOOL usesBrightArtwork;
-- (void)drawRect:(NSRect)rect;
-- (void)drawKnobInRect:(NSRect)knobRect;
+- (void)scrollWheel:(NSEvent *)o_event;
+- (void)drawFullVolumeMarker;
+
+- (CGFloat)fullVolumePos;
@end
+@interface VolumeSliderCell : NSSliderCell
+@end
+
/*****************************************************************************
* ITSlider
*****************************************************************************/
-@interface ITSlider : NSSlider
+@interface ITSlider : VLCVolumeSliderCommon
{
NSImage *img;
NSRect image_rect;
@interface VLCTimeField : NSTextField
{
NSShadow * o_string_shadow;
- NSDictionary * o_string_attributes_dict;
+ NSTextAlignment textAlignment;
+
+ NSString *o_remaining_identifier;
+ BOOL b_time_remaining;
}
+@property (readonly) BOOL timeRemaining;
+
+-(id)initWithFrame:(NSRect)frameRect;
+
+- (void)setRemainingIdentifier:(NSString *)o_string;
-- (BOOL)timeRemaining;
@end
/*****************************************************************************
* VLCMainWindowSplitView interface
*****************************************************************************/
@interface VLCMainWindowSplitView : NSSplitView
-{
-}
@end
- (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right;
@end
+
+
+/*****************************************************************************
+ * PositionFormatter interface
+ *
+ * Formats a text field to only accept decimals and :
+ *****************************************************************************/
+@interface PositionFormatter : NSFormatter
+{
+ NSCharacterSet *o_forbidden_characters;
+}
+- (NSString*)stringForObjectValue:(id)obj;
+
+- (BOOL)getObjectValue:(id*)obj forString:(NSString*)string errorDescription:(NSString**)error;
+
+- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
+
+@end
+
+/*****************************************************************************
+ * NSView addition
+ *****************************************************************************/
+
+@interface NSView (EnableSubviews)
+- (void)enableSubviews:(BOOL)b_enable;
+@end
+
+/*****************************************************************************
+ * VLCByteCountFormatter addition
+ *****************************************************************************/
+
+#ifndef MAC_OS_X_VERSION_10_8
+enum {
+ // 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
+ NSByteCountFormatterCountStyleFile = 0,
+ // 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.
+ NSByteCountFormatterCountStyleMemory = 1,
+ // 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.
+ NSByteCountFormatterCountStyleDecimal = 2, // 1000 bytes are shown as 1 KB
+ NSByteCountFormatterCountStyleBinary = 3 // 1024 bytes are shown as 1 KB
+};
+typedef NSInteger NSByteCountFormatterCountStyle;
+#endif
+
+@interface VLCByteCountFormatter : NSFormatter {
+}
+
++ (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)countStyle;
+@end