]> git.sesse.net Git - vlc/blob - modules/gui/macosx/prefs_widgets.h
*: fix problems about advanced button
[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     int             i_view_type;
39     vlc_bool_t      b_advanced;
40 }
41
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;
46 - (int)getType;
47 - (int)getViewType;
48 - (BOOL)isAdvanced;
49 - (void)setYPos:(int)i_yPos;
50 - (int)intValue;
51 - (float)floatValue;
52 - (char *)stringValue;
53 - (void)applyChanges;
54 static NSMenu   *o_keys_menu = nil;
55
56 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
57
58 @end
59
60 @interface StringConfigControl : VLCConfigControl
61 {
62     NSTextField     *o_textfield;
63 }
64
65 - (id) initWithItem: (module_config_t *)_p_item
66            withView: (NSView *)o_parent_view
67            withVerticalOffset: (int)i_yPos;
68
69 @end
70
71 @interface StringListConfigControl : VLCConfigControl
72 {
73     NSComboBox      *o_combo;
74 }
75
76 - (id) initWithItem: (module_config_t *)_p_item
77            withView: (NSView *)o_parent_view
78            withVerticalOffset: (int)i_yPos;
79
80 @end
81
82 @interface FileConfigControl : VLCConfigControl
83 {
84     NSTextField     *o_textfield;
85     NSButton        *o_button;
86     BOOL            b_directory;
87 }
88
89 - (id) initWithItem: (module_config_t *)_p_item
90            withView: (NSView *)o_parent_view
91            withVerticalOffset: (int)i_yPos;
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
107 @end
108
109 @interface IntegerConfigControl : VLCConfigControl
110 {
111     NSTextField     *o_textfield;
112     NSStepper       *o_stepper;
113 }
114
115
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;
121
122 @end
123
124 @interface IntegerListConfigControl : VLCConfigControl
125 {
126     NSComboBox      *o_combo;
127 }
128
129 - (id) initWithItem: (module_config_t *)_p_item
130            withView: (NSView *)o_parent_view
131            withVerticalOffset: (int)i_yPos;
132
133 @end
134
135 @interface RangedIntegerConfigControl : VLCConfigControl
136 {
137     NSSlider        *o_slider;
138     NSTextField     *o_textfield;
139     NSTextField     *o_textfield_min;
140     NSTextField     *o_textfield_max;
141 }
142
143
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;
149
150 @end
151
152 @interface BoolConfigControl : VLCConfigControl
153 {
154     NSButton        *o_checkbox;
155 }
156
157 - (id) initWithItem: (module_config_t *)_p_item
158            withView: (NSView *)o_parent_view
159            withVerticalOffset: (int)i_yPos;
160
161 @end
162
163 @interface FloatConfigControl : VLCConfigControl
164 {
165     NSTextField     *o_textfield;
166     NSStepper       *o_stepper;
167 }
168
169
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;
175
176 @end
177
178 @interface RangedFloatConfigControl : VLCConfigControl
179 {
180     NSSlider        *o_slider;
181     NSTextField     *o_textfield;
182     NSTextField     *o_textfield_min;
183     NSTextField     *o_textfield_max;
184 }
185
186
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;
192
193 @end
194
195 @interface KeyConfigControlBefore103 : VLCConfigControl
196 {
197     NSButton        *o_cmd_checkbox;
198     NSButton        *o_ctrl_checkbox;
199     NSButton        *o_alt_checkbox;
200     NSButton        *o_shift_checkbox;
201     NSPopUpButton   *o_popup;
202 }
203
204 - (id) initWithItem: (module_config_t *)_p_item
205            withView: (NSView *)o_parent_view
206            withVerticalOffset: (int)i_yPos;
207
208 @end
209
210 @interface KeyConfigControlAfter103 : VLCConfigControl
211 {
212     NSPopUpButton   *o_popup;
213 }
214
215 - (id) initWithItem: (module_config_t *)_p_item
216            withView: (NSView *)o_parent_view
217            withVerticalOffset: (int)i_yPos;
218
219 @end
220
221 @interface ModuleListConfigControl : VLCConfigControl
222 {
223     NSTextField     *o_textfield;
224     NSScrollView    *o_scrollview;
225     NSMutableArray  *o_modulearray;
226 }
227
228 - (id) initWithItem: (module_config_t *)_p_item
229            withView: (NSView *)o_parent_view
230            withVerticalOffset: (int)i_yPos;
231
232 @end
233
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
238