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 /*****************************************************************************
30 * Disables default drag / drop behaviour of an NSImageView.
31 * set it for all sub image views withing an VLCDragDropView.
32 *****************************************************************************/
35 @interface VLCDropDisabledImageView
: NSImageView
39 /*****************************************************************************
41 *****************************************************************************/
43 @interface VLCDragDropView
: NSView
45 @
property (nonatomic
, assign
) id dropHandler
;
46 @
property (nonatomic
, assign
) BOOL drawBorder
;
48 - (void)enablePlaylistItems
;
53 /*****************************************************************************
55 *****************************************************************************/
57 @interface MPSlider
: NSSlider
61 /*****************************************************************************
63 *****************************************************************************/
65 @interface VLCProgressView
: NSView
67 - (void)scrollWheel
:(NSEvent
*)o_event
;
72 /*****************************************************************************
74 *****************************************************************************/
76 @interface TimeLineSlider
: NSSlider
78 @
property (readonly
) CGFloat knobPosition
;
80 - (void)drawRect
:(NSRect
)rect
;
81 - (void)drawKnobInRect
:(NSRect
)knobRect
;
85 /*****************************************************************************
86 * VLCVolumeSliderCommon
87 *****************************************************************************/
89 @interface VLCVolumeSliderCommon
: NSSlider
91 @
property (readwrite
, nonatomic
) BOOL usesBrightArtwork
;
93 - (void)scrollWheel
:(NSEvent
*)o_event
;
94 - (void)drawFullVolumeMarker
;
96 - (CGFloat
)fullVolumePos
;
100 @interface VolumeSliderCell
: NSSliderCell
103 /*****************************************************************************
105 *****************************************************************************/
107 @interface ITSlider
: VLCVolumeSliderCommon
111 /*****************************************************************************
112 * VLCMainWindowSplitView interface
113 *****************************************************************************/
114 @interface VLCMainWindowSplitView
: NSSplitView
118 /*****************************************************************************
119 * VLCThreePartImageView interface
120 *****************************************************************************/
121 @interface VLCThreePartImageView
: NSView
123 - (void)setImagesLeft
:(NSImage
*)left middle
: (NSImage
*)middle right
:(NSImage
*)right
;
128 /*****************************************************************************
129 * PositionFormatter interface
131 * Formats a text field to only accept decimals and :
132 *****************************************************************************/
133 @interface PositionFormatter
: NSFormatter
135 - (NSString
*)stringForObjectValue
:(id
)obj
;
137 - (BOOL
)getObjectValue
:(id
*)obj
138 forString
:(NSString
*)string
139 errorDescription
:(NSString
**)error
;
141 - (BOOL
)isPartialStringValid
:(NSString
*)partialString
142 newEditingString
:(NSString
**)newString
143 errorDescription
:(NSString
**)error
;
147 /*****************************************************************************
149 *****************************************************************************/
151 @interface
NSView (EnableSubviews
)
152 - (void)enableSubviews
:(BOOL
)b_enable
;
155 /*****************************************************************************
156 * VLCByteCountFormatter addition
157 *****************************************************************************/
159 #ifndef MAC_OS_X_VERSION_10_8
161 // 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
162 NSByteCountFormatterCountStyleFile
= 0,
163 // 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.
164 NSByteCountFormatterCountStyleMemory
= 1,
165 // 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.
166 NSByteCountFormatterCountStyleDecimal
= 2, // 1000 bytes are shown as 1 KB
167 NSByteCountFormatterCountStyleBinary
= 3 // 1024 bytes are shown as 1 KB
169 typedef NSInteger NSByteCountFormatterCountStyle
;
172 @interface VLCByteCountFormatter
: NSFormatter
{
175 + (NSString
*)stringFromByteCount
:(long long)byteCount countStyle
:(NSByteCountFormatterCountStyle
)countStyle
;