]> git.sesse.net Git - vlc/blob - modules/gui/macosx/prefs.h
String Review round one, Mac OS X interface.
[vlc] / modules / gui / macosx / prefs.h
1 /*****************************************************************************
2  * prefs.h: MacOS X module for vlc
3  *****************************************************************************
4  * Copyright (C) 2002-2003 VideoLAN
5  * $Id: prefs.h,v 1.13 2004/01/25 17:01:57 murray Exp $
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
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 PREFS_WRAP 300
25
26 @interface VLCTreeItem : NSObject
27 {
28     NSString *o_name;
29     int i_object_id;
30     VLCTreeItem *o_parent;
31     NSMutableArray *o_children;
32 }
33
34 + (VLCTreeItem *)rootItem;
35 - (int)numberOfChildren;
36 - (VLCTreeItem *)childAtIndex:(int)i_index;
37 - (int)getObjectID;
38 - (NSString *)getName;
39 - (BOOL)hasPrefs:(NSString *)o_module_name;
40
41 @end
42
43 /*****************************************************************************
44  * VLCPrefs interface
45  *****************************************************************************/
46 @interface VLCPrefs : NSObject
47 {
48     intf_thread_t *p_intf;
49     vlc_bool_t b_advanced;
50     VLCTreeItem *o_config_tree;
51     NSView *o_empty_view;
52     NSMutableDictionary *o_save_prefs;
53     
54     IBOutlet id o_prefs_window;
55     IBOutlet id o_tree;
56     IBOutlet id o_prefs_view;
57     IBOutlet id o_save_btn;
58     IBOutlet id o_cancel_btn;
59     IBOutlet id o_reset_btn;
60     IBOutlet id o_advanced_ckb;
61 }
62
63 - (void)initStrings;
64 - (void)showPrefs;
65 - (IBAction)savePrefs: (id)sender;
66 - (IBAction)closePrefs: (id)sender;
67 - (IBAction)resetAll: (id)sender;
68 - (void)sheetDidEnd:(NSWindow *)o_sheet returnCode:(int)i_return contextInfo:(void *)o_context;
69 - (IBAction)advancedToggle: (id)sender;
70 - (IBAction)openFileDialog: (id)sender;
71 - (void)pathChosenInPanel:(NSOpenPanel *)o_sheet withReturn:(int)i_return_code contextInfo:(void  *)o_context_info;
72 - (void)showViewForID: (int) i_id andName:(NSString *)o_item_name;
73 - (void)configChanged:(id)o_unknown;
74
75 @end
76
77 @interface VLCFlippedView : NSView
78 {
79
80 }
81
82 @end
83
84 #define INTF_CONTROL_CONFIG(x) \
85 @interface VLC##x : NS##x \
86 { \
87     NSString *o_module_name; \
88     NSString *o_config_name; \
89     int i_config_type; \
90 } \
91 - (void)setModuleName:(NSString *)_o_module_name; \
92 - (void)setConfigName:(NSString *)_o_config_name; \
93 - (void)setConfigType:(int)_i_config_type; \
94 - (NSString *)moduleName; \
95 - (NSString *)configName; \
96 - (int)configType; \
97 @end
98
99 #define IMPL_CONTROL_CONFIG(x) \
100 @implementation VLC##x \
101 - (id)init \
102 { \
103     self = [super init]; \
104     if( self != nil ) \
105     { \
106         o_module_name = nil; \
107         o_config_name = nil; \
108         i_config_type = 0; \
109     } \
110     return( self ); \
111 } \
112 - (void)dealloc \
113 { \
114     if( o_module_name != nil ) \
115     { \
116         [o_module_name release]; \
117     } \
118     if( o_config_name != nil ) \
119     { \
120         [o_config_name release]; \
121     } \
122     [super dealloc]; \
123 } \
124 - (void)setModuleName:(NSString *)_o_module_name \
125 { \
126     if( o_module_name != nil ) \
127     { \
128         [o_module_name release]; \
129     } \
130     o_module_name = [_o_module_name retain]; \
131 } \
132 - (void)setConfigName:(NSString *)_o_config_name \
133 { \
134     if( o_config_name != nil ) \
135     { \
136         [o_config_name release]; \
137     } \
138     o_config_name = [_o_config_name retain]; \
139 } \
140 - (void)setConfigType:(int)_i_config_type \
141 { \
142     i_config_type = _i_config_type; \
143 } \
144 - (NSString *)moduleName \
145 { \
146     return( o_module_name ); \
147 } \
148 - (NSString *)configName \
149 { \
150     return( o_config_name ); \
151 } \
152 - (int)configType \
153 { \
154     return( i_config_type ); \
155 } \
156 @end
157
158 INTF_CONTROL_CONFIG(Button);
159 INTF_CONTROL_CONFIG(PopUpButton);
160 INTF_CONTROL_CONFIG(ComboBox);
161 INTF_CONTROL_CONFIG(TextField);
162 INTF_CONTROL_CONFIG(Slider);
163 INTF_CONTROL_CONFIG(Matrix);
164
165 #define CONTROL_CONFIG( obj, mname, ctype, cname ) \
166     { \
167         [obj setModuleName: mname]; \
168         [obj setConfigType: ctype]; \
169         [obj setConfigName: [NSString stringWithUTF8String: cname]]; \
170     }
171