]> git.sesse.net Git - vlc/blob - modules/gui/macosx/prefs_widgets.h
macosx: minor code optimization
[vlc] / modules / gui / macosx / prefs_widgets.h
1 /*****************************************************************************
2  * prefs_widgets.h: Preferences controls
3  *****************************************************************************
4  * Copyright (C) 2002-2012 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Derk-Jan Hartman <hartman at videolan.org>
8  *          Felix Paul Kühne <fkuehne at videolan.org>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 #define CONFIG_ITEM_STRING_LIST (CONFIG_ITEM_STRING + 10)
26 #define CONFIG_ITEM_RANGED_INTEGER (CONFIG_ITEM_INTEGER + 10)
27 #define LEFTMARGIN  18
28 #define RIGHTMARGIN 18
29
30 static NSMenu   *o_keys_menu = nil;
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     bool      b_advanced;
40 }
41
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;
50
51 + (VLCConfigControl *)newControl: (module_config_t *)_p_item
52         withView: (NSView *)o_parent_view;
53 + (int)calcVerticalMargin: (int)i_curItem lastItem:(int)i_lastItem;
54
55 - (id)initWithFrame: (NSRect)frame item: (module_config_t *)p_item;
56
57 - (void)setYPos:(int)i_yPos;
58 - (void)alignWithXPosition:(int)i_xPos;
59
60 - (void)applyChanges;
61 - (void)resetValues;
62
63 @end
64
65 @interface StringConfigControl : VLCConfigControl
66 {
67     NSTextField     *o_textfield;
68 }
69
70 - (id) initWithItem: (module_config_t *)_p_item
71            withView: (NSView *)o_parent_view;
72
73 @end
74
75 @interface StringListConfigControl : VLCConfigControl
76 {
77     NSPopUpButton      *o_popup;
78 }
79
80 - (id) initWithItem: (module_config_t *)_p_item
81            withView: (NSView *)o_parent_view;
82
83 @end
84
85 @interface FileConfigControl : VLCConfigControl
86 {
87     NSTextField     *o_textfield;
88     NSButton        *o_button;
89     BOOL            b_directory;
90 }
91
92 - (id) initWithItem: (module_config_t *)_p_item
93            withView: (NSView *)o_parent_view;
94
95 - (IBAction)openFileDialog: (id)sender;
96
97 @end
98
99 @interface ModuleConfigControl : VLCConfigControl
100 {
101     NSPopUpButton   *o_popup;
102 }
103
104 - (id) initWithItem: (module_config_t *)_p_item
105            withView: (NSView *)o_parent_view;
106
107 @end
108
109 @interface IntegerConfigControl : VLCConfigControl <NSTextFieldDelegate>
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 - (IBAction)stepperChanged:(id)sender;
119 - (void)textfieldChanged:(NSNotification *)o_notification;
120
121 @end
122
123 @interface IntegerListConfigControl : VLCConfigControl
124 {
125     NSPopUpButton      *o_popup;
126 }
127
128 - (id) initWithItem: (module_config_t *)_p_item
129            withView: (NSView *)o_parent_view;
130
131 @end
132
133 @interface RangedIntegerConfigControl : VLCConfigControl <NSTextFieldDelegate>
134 {
135     NSSlider        *o_slider;
136     NSTextField     *o_textfield;
137     NSTextField     *o_textfield_min;
138     NSTextField     *o_textfield_max;
139 }
140
141
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;
146
147 @end
148
149 @interface BoolConfigControl : VLCConfigControl
150 {
151     NSButton        *o_checkbox;
152 }
153
154 - (id) initWithItem: (module_config_t *)_p_item
155            withView: (NSView *)o_parent_view;
156
157 @end
158
159 @interface FloatConfigControl : VLCConfigControl <NSTextFieldDelegate>
160 {
161     NSTextField     *o_textfield;
162     NSStepper       *o_stepper;
163 }
164
165
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;
170
171 @end
172
173 @interface RangedFloatConfigControl : VLCConfigControl <NSTextFieldDelegate>
174 {
175     NSSlider        *o_slider;
176     NSTextField     *o_textfield;
177     NSTextField     *o_textfield_min;
178     NSTextField     *o_textfield_max;
179 }
180
181
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;
186
187 @end
188
189 @interface KeyConfigControl : VLCConfigControl
190 {
191     NSPopUpButton   *o_popup;
192 }
193
194 - (id) initWithItem: (module_config_t *)_p_item
195            withView: (NSView *)o_parent_view;
196
197 @end
198
199 @interface ModuleListConfigControl : VLCConfigControl <NSTableViewDataSource>
200 {
201     NSTextField     *o_textfield;
202     NSScrollView    *o_scrollview;
203     NSMutableArray  *o_modulearray;
204 }
205
206 - (id) initWithItem: (module_config_t *)_p_item
207            withView: (NSView *)o_parent_view;
208
209 @end
210
211 @interface SectionControl : VLCConfigControl
212 {
213 }
214
215 - (id) initWithItem: (module_config_t *)_p_item
216            withView: (NSView *)o_parent_view;
217
218 @end
219
220 //#undef CONFIG_ITEM_LIST_STRING
221 //#undef CONFIG_ITEM_RANGED_INTEGER
222