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)
29 @interface VLCConfigControl : NSView
31 module_config_t *p_item;
35 vlc_bool_t b_advanced;
38 + (VLCConfigControl *)newControl: (module_config_t *)_p_item withView: (NSView *)o_parent_view yOffset:(int) i_yPos lastItem: (int) i_lastItem;
39 - (id)initWithFrame: (NSRect)frame item: (module_config_t *)p_item;
40 - (NSString *)getName;
46 - (char *)stringValue;
48 static NSMenu *o_keys_menu = nil;
50 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
54 @interface StringConfigControl : VLCConfigControl
56 NSTextField *o_textfield;
59 - (id) initWithItem: (module_config_t *)_p_item
60 withView: (NSView *)o_parent_view
61 withVerticalOffset: (int)i_yPos
62 withLastItem: (int)i_lastItem;
66 @interface StringListConfigControl : VLCConfigControl
71 - (id) initWithItem: (module_config_t *)_p_item
72 withView: (NSView *)o_parent_view
73 withVerticalOffset: (int)i_yPos
74 withLastItem: (int)i_lastItem;
78 @interface FileConfigControl : VLCConfigControl
80 NSTextField *o_textfield;
85 - (id) initWithItem: (module_config_t *)_p_item
86 withView: (NSView *)o_parent_view
87 withVerticalOffset: (int)i_yPos
88 withLastItem: (int)i_lastItem;
90 - (IBAction)openFileDialog: (id)sender;
91 - (void)pathChosenInPanel:(NSOpenPanel *)o_sheet withReturn:(int)i_return_code contextInfo:(void *)o_context_info;
95 @interface ModuleConfigControl : VLCConfigControl
97 NSPopUpButton *o_popup;
100 - (id) initWithItem: (module_config_t *)_p_item
101 withView: (NSView *)o_parent_view
102 withVerticalOffset: (int)i_yPos
103 withLastItem: (int)i_lastItem;
107 @interface IntegerConfigControl : VLCConfigControl
109 NSTextField *o_textfield;
110 NSStepper *o_stepper;
114 - (id) initWithItem: (module_config_t *)_p_item
115 withView: (NSView *)o_parent_view
116 withVerticalOffset: (int)i_yPos
117 withLastItem: (int)i_lastItem;
118 - (IBAction)stepperChanged:(id)sender;
119 - (void)textfieldChanged:(NSNotification *)o_notification;
123 @interface IntegerListConfigControl : VLCConfigControl
128 - (id) initWithItem: (module_config_t *)_p_item
129 withView: (NSView *)o_parent_view
130 withVerticalOffset: (int)i_yPos
131 withLastItem: (int)i_lastItem;
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 withLastItem: (int)i_lastItem;
148 - (IBAction)sliderChanged:(id)sender;
149 - (void)textfieldChanged:(NSNotification *)o_notification;
153 @interface BoolConfigControl : VLCConfigControl
155 NSButton *o_checkbox;
158 - (id) initWithItem: (module_config_t *)_p_item
159 withView: (NSView *)o_parent_view
160 withVerticalOffset: (int)i_yPos
161 withLastItem: (int)i_lastItem;
165 @interface FloatConfigControl : VLCConfigControl
167 NSTextField *o_textfield;
168 NSStepper *o_stepper;
172 - (id) initWithItem: (module_config_t *)_p_item
173 withView: (NSView *)o_parent_view
174 withVerticalOffset: (int)i_yPos
175 withLastItem: (int)i_lastItem;
176 - (IBAction)stepperChanged:(id)sender;
177 - (void)textfieldChanged:(NSNotification *)o_notification;
181 @interface RangedFloatConfigControl : VLCConfigControl
184 NSTextField *o_textfield;
185 NSTextField *o_textfield_min;
186 NSTextField *o_textfield_max;
190 - (id) initWithItem: (module_config_t *)_p_item
191 withView: (NSView *)o_parent_view
192 withVerticalOffset: (int)i_yPos
193 withLastItem: (int)i_lastItem;
194 - (IBAction)sliderChanged:(id)sender;
195 - (void)textfieldChanged:(NSNotification *)o_notification;
199 @interface KeyConfigControlBefore103 : VLCConfigControl
201 NSButton *o_cmd_checkbox;
202 NSButton *o_ctrl_checkbox;
203 NSButton *o_alt_checkbox;
204 NSButton *o_shift_checkbox;
205 NSPopUpButton *o_popup;
208 - (id) initWithItem: (module_config_t *)_p_item
209 withView: (NSView *)o_parent_view
210 withVerticalOffset: (int)i_yPos
211 withLastItem: (int)i_lastItem;
215 @interface KeyConfigControlAfter103 : VLCConfigControl
217 NSPopUpButton *o_popup;
220 - (id) initWithItem: (module_config_t *)_p_item
221 withView: (NSView *)o_parent_view
222 withVerticalOffset: (int)i_yPos
223 withLastItem: (int)i_lastItem;
227 @interface ModuleListConfigControl : VLCConfigControl
229 NSTextField *o_textfield;
230 NSScrollView *o_scrollview;
231 NSMutableArray *o_modulearray;
234 - (id) initWithItem: (module_config_t *)_p_item
235 withView: (NSView *)o_parent_view
236 withVerticalOffset: (int)i_yPos
237 withLastItem: (int)i_lastItem;
241 //#undef CONFIG_ITEM_LIST_STRING
242 //#undef CONFIG_ITEM_RANGED_INTEGER
243 //#undef CONFIG_ITEM_KEY_BEFORE_10_3
244 //#undef CONFIG_ITEM_KEY_AFTER_10_3