]> git.sesse.net Git - vlc/blob - modules/gui/macosx/prefs.h
* modules/gui/macosx/prefs.?:
[vlc] / modules / gui / macosx / prefs.h
1 /*****************************************************************************
2  * prefs.h: MacOS X plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2002-2003 VideoLAN
5  * $Id: prefs.h,v 1.10 2003/06/06 00:38:41 hartman 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     
53     IBOutlet id o_prefs_window;
54     IBOutlet id o_tree;
55     IBOutlet id o_prefs_view;
56     IBOutlet id o_save_btn;
57     IBOutlet id o_cancel_btn;
58     IBOutlet id o_reset_btn;
59     IBOutlet id o_advanced_ckb;
60 }
61
62 - (void)initStrings;
63 - (void)showPrefs;
64 - (IBAction)savePrefs: (id)sender;
65 - (IBAction)closePrefs: (id)sender;
66 - (IBAction)resetAll: (id)sender;
67 - (void)sheetDidEnd:(NSWindow *)o_sheet returnCode:(int)i_return contextInfo:(void *)o_context;
68 - (IBAction)advancedToggle: (id)sender;
69 - (void)showViewForID: (int) i_id andName:(NSString *)o_item_name;
70 - (void)configChanged:(id)o_unknown;
71
72 @end
73
74 @interface VLCFlippedView : NSView
75 {
76
77 }
78
79 @end
80
81 #define INTF_CONTROL_CONFIG(x) \
82 @interface VLC##x : NS##x \
83 { \
84     NSString *o_module_name; \
85     NSString *o_config_name; \
86     int i_config_type; \
87 } \
88 - (void)setModuleName:(NSString *)_o_module_name; \
89 - (void)setConfigName:(NSString *)_o_config_name; \
90 - (void)setConfigType:(int)_i_config_type; \
91 - (NSString *)moduleName; \
92 - (NSString *)configName; \
93 - (int)configType; \
94 @end
95
96 #define IMPL_CONTROL_CONFIG(x) \
97 @implementation VLC##x \
98 - (id)init \
99 { \
100     self = [super init]; \
101     if( self != nil ) \
102     { \
103         o_module_name = nil; \
104         o_config_name = nil; \
105         i_config_type = 0; \
106     } \
107     return( self ); \
108 } \
109 - (void)dealloc \
110 { \
111     if( o_module_name != nil ) \
112     { \
113         [o_module_name release]; \
114     } \
115     if( o_config_name != nil ) \
116     { \
117         [o_config_name release]; \
118     } \
119     [super dealloc]; \
120 } \
121 - (void)setModuleName:(NSString *)_o_module_name \
122 { \
123     if( o_module_name != nil ) \
124     { \
125         [o_module_name release]; \
126     } \
127     o_module_name = [_o_module_name retain]; \
128 } \
129 - (void)setConfigName:(NSString *)_o_config_name \
130 { \
131     if( o_config_name != nil ) \
132     { \
133         [o_config_name release]; \
134     } \
135     o_config_name = [_o_config_name retain]; \
136 } \
137 - (void)setConfigType:(int)_i_config_type \
138 { \
139     i_config_type = _i_config_type; \
140 } \
141 - (NSString *)moduleName \
142 { \
143     return( o_module_name ); \
144 } \
145 - (NSString *)configName \
146 { \
147     return( o_config_name ); \
148 } \
149 - (int)configType \
150 { \
151     return( i_config_type ); \
152 } \
153 @end
154
155 INTF_CONTROL_CONFIG(Button);
156 INTF_CONTROL_CONFIG(PopUpButton);
157 INTF_CONTROL_CONFIG(ComboBox);
158 INTF_CONTROL_CONFIG(TextField);
159 INTF_CONTROL_CONFIG(Slider);
160
161 #define CONTROL_CONFIG( obj, mname, ctype, cname ) \
162     { \
163         [obj setModuleName: mname]; \
164         [obj setConfigType: ctype]; \
165         [obj setConfigName: [NSString stringWithUTF8String: cname]]; \
166     }
167