1 /* GormClassManager.h
2  *
3  * Copyright (C) 1999 Free Software Foundation, Inc.
4  *
5  * Author:	Richard Frith-Macdonald <richard@brainstrom.co.uk>
6  * Author:	Gregory John Casamento <greg_casamento@yahoo.com>
7  * Date:	1999, 2002
8  *
9  * This file is part of GNUstep.
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 3 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 #include <InterfaceBuilder/IBPalette.h>
27 
28 #ifndef INCLUDED_GormClassManager_h
29 #define INCLUDED_GormClassManager_h
30 
31 // The custom classes and category arrays will hold only those things which
32 // will be persisted to the .classes file.   Since the overall list of classes will
33 // not change it seems that the only thing that we should save is the "delta"
34 // that being the custom classes.   Once loaded they can be "merged" in with the
35 // list of base classes, in gui, to form the full list of classes.
36 @interface GormClassManager : NSObject
37 {
38   NSMutableDictionary	*classInformation;
39   NSMutableArray        *customClasses;
40   NSMutableDictionary   *customClassMap;
41   NSMutableArray        *categoryClasses;
42   id                    document;
43 }
44 
45 - (id) initWithDocument: (id)aDocument;
46 
47 /* Managing actions and outlets */
48 - (void) addAction: (NSString *)anAction forObject: (id)anObject;
49 - (void) addOutlet: (NSString *)anOutlet forObject: (id)anObject;
50 - (NSArray *) allActionsForClassNamed: (NSString *)className;
51 - (NSArray *) allActionsForObject: (id)anObject;
52 - (NSArray *) extraActionsForObject: (id)anObject;
53 - (NSArray *) allOutletsForClassNamed: (NSString *)className;
54 - (NSArray *) allOutletsForObject: (id)anObject;
55 - (NSArray *) extraOutletsForObject: (id)anObject;
56 - (NSArray *) allClassNames;
57 - (void) removeAction: (NSString *)anAction forObject: (id)anObject;
58 - (void) removeOutlet: (NSString *)anOutlet forObject: (id)anObject;
59 - (void) removeAction: (NSString *)anAction fromClassNamed: (NSString *)anObject;
60 - (void) removeOutlet: (NSString *)anOutlet fromClassNamed: (NSString *)anObject;
61 - (void) addOutlet: (NSString *)anOutlet forClassNamed: (NSString *)className;
62 - (void) addAction: (NSString *)anAction forClassNamed: (NSString *)className;
63 - (void) addActions: (NSArray *)actions forClassNamed: (NSString *)className;
64 - (void) addOutlets: (NSArray *)outlets forClassNamed: (NSString *)className;
65 - (NSString *) addNewActionToClassNamed: (NSString *)name;
66 - (NSString *) addNewOutletToClassNamed: (NSString *)name;
67 - (void) replaceAction: (NSString *)oldAction withAction: (NSString *)newAction forClassNamed: (NSString *)className;
68 - (void) replaceOutlet: (NSString *)oldOutlet withOutlet: (NSString *)newOutlet forClassNamed: (NSString *)className;
69 
70 /* Managing classes and subclasses */
71 - (BOOL) renameClassNamed: (NSString *)oldName newName: (NSString *)name;
72 - (void) removeClassNamed: (NSString *)className;
73 - (NSString *) addClassWithSuperClassName: (NSString *)name;
74 - (NSArray *) subClassesOf: (NSString *)superclass;
75 - (NSArray *) allSubclassesOf: (NSString *)superClass;
76 - (NSArray *) customSubClassesOf: (NSString *)superclass;
77 - (NSArray *) allCustomSubclassesOf: (NSString *)superclass;
78 - (NSArray *) allCustomClassNames;
79 - (BOOL) addClassNamed: (NSString *)className
80    withSuperClassNamed: (NSString *)superClassName
81 	   withActions: (NSArray *)actions
82            withOutlets: (NSArray *)outlets;
83 - (BOOL) addClassNamed: (NSString *)class_name
84    withSuperClassNamed: (NSString *)super_class_name
85 	   withActions: (NSArray *)_actions
86 	   withOutlets: (NSArray *)_outlets
87               isCustom: (BOOL) isCustom;
88 - (BOOL) setSuperClassNamed: (NSString *)superclass
89 	      forClassNamed: (NSString *)subclass;
90 - (NSString *)parentOfClass: (NSString *)aClass;
91 - (NSString *) superClassNameForClassNamed: (NSString *)className;
92 - (BOOL) isSuperclass: (NSString *)superclass
93 	linkedToClass: (NSString *)subclass;
94 - (NSDictionary *) dictionaryForClassNamed: (NSString *)className;
95 - (NSString *) uniqueClassNameFrom: (NSString *)name;
96 - (BOOL) isRootClass: (NSString *)className;
97 - (BOOL) outletExists: (NSString *)outlet
98          onClassNamed: (NSString *)className;
99 - (BOOL) actionExists: (NSString *)action
100          onClassNamed: (NSString *)className;
101 
102 /* Managing custom classes */
103 - (BOOL) isCustomClass: (NSString *)className;
104 - (BOOL) isNonCustomClass: (NSString *)className;
105 - (BOOL) isCategoryForClass: (NSString *)className;
106 - (BOOL) isKnownClass: (NSString *)className;
107 - (BOOL) isAction: (NSString *)actionName ofClass: (NSString *)className;
108 - (BOOL) isOutlet: (NSString *)outletName ofClass: (NSString *)className;
109 - (NSArray *) allSuperClassesOf: (NSString *)className;
110 - (BOOL) canInstantiateClassNamed: (NSString *)className;
111 - (NSString *) customClassForObject: (id)object;
112 - (NSString *) customClassForName: (NSString *)name;
113 - (void) setCustomClass: (NSString *)className
114                 forName: (NSString *)name;
115 - (void) removeCustomClassForName: (NSString *)name;
116 - (NSMutableDictionary *) customClassMap;
117 - (void) setCustomClassMap: (NSMutableDictionary *)dict;
118 - (BOOL) isCustomClassMapEmpty;
119 - (NSString *) nonCustomSuperClassOf: (NSString *)className;
120 - (BOOL) isAction: (NSString *)actionName  onCategoryForClassNamed: (NSString *)className;
121 - (NSString *) classNameForObject: (id)object;
122 - (NSString *) findClassByName: (NSString *)name;
123 
124 /* Parsing and creating classes */
125 - (BOOL) makeSourceAndHeaderFilesForClass: (NSString *)className
126 				 withName: (NSString *)sourcePath
127 				      and: (NSString *)headerPath;
128 - (BOOL) parseHeader: (NSString *)headerPath;
129 
130 /* Loading and saving */
131 - (BOOL) saveToFile: (NSString *)path;
132 - (NSData *) data;
133 - (NSData *) nibData;
134 - (BOOL) loadFromFile: (NSString *)path;
135 - (BOOL) loadCustomClasses: (NSString *)path;
136 - (BOOL) loadCustomClassesWithData: (NSData *)data;
137 - (BOOL) loadCustomClassesWithDict: (NSDictionary *)dict;
138 - (BOOL) loadNibFormatCustomClassesWithData: (NSData *)data;
139 - (BOOL) loadNibFormatCustomClassesWithDict: (NSDictionary *)dict;
140 @end
141 
142 #endif
143