1 /* -*- mode: objc -*- 2 * Defaults.h 3 * 4 * Copyright (C) 2006-2013 Free Software Foundation, Inc. 5 * 6 * Author: Enrico Sersale <enrico@imago.ro> 7 * Date: February 2006 8 * 9 * This file is part of the GNUstep "Defaults" Preference Pane 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. 24 */ 25 26 #ifndef DEFAULTS_H 27 #define DEFAULTS_H 28 29 #import <Foundation/Foundation.h> 30 #import "PreferencePanes.h" 31 32 #define STRING_EDITOR 0 33 #define BOOL_EDITOR 1 34 #define NUMBER_EDITOR 2 35 #define ARRAY_EDITOR 3 36 #define LIST_EDITOR 4 37 38 @class NSMatrix; 39 @class NSBox; 40 @class DefaultEntry; 41 @class NSPopUpButton; 42 43 @interface Defaults : NSPreferencePane 44 { 45 IBOutlet id namesScroll; 46 NSMatrix *namesMatrix; 47 IBOutlet id categoryLabel; 48 IBOutlet id categoryField; 49 IBOutlet id descriptionLabel; 50 IBOutlet id descriptionView; 51 IBOutlet NSBox *editorBox; 52 53 IBOutlet id editorsWin; 54 55 IBOutlet id stringEditorBox; 56 IBOutlet id stringEdField; 57 IBOutlet id stringEdDefaultRevert; 58 IBOutlet id stringEdSet; 59 60 IBOutlet id boolEditorBox; 61 IBOutlet id boolEdPopup; 62 IBOutlet id boolEdDefaultRevert; 63 IBOutlet id boolEdSet; 64 65 IBOutlet id numberEditorBox; 66 IBOutlet id numberEdField; 67 IBOutlet id numberEdDefaultRevert; 68 IBOutlet id numberEdSet; 69 70 IBOutlet id arrayEditorBox; 71 IBOutlet id arrayEdScroll; 72 NSMatrix *arrayEdMatrix; 73 IBOutlet id arrayEdField; 74 IBOutlet id arrayEdAdd; 75 IBOutlet id arrayEdRemove; 76 IBOutlet id arrayEdDefaultRevert; 77 IBOutlet id arrayEdSet; 78 79 IBOutlet NSBox *listEditorBox; 80 IBOutlet NSPopUpButton *listEdPopup; 81 IBOutlet NSButton *listEdDefaultRevert; 82 IBOutlet NSButton *listEdSet; 83 84 NSMutableArray *defaultsEntries; 85 DefaultEntry *currentEntry; 86 87 BOOL loaded; 88 } 89 90 - (DefaultEntry *)entryWithName:(NSString *)name; 91 92 - (void)namesMatrixAction:(id)sender; 93 94 - (void)disableControls; 95 96 - (void)updateDefaults; 97 98 @end 99 100 101 @interface Defaults (Editing) 102 103 // 104 // String 105 // 106 - (IBAction)stringDefaultRevertAction:(id)sender; 107 108 - (IBAction)stringSetAction:(id)sender; 109 110 // 111 // Bool 112 // 113 - (IBAction)boolPopupAction:(id)sender; 114 115 - (IBAction)boolDefaultRevertAction:(id)sender; 116 117 - (IBAction)boolSetAction:(id)sender; 118 119 // 120 // Number 121 // 122 - (IBAction)numberDefaultRevertAction:(id)sender; 123 124 - (IBAction)numberSetAction:(id)sender; 125 126 127 // 128 // Array 129 // 130 - (void)arrayEdMatrixAction:(id)sender; 131 132 - (IBAction)arrayAddAction:(id)sender; 133 134 - (IBAction)arrayRemoveAction:(id)sender; 135 136 - (IBAction)arrayDefaultRevertAction:(id)sender; 137 138 - (IBAction)arraySetAction:(id)sender; 139 140 // 141 // List 142 // 143 - (IBAction)listPopupAction:(id)sender; 144 145 - (IBAction)listDefaultRevertAction:(id)sender; 146 147 - (IBAction)listSetAction:(id)sender; 148 149 @end 150 151 152 @interface DefaultEntry : NSObject 153 { 154 NSString *name; 155 NSString *category; 156 NSString *description; 157 NSArray *values; 158 id defaultValue; 159 id userValue; 160 int editorType; 161 } 162 163 - (id)initWithUserDefaults:(NSUserDefaults *)defaults 164 withName:(NSString *)dfname 165 inCategory:(NSString *)cat 166 description:(NSString *)desc 167 values:(NSArray *)vals 168 defaultValue:(id)dval 169 editorType:(int)edtype; 170 171 - (NSString *)name; 172 173 - (NSString *)category; 174 175 - (NSString *)description; 176 177 - (id)defaultValue; 178 179 - (id)userValue; 180 181 - (void)setUserValue:(id)usval; 182 183 - (int)editorType; 184 185 - (NSArray *)values; 186 187 @end 188 189 #endif // DEFAULTS_H 190 191