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;
38 vlc_bool_t b_advanced;
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;
49 - (char *)stringValue;
51 static NSMenu *o_keys_menu = nil;
53 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
57 @interface StringConfigControl : VLCConfigControl
59 NSTextField *o_textfield;
62 - (id) initWithItem: (module_config_t *)_p_item
63 withView: (NSView *)o_parent_view
64 withVerticalOffset: (int)i_yPos
65 withLastItem: (int)i_lastItem;
69 @interface StringListConfigControl : VLCConfigControl
74 - (id) initWithItem: (module_config_t *)_p_item
75 withView: (NSView *)o_parent_view
76 withVerticalOffset: (int)i_yPos
77 withLastItem: (int)i_lastItem;
81 @interface FileConfigControl : VLCConfigControl
83 NSTextField *o_textfield;
88 - (id) initWithItem: (module_config_t *)_p_item
89 withView: (NSView *)o_parent_view
90 withVerticalOffset: (int)i_yPos
91 withLastItem: (int)i_lastItem;
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
106 withLastItem: (int)i_lastItem;
110 @interface IntegerConfigControl : VLCConfigControl
112 NSTextField *o_textfield;
113 NSStepper *o_stepper;
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;
126 @interface IntegerListConfigControl : VLCConfigControl
131 - (id) initWithItem: (module_config_t *)_p_item
132 withView: (NSView *)o_parent_view
133 withVerticalOffset: (int)i_yPos
134 withLastItem: (int)i_lastItem;
138 @interface RangedIntegerConfigControl : VLCConfigControl
141 NSTextField *o_textfield;
142 NSTextField *o_textfield_min;
143 NSTextField *o_textfield_max;
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;
156 @interface BoolConfigControl : VLCConfigControl
158 NSButton *o_checkbox;
161 - (id) initWithItem: (module_config_t *)_p_item
162 withView: (NSView *)o_parent_view
163 withVerticalOffset: (int)i_yPos
164 withLastItem: (int)i_lastItem;
168 @interface FloatConfigControl : VLCConfigControl
170 NSTextField *o_textfield;
171 NSStepper *o_stepper;
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;
184 @interface RangedFloatConfigControl : VLCConfigControl
187 NSTextField *o_textfield;
188 NSTextField *o_textfield_min;
189 NSTextField *o_textfield_max;
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;
202 @interface KeyConfigControlBefore103 : VLCConfigControl
204 NSButton *o_cmd_checkbox;
205 NSButton *o_ctrl_checkbox;
206 NSButton *o_alt_checkbox;
207 NSButton *o_shift_checkbox;
208 NSPopUpButton *o_popup;
211 - (id) initWithItem: (module_config_t *)_p_item
212 withView: (NSView *)o_parent_view
213 withVerticalOffset: (int)i_yPos
214 withLastItem: (int)i_lastItem;
218 @interface KeyConfigControlAfter103 : VLCConfigControl
220 NSPopUpButton *o_popup;
223 - (id) initWithItem: (module_config_t *)_p_item
224 withView: (NSView *)o_parent_view
225 withVerticalOffset: (int)i_yPos
226 withLastItem: (int)i_lastItem;
230 @interface ModuleListConfigControl : VLCConfigControl
232 NSTextField *o_textfield;
233 NSScrollView *o_scrollview;
234 NSMutableArray *o_modulearray;
237 - (id) initWithItem: (module_config_t *)_p_item
238 withView: (NSView *)o_parent_view
239 withVerticalOffset: (int)i_yPos
240 withLastItem: (int)i_lastItem;
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