]> git.sesse.net Git - vlc/blob - modules/gui/macosx/prefs_widgets.h
- added macosx version detection at runtime with /System/Library/CoreServices/SystemV...
[vlc] / modules / gui / macosx / prefs_widgets.h
1 /*****************************************************************************
2  * prefs_widgets.h: Preferences controls
3  *****************************************************************************
4  * Copyright (C) 2002-2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Derk-Jan Hartman <hartman at videolan.org> 
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #define CONFIG_ITEM_STRING_LIST (CONFIG_ITEM_STRING + 1)
25 #define CONFIG_ITEM_RANGED_INTEGER (CONFIG_ITEM_INTEGER + 1)
26 #define CONFIG_ITEM_KEY_BEFORE_10_3 (CONFIG_ITEM_KEY + 1)
27 #define CONFIG_ITEM_KEY_AFTER_10_3 (CONFIG_ITEM_KEY + 2)
28 #define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
29             @"/System/Library/CoreServices/SystemVersion.plist"] \
30             objectForKey: @"ProductVersion"] floatValue]
31
32 @interface VLCConfigControl : NSView
33 {
34     module_config_t *p_item;
35     char            *psz_name;
36     NSTextField     *o_label;
37     int             i_type;
38     vlc_bool_t      b_advanced;
39 }
40
41 + (VLCConfigControl *)newControl: (module_config_t *)_p_item withView: (NSView *)o_parent_view yOffset:(int) i_yPos lastItem: (int) i_lastItem;
42 - (id)initWithFrame: (NSRect)frame item: (module_config_t *)p_item;
43 - (NSString *)getName;
44 - (int)getType;
45 - (BOOL)isAdvanced;
46
47 - (int)intValue;
48 - (float)floatValue;
49 - (char *)stringValue;
50 - (void)applyChanges;
51 static NSMenu   *o_keys_menu = nil;
52
53 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
54
55 @end
56
57 @interface StringConfigControl : VLCConfigControl
58 {
59     NSTextField     *o_textfield;
60 }
61
62 - (id) initWithItem: (module_config_t *)_p_item
63            withView: (NSView *)o_parent_view
64            withVerticalOffset: (int)i_yPos
65            withLastItem: (int)i_lastItem;
66
67 @end
68
69 @interface StringListConfigControl : VLCConfigControl
70 {
71     NSComboBox      *o_combo;
72 }
73
74 - (id) initWithItem: (module_config_t *)_p_item
75            withView: (NSView *)o_parent_view
76            withVerticalOffset: (int)i_yPos
77            withLastItem: (int)i_lastItem;
78
79 @end
80
81 @interface FileConfigControl : VLCConfigControl
82 {
83     NSTextField     *o_textfield;
84     NSButton        *o_button;
85     BOOL            b_directory;
86 }
87
88 - (id) initWithItem: (module_config_t *)_p_item
89            withView: (NSView *)o_parent_view
90            withVerticalOffset: (int)i_yPos
91            withLastItem: (int)i_lastItem;
92
93 - (IBAction)openFileDialog: (id)sender;
94 - (void)pathChosenInPanel:(NSOpenPanel *)o_sheet withReturn:(int)i_return_code contextInfo:(void  *)o_context_info;
95
96 @end
97
98 @interface ModuleConfigControl : VLCConfigControl
99 {
100     NSPopUpButton   *o_popup;
101 }
102
103 - (id) initWithItem: (module_config_t *)_p_item
104            withView: (NSView *)o_parent_view
105            withVerticalOffset: (int)i_yPos
106            withLastItem: (int)i_lastItem;
107
108 @end
109
110 @interface IntegerConfigControl : VLCConfigControl
111 {
112     NSTextField     *o_textfield;
113     NSStepper       *o_stepper;
114 }
115
116
117 - (id) initWithItem: (module_config_t *)_p_item
118            withView: (NSView *)o_parent_view
119            withVerticalOffset: (int)i_yPos
120            withLastItem: (int)i_lastItem;
121 - (IBAction)stepperChanged:(id)sender;
122 - (void)textfieldChanged:(NSNotification *)o_notification;
123
124 @end
125
126 @interface IntegerListConfigControl : VLCConfigControl
127 {
128     NSComboBox      *o_combo;
129 }
130
131 - (id) initWithItem: (module_config_t *)_p_item
132            withView: (NSView *)o_parent_view
133            withVerticalOffset: (int)i_yPos
134            withLastItem: (int)i_lastItem;
135
136 @end
137
138 @interface RangedIntegerConfigControl : VLCConfigControl
139 {
140     NSSlider        *o_slider;
141     NSTextField     *o_textfield;
142     NSTextField     *o_textfield_min;
143     NSTextField     *o_textfield_max;
144 }
145
146
147 - (id) initWithItem: (module_config_t *)_p_item
148            withView: (NSView *)o_parent_view
149            withVerticalOffset: (int)i_yPos
150            withLastItem: (int)i_lastItem;
151 - (IBAction)sliderChanged:(id)sender;
152 - (void)textfieldChanged:(NSNotification *)o_notification;
153
154 @end
155
156 @interface BoolConfigControl : VLCConfigControl
157 {
158     NSButton        *o_checkbox;
159 }
160
161 - (id) initWithItem: (module_config_t *)_p_item
162            withView: (NSView *)o_parent_view
163            withVerticalOffset: (int)i_yPos
164            withLastItem: (int)i_lastItem;
165
166 @end
167
168 @interface FloatConfigControl : VLCConfigControl
169 {
170     NSTextField     *o_textfield;
171     NSStepper       *o_stepper;
172 }
173
174
175 - (id) initWithItem: (module_config_t *)_p_item
176            withView: (NSView *)o_parent_view
177            withVerticalOffset: (int)i_yPos
178            withLastItem: (int)i_lastItem;
179 - (IBAction)stepperChanged:(id)sender;
180 - (void)textfieldChanged:(NSNotification *)o_notification;
181
182 @end
183
184 @interface RangedFloatConfigControl : VLCConfigControl
185 {
186     NSSlider        *o_slider;
187     NSTextField     *o_textfield;
188     NSTextField     *o_textfield_min;
189     NSTextField     *o_textfield_max;
190 }
191
192
193 - (id) initWithItem: (module_config_t *)_p_item
194            withView: (NSView *)o_parent_view
195            withVerticalOffset: (int)i_yPos
196            withLastItem: (int)i_lastItem;
197 - (IBAction)sliderChanged:(id)sender;
198 - (void)textfieldChanged:(NSNotification *)o_notification;
199
200 @end
201
202 @interface KeyConfigControlBefore103 : VLCConfigControl
203 {
204     NSButton        *o_cmd_checkbox;
205     NSButton        *o_ctrl_checkbox;
206     NSButton        *o_alt_checkbox;
207     NSButton        *o_shift_checkbox;
208     NSPopUpButton   *o_popup;
209 }
210
211 - (id) initWithItem: (module_config_t *)_p_item
212            withView: (NSView *)o_parent_view
213            withVerticalOffset: (int)i_yPos
214            withLastItem: (int)i_lastItem;
215
216 @end
217
218 @interface KeyConfigControlAfter103 : VLCConfigControl
219 {
220     NSPopUpButton   *o_popup;
221 }
222
223 - (id) initWithItem: (module_config_t *)_p_item
224            withView: (NSView *)o_parent_view
225            withVerticalOffset: (int)i_yPos
226            withLastItem: (int)i_lastItem;
227
228 @end
229
230 @interface ModuleListConfigControl : VLCConfigControl
231 {
232     NSTextField     *o_textfield;
233     NSScrollView    *o_scrollview;
234     NSMutableArray  *o_modulearray;
235 }
236
237 - (id) initWithItem: (module_config_t *)_p_item
238            withView: (NSView *)o_parent_view
239            withVerticalOffset: (int)i_yPos
240            withLastItem: (int)i_lastItem;
241
242 @end
243
244 //#undef CONFIG_ITEM_LIST_STRING
245 //#undef CONFIG_ITEM_RANGED_INTEGER
246 //#undef CONFIG_ITEM_KEY_BEFORE_10_3
247 //#undef CONFIG_ITEM_KEY_AFTER_10_3
248