]> git.sesse.net Git - vlc/blob - modules/gui/macosx/misc.h
macosx: add visual markers for 100% of the volume (refs #8628)
[vlc] / modules / gui / macosx / misc.h
1 /*****************************************************************************
2  * misc.h: code not specific to vlc
3  *****************************************************************************
4  * Copyright (C) 2003-2013 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  * 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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 #import <Cocoa/Cocoa.h>
26 #import "CompatibilityFixes.h"
27
28 /*****************************************************************************
29  * NSSound (VLCAdditions)
30  *
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  *****************************************************************************/
36
37 @interface NSSound (VLCAdditions)
38 + (float)systemVolumeForChannel:(int)channel;
39 + (bool)setSystemVolume:(float)volume forChannel:(int)channel;
40 + (void)increaseSystemVolume;
41 + (void)decreaseSystemVolume;
42 @end
43
44 /*****************************************************************************
45  * NSAnimation (VLCAddition)
46  *****************************************************************************/
47
48 @interface NSAnimation (VLCAdditions)
49 @property (readwrite) void * userInfo;
50
51 @end
52
53 /*****************************************************************************
54  * NSScreen (VLCAdditions)
55  *
56  *  Missing extension to NSScreen
57  *****************************************************************************/
58
59 @interface NSScreen (VLCAdditions)
60
61 + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID;
62 - (BOOL)hasMenuBar;
63 - (BOOL)hasDock;
64 - (BOOL)isScreen: (NSScreen*)screen;
65 - (CGDirectDisplayID)displayID;
66 - (void)blackoutOtherScreens;
67 + (void)unblackoutScreens;
68
69 - (void)setFullscreenPresentationOptions;
70 - (void)setNonFullscreenPresentationOptions;
71 @end
72
73
74 /*****************************************************************************
75  * VLBrushedMetalImageView
76  *****************************************************************************/
77
78 @interface VLBrushedMetalImageView : NSImageView
79
80 @end
81
82
83 /*****************************************************************************
84  * MPSlider
85  *****************************************************************************/
86
87 @interface MPSlider : NSSlider
88
89 @end
90
91 /*****************************************************************************
92  * ProgressView
93  *****************************************************************************/
94
95 @interface VLCProgressView : NSView
96
97 - (void)scrollWheel:(NSEvent *)o_event;
98
99 @end
100
101
102 /*****************************************************************************
103  * TimeLineSlider
104  *****************************************************************************/
105
106 @interface TimeLineSlider : NSSlider
107 {
108     NSImage *o_knob_img;
109     NSRect img_rect;
110     BOOL b_dark;
111 }
112 @property (readonly) CGFloat knobPosition;
113
114 - (void)drawRect:(NSRect)rect;
115 - (void)drawKnobInRect:(NSRect)knobRect;
116
117 @end
118
119 /*****************************************************************************
120  * VLCVolumeSliderCommon
121  *****************************************************************************/
122
123 @interface VLCVolumeSliderCommon : NSSlider
124 {
125     BOOL _usesBrightArtwork;
126 }
127 @property (readwrite, nonatomic) BOOL usesBrightArtwork;
128
129 - (void)scrollWheel:(NSEvent *)o_event;
130 - (void)drawFullVolumeMarker;
131
132 @end
133
134 /*****************************************************************************
135  * ITSlider
136  *****************************************************************************/
137
138 @interface ITSlider : VLCVolumeSliderCommon
139 {
140     NSImage *img;
141     NSRect image_rect;
142 }
143
144 - (void)drawRect:(NSRect)rect;
145 - (void)drawKnobInRect:(NSRect)knobRect;
146
147 @end
148
149 /*****************************************************************************
150  * VLCTimeField interface
151  *****************************************************************************
152  * we need the implementation to catch our click-event in the controller window
153  *****************************************************************************/
154
155 @interface VLCTimeField : NSTextField
156 {
157     NSShadow * o_string_shadow;
158     NSTextAlignment textAlignment;
159
160     NSString *o_remaining_identifier;
161     BOOL b_time_remaining;
162 }
163 @property (readonly) BOOL timeRemaining;
164
165 -(id)initWithFrame:(NSRect)frameRect;
166
167 - (void)setRemainingIdentifier:(NSString *)o_string;
168
169 @end
170
171 /*****************************************************************************
172  * VLCMainWindowSplitView interface
173  *****************************************************************************/
174 @interface VLCMainWindowSplitView : NSSplitView
175
176 @end
177
178 /*****************************************************************************
179  * VLCThreePartImageView interface
180  *****************************************************************************/
181 @interface VLCThreePartImageView : NSView
182 {
183     NSImage * o_left_img;
184     NSImage * o_middle_img;
185     NSImage * o_right_img;
186 }
187
188 - (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right;
189 @end
190
191 /*****************************************************************************
192  * VLCThreePartDropView interface
193  *****************************************************************************/
194 @interface VLCThreePartDropView : VLCThreePartImageView
195
196 @end
197
198 /*****************************************************************************
199  * PositionFormatter interface
200  *
201  * Formats a text field to only accept decimals and :
202  *****************************************************************************/
203 @interface PositionFormatter : NSFormatter
204 {
205     NSCharacterSet *o_forbidden_characters;
206 }
207 - (NSString*)stringForObjectValue:(id)obj;
208
209 - (BOOL)getObjectValue:(id*)obj forString:(NSString*)string errorDescription:(NSString**)error;
210
211 - (bool)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
212
213 @end