1 /*****************************************************************************
2 * prefs_widgets.h: Preferences controls
3 *****************************************************************************
4 * Copyright (C) 2002-2003 VideoLAN
7 * Authors: Derk-Jan Hartman <hartman at videolan.org>
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.
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.
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 *****************************************************************************/
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]
32 @interface VLCConfigControl : NSView
34 module_config_t *p_item;
39 vlc_bool_t b_advanced;
42 + (VLCConfigControl *)newControl: (module_config_t *)_p_item
43 withView: (NSView *)o_parent_view yOffset:(int) i_yPos;
44 - (id)initWithFrame: (NSRect)frame item: (module_config_t *)p_item;
45 - (NSString *)getName;
49 - (void)setYPos:(int)i_yPos;
52 - (char *)stringValue;
54 static NSMenu *o_keys_menu = nil;
56 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
60 @interface StringConfigControl : VLCConfigControl
62 NSTextField *o_textfield;
65 - (id) initWithItem: (module_config_t *)_p_item
66 withView: (NSView *)o_parent_view
67 withVerticalOffset: (int)i_yPos;
71 @interface StringListConfigControl : VLCConfigControl
76 - (id) initWithItem: (module_config_t *)_p_item
77 withView: (NSView *)o_parent_view
78 withVerticalOffset: (int)i_yPos;
82 @interface FileConfigControl : VLCConfigControl
84 NSTextField *o_textfield;
89 - (id) initWithItem: (module_config_t *)_p_item
90 withView: (NSView *)o_parent_view
91 withVerticalOffset: (int)i_yPos;
93 - (IBAction)openFileDialog: (id)sender;
94 - (void)pathChosenInPanel:(NSOpenPanel *)o_sheet withReturn:(int)i_return_code contextInfo:(void *)o_context_info;
98 @interface ModuleConfigControl : VLCConfigControl
100 NSPopUpButton *o_popup;
103 - (id) initWithItem: (module_config_t *)_p_item
104 withView: (NSView *)o_parent_view
105 withVerticalOffset: (int)i_yPos;
109 @interface IntegerConfigControl : VLCConfigControl
111 NSTextField *o_textfield;
112 NSStepper *o_stepper;
116 - (id) initWithItem: (module_config_t *)_p_item
117 withView: (NSView *)o_parent_view
118 withVerticalOffset: (int)i_yPos;
119 - (IBAction)stepperChanged:(id)sender;
120 - (void)textfieldChanged:(NSNotification *)o_notification;
124 @interface IntegerListConfigControl : VLCConfigControl
129 - (id) initWithItem: (module_config_t *)_p_item
130 withView: (NSView *)o_parent_view
131 withVerticalOffset: (int)i_yPos;
135 @interface RangedIntegerConfigControl : VLCConfigControl
138 NSTextField *o_textfield;
139 NSTextField *o_textfield_min;
140 NSTextField *o_textfield_max;
144 - (id) initWithItem: (module_config_t *)_p_item
145 withView: (NSView *)o_parent_view
146 withVerticalOffset: (int)i_yPos;
147 - (IBAction)sliderChanged:(id)sender;
148 - (void)textfieldChanged:(NSNotification *)o_notification;
152 @interface BoolConfigControl : VLCConfigControl
154 NSButton *o_checkbox;
157 - (id) initWithItem: (module_config_t *)_p_item
158 withView: (NSView *)o_parent_view
159 withVerticalOffset: (int)i_yPos;
163 @interface FloatConfigControl : VLCConfigControl
165 NSTextField *o_textfield;
166 NSStepper *o_stepper;
170 - (id) initWithItem: (module_config_t *)_p_item
171 withView: (NSView *)o_parent_view
172 withVerticalOffset: (int)i_yPos;
173 - (IBAction)stepperChanged:(id)sender;
174 - (void)textfieldChanged:(NSNotification *)o_notification;
178 @interface RangedFloatConfigControl : VLCConfigControl
181 NSTextField *o_textfield;
182 NSTextField *o_textfield_min;
183 NSTextField *o_textfield_max;
187 - (id) initWithItem: (module_config_t *)_p_item
188 withView: (NSView *)o_parent_view
189 withVerticalOffset: (int)i_yPos;
190 - (IBAction)sliderChanged:(id)sender;
191 - (void)textfieldChanged:(NSNotification *)o_notification;
195 @interface KeyConfigControlBefore103 : VLCConfigControl
197 NSButton *o_cmd_checkbox;
198 NSButton *o_ctrl_checkbox;
199 NSButton *o_alt_checkbox;
200 NSButton *o_shift_checkbox;
201 NSPopUpButton *o_popup;
204 - (id) initWithItem: (module_config_t *)_p_item
205 withView: (NSView *)o_parent_view
206 withVerticalOffset: (int)i_yPos;
210 @interface KeyConfigControlAfter103 : VLCConfigControl
212 NSPopUpButton *o_popup;
215 - (id) initWithItem: (module_config_t *)_p_item
216 withView: (NSView *)o_parent_view
217 withVerticalOffset: (int)i_yPos;
221 @interface ModuleListConfigControl : VLCConfigControl
223 NSTextField *o_textfield;
224 NSScrollView *o_scrollview;
225 NSMutableArray *o_modulearray;
228 - (id) initWithItem: (module_config_t *)_p_item
229 withView: (NSView *)o_parent_view
230 withVerticalOffset: (int)i_yPos;
234 //#undef CONFIG_ITEM_LIST_STRING
235 //#undef CONFIG_ITEM_RANGED_INTEGER
236 //#undef CONFIG_ITEM_KEY_BEFORE_10_3
237 //#undef CONFIG_ITEM_KEY_AFTER_10_3