1 /*****************************************************************************
2 * prefs_widgets.h: Preferences controls
3 *****************************************************************************
4 * Copyright (C) 2002-2012 VLC authors and VideoLAN
7 * Authors: Derk-Jan Hartman <hartman at videolan.org>
8 * Felix Paul Kühne <fkuehne at videolan.org>
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.
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.
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 *****************************************************************************/
25 #define CONFIG_ITEM_STRING_LIST (CONFIG_ITEM_STRING + 10)
26 #define CONFIG_ITEM_RANGED_INTEGER (CONFIG_ITEM_INTEGER + 10)
28 #define RIGHTMARGIN 18
30 static NSMenu *o_keys_menu = nil;
32 @interface VLCConfigControl : NSView
34 module_config_t *p_item;
42 @property (readonly) NSString * name;
43 @property (readonly) int type;
44 @property (readonly) int viewType;
45 @property (readonly) bool advanced;
46 @property (readonly) int intValue;
47 @property (readonly) float floatValue;
48 @property (readonly) char * stringValue;
49 @property (readonly) int labelSize;
51 + (VLCConfigControl *)newControl: (module_config_t *)_p_item
52 withView: (NSView *)o_parent_view;
53 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
55 - (id)initWithFrame: (NSRect)frame item: (module_config_t *)p_item;
57 - (void)setYPos:(int)i_yPos;
58 - (void)alignWithXPosition:(int)i_xPos;
65 @interface StringConfigControl : VLCConfigControl
67 NSTextField *o_textfield;
70 - (id) initWithItem: (module_config_t *)_p_item
71 withView: (NSView *)o_parent_view;
75 @interface StringListConfigControl : VLCConfigControl
77 NSPopUpButton *o_popup;
80 - (id) initWithItem: (module_config_t *)_p_item
81 withView: (NSView *)o_parent_view;
85 @interface FileConfigControl : VLCConfigControl
87 NSTextField *o_textfield;
92 - (id) initWithItem: (module_config_t *)_p_item
93 withView: (NSView *)o_parent_view;
95 - (IBAction)openFileDialog: (id)sender;
99 @interface ModuleConfigControl : VLCConfigControl
101 NSPopUpButton *o_popup;
104 - (id) initWithItem: (module_config_t *)_p_item
105 withView: (NSView *)o_parent_view;
109 @interface IntegerConfigControl : VLCConfigControl <NSTextFieldDelegate>
111 NSTextField *o_textfield;
112 NSStepper *o_stepper;
116 - (id) initWithItem: (module_config_t *)_p_item
117 withView: (NSView *)o_parent_view;
118 - (IBAction)stepperChanged:(id)sender;
119 - (void)textfieldChanged:(NSNotification *)o_notification;
123 @interface IntegerListConfigControl : VLCConfigControl
125 NSPopUpButton *o_popup;
128 - (id) initWithItem: (module_config_t *)_p_item
129 withView: (NSView *)o_parent_view;
133 @interface RangedIntegerConfigControl : VLCConfigControl <NSTextFieldDelegate>
136 NSTextField *o_textfield;
137 NSTextField *o_textfield_min;
138 NSTextField *o_textfield_max;
142 - (id) initWithItem: (module_config_t *)_p_item
143 withView: (NSView *)o_parent_view;
144 - (IBAction)sliderChanged:(id)sender;
145 - (void)textfieldChanged:(NSNotification *)o_notification;
149 @interface BoolConfigControl : VLCConfigControl
151 NSButton *o_checkbox;
154 - (id) initWithItem: (module_config_t *)_p_item
155 withView: (NSView *)o_parent_view;
159 @interface FloatConfigControl : VLCConfigControl <NSTextFieldDelegate>
161 NSTextField *o_textfield;
162 NSStepper *o_stepper;
166 - (id) initWithItem: (module_config_t *)_p_item
167 withView: (NSView *)o_parent_view;
168 - (IBAction)stepperChanged:(id)sender;
169 - (void)textfieldChanged:(NSNotification *)o_notification;
173 @interface RangedFloatConfigControl : VLCConfigControl <NSTextFieldDelegate>
176 NSTextField *o_textfield;
177 NSTextField *o_textfield_min;
178 NSTextField *o_textfield_max;
182 - (id) initWithItem: (module_config_t *)_p_item
183 withView: (NSView *)o_parent_view;
184 - (IBAction)sliderChanged:(id)sender;
185 - (void)textfieldChanged:(NSNotification *)o_notification;
189 @interface KeyConfigControl : VLCConfigControl
191 NSPopUpButton *o_popup;
194 - (id) initWithItem: (module_config_t *)_p_item
195 withView: (NSView *)o_parent_view;
199 @interface ModuleListConfigControl : VLCConfigControl <NSTableViewDataSource>
201 NSTextField *o_textfield;
202 NSScrollView *o_scrollview;
203 NSMutableArray *o_modulearray;
206 - (id) initWithItem: (module_config_t *)_p_item
207 withView: (NSView *)o_parent_view;
211 @interface SectionControl : VLCConfigControl
215 - (id) initWithItem: (module_config_t *)_p_item
216 withView: (NSView *)o_parent_view;
220 //#undef CONFIG_ITEM_LIST_STRING
221 //#undef CONFIG_ITEM_RANGED_INTEGER