misc.h 7.1 KB
Newer Older
1 2 3
/*****************************************************************************
 * misc.h: code not specific to vlc
 *****************************************************************************
4
 * Copyright (C) 2003-2014 VLC authors and VideoLAN
5
 * $Id$
6 7
 *
 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8
 *          Felix Paul Kühne <fkuehne at videolan dot org>
9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
Antoine Cellerier's avatar
Antoine Cellerier committed
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 24
 *****************************************************************************/

25
#import <Cocoa/Cocoa.h>
26 27 28 29 30 31 32 33 34 35

/*****************************************************************************
 * NSScreen (VLCAdditions)
 *
 *  Missing extension to NSScreen
 *****************************************************************************/

@interface NSScreen (VLCAdditions)

+ (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID;
36 37
- (BOOL)hasMenuBar;
- (BOOL)hasDock;
38
- (BOOL)isScreen: (NSScreen*)screen;
39 40 41
- (CGDirectDisplayID)displayID;
- (void)blackoutOtherScreens;
+ (void)unblackoutScreens;
42 43 44

- (void)setFullscreenPresentationOptions;
- (void)setNonFullscreenPresentationOptions;
45 46
@end

47 48 49 50 51 52 53 54 55 56 57
/*****************************************************************************
 * VLCDragDropView
 *
 * Disables default drag / drop behaviour of an NSImageView.
 * set it for all sub image views withing an VLCDragDropView.
 *****************************************************************************/


@interface VLCDropDisabledImageView : NSImageView

@end
58

59
/*****************************************************************************
60
 * VLCDragDropView
61 62
 *****************************************************************************/

63 64 65
@interface VLCDragDropView : NSView

@property (nonatomic, assign) id dropHandler;
66 67
@property (nonatomic, assign) BOOL drawBorder;

68
- (void)enablePlaylistItems;
69 70 71 72

@end


73 74 75 76 77
/*****************************************************************************
 * MPSlider
 *****************************************************************************/

@interface MPSlider : NSSlider
78 79

@end
80

81 82 83 84 85 86 87 88 89 90 91
/*****************************************************************************
 * ProgressView
 *****************************************************************************/

@interface VLCProgressView : NSView

- (void)scrollWheel:(NSEvent *)o_event;

@end


92 93 94 95 96
/*****************************************************************************
 * TimeLineSlider
 *****************************************************************************/

@interface TimeLineSlider : NSSlider
97

98
@property (readonly) CGFloat knobPosition;
99 100 101 102 103 104

- (void)drawRect:(NSRect)rect;
- (void)drawKnobInRect:(NSRect)knobRect;

@end

105 106 107 108 109
/*****************************************************************************
 * VLCVolumeSliderCommon
 *****************************************************************************/

@interface VLCVolumeSliderCommon : NSSlider
110

111
@property (readwrite, nonatomic) BOOL usesBrightArtwork;
112 113

- (void)scrollWheel:(NSEvent *)o_event;
114
- (void)drawFullVolumeMarker;
115

116 117
- (CGFloat)fullVolumePos;

118 119
@end

120 121 122
@interface VolumeSliderCell : NSSliderCell
@end

123
/*****************************************************************************
124
 * ITSlider
125
 *****************************************************************************/
126

127
@interface ITSlider : VLCVolumeSliderCommon
128 129

@end
130 131 132 133 134 135 136 137

/*****************************************************************************
 * VLCTimeField interface
 *****************************************************************************
 * we need the implementation to catch our click-event in the controller window
 *****************************************************************************/

@interface VLCTimeField : NSTextField
138

139
@property (readonly) BOOL timeRemaining;
140 141 142

- (void)setRemainingIdentifier:(NSString *)o_string;

143
@end
144 145 146 147 148 149 150

/*****************************************************************************
 * VLCMainWindowSplitView interface
 *****************************************************************************/
@interface VLCMainWindowSplitView : NSSplitView

@end
151 152 153 154 155 156 157

/*****************************************************************************
 * VLCThreePartImageView interface
 *****************************************************************************/
@interface VLCThreePartImageView : NSView

- (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right;
158

159
@end
160

161 162 163 164 165 166 167

/*****************************************************************************
 * PositionFormatter interface
 *
 * Formats a text field to only accept decimals and :
 *****************************************************************************/
@interface PositionFormatter : NSFormatter
168

169 170
- (NSString*)stringForObjectValue:(id)obj;

171 172 173
- (BOOL)getObjectValue:(id*)obj
             forString:(NSString*)string
      errorDescription:(NSString**)error;
174

175 176 177
- (BOOL)isPartialStringValid:(NSString*)partialString
            newEditingString:(NSString**)newString
            errorDescription:(NSString**)error;
178 179

@end
180 181 182 183 184 185 186

/*****************************************************************************
 * NSView addition
 *****************************************************************************/

@interface NSView (EnableSubviews)
- (void)enableSubviews:(BOOL)b_enable;
187 188 189 190 191 192 193
@end

/*****************************************************************************
 * VLCByteCountFormatter addition
 *****************************************************************************/

#ifndef MAC_OS_X_VERSION_10_8
194
enum {
195 196 197 198 199 200 201 202
    // 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
};
203
typedef NSInteger NSByteCountFormatterCountStyle;
204 205 206 207 208 209 210
#endif

@interface VLCByteCountFormatter : NSFormatter {
}

+ (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)countStyle;
@end
211 212 213 214 215 216

extern NSString *const VLCOpenTextFieldWasClicked;

@interface VLCOpenTextField : NSTextField
- (void)mouseDown:(NSEvent *)theEvent;
@end